Finish removing String::format
authordarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 2 Mar 2019 05:45:11 +0000 (05:45 +0000)
committerdarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 2 Mar 2019 05:45:11 +0000 (05:45 +0000)
commitf31054205facb7c50ece44f74bdbb70ecc0e81c2
tree41af470d296fe70b4ce0eb6e975611299ecaf83f
parent47b6c8db060de4c53bc670cdd9878a2132ccf0bb
Finish removing String::format
https://bugs.webkit.org/show_bug.cgi?id=194893

Reviewed by Daniel Bates.
Source/JavaScriptCore:

* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::nameForRegister): Use makeString instead of String::format,
using the new "pad" function.

Source/WebCore:

* dom/Document.cpp:
(WebCore::Document::lastModified const): Use makeString and pad.
* html/FTPDirectoryDocument.cpp:
(WebCore::processFileDateString): Ditto.

* mathml/MathMLElement.cpp:
(WebCore::convertToPercentageIfNeeded): Use makeString and FormattedNumber.

* page/cocoa/ResourceUsageOverlayCocoa.mm:
(WebCore::ResourceUsageOverlay::platformDraw): Use makeString and pad.

* page/linux/ResourceUsageOverlayLinux.cpp:
(WebCore::cpuUsageString): Use makeString, FormattedNumber, and pad.
(WebCore::gcTimerString): Use String::number.

* platform/DateComponents.cpp:
(WebCore::DateComponents::toStringForTime const): Use makeString and pad.
(WebCore::DateComponents::toString const): Ditto.

* platform/LocalizedStrings.cpp: Removed comment that mentioned String::format,
and that was also inaccurate.

* platform/audio/HRTFElevation.cpp:
(WebCore::HRTFElevation::calculateKernelsForAzimuthElevation):
Use makeString and pad.
* platform/mock/MockRealtimeVideoSource.cpp:
(WebCore::MockRealtimeVideoSource::drawText): Ditto.
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::logLayerInfo): Ditto.
* rendering/RenderTheme.cpp:
(WebCore::RenderTheme::formatMediaControlsTime const): Ditto.

Source/WebKit:

* UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
(WebKit::LocalAuthenticator::getAssertion): Use makeString, attempting to fix
a problem where we passed an NSData * to format with a "%s"."

Source/WebKitLegacy/win:

* FullscreenVideoController.cpp:
(timeToString): Use makeString and pad.

Source/WTF:

* wtf/Assertions.cpp:
(WTF::createWithFormatAndArguments): Moved this here from WTFString.cpp.
(WTFLog): Use WTF::createWithFormatAndArguments instead of String::format.

* wtf/HexNumber.h: Deleted unneeded toString function.

* wtf/text/StringConcatenate.h: Got rid of unneeded forward declaration of
StringTypeAdapter, since that's now in Forward.h. Tweaked formatting of templates
a bit. Use function templates for writeTo functions rather than having two of each.
Removed unused toString functions. Optimized case where we use have a UChar* and
a length of zero to not force the result to be 16-bit. Also gets rid of a small
NO_RETURN_DUE_TO_CRASH mess that we don't need. Refactored constructors to use some
static member helper functions to compute string lengths. Added the pad function
and the PaddingSpecification struct template, so we can add padding to anything
we can turn into a string. Got rid of the special case overload for single
arguments, since it only worked for things that the String constructor can handle.
Instead we will now use StringTypeAdapter, which works for more types. Possibly
less optimal for some special cases, which we could specialize for later if we like.
* wtf/text/StringConcatenateNumbers.h: Ditto.
* wtf/text/StringOperators.h: Ditto.
* wtf/text/StringView.h: Ditto.

* wtf/text/WTFString.cpp:
(WTF::createWithFormatAndArguments): Deleted.
(WTF::String::format): Deleted.
* wtf/text/WTFString.h: Deleted declaration of String::format.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242308 268f45cc-cd09-0410-ab3c-d52691b4dbfc
29 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/bytecode/CodeBlock.cpp
Source/WTF/ChangeLog
Source/WTF/wtf/Assertions.cpp
Source/WTF/wtf/HexNumber.h
Source/WTF/wtf/text/StringConcatenate.h
Source/WTF/wtf/text/StringConcatenateNumbers.h
Source/WTF/wtf/text/StringOperators.h
Source/WTF/wtf/text/StringView.h
Source/WTF/wtf/text/WTFString.cpp
Source/WTF/wtf/text/WTFString.h
Source/WebCore/ChangeLog
Source/WebCore/dom/Document.cpp
Source/WebCore/html/FTPDirectoryDocument.cpp
Source/WebCore/mathml/MathMLElement.cpp
Source/WebCore/page/cocoa/ResourceUsageOverlayCocoa.mm
Source/WebCore/page/linux/ResourceUsageOverlayLinux.cpp
Source/WebCore/platform/DateComponents.cpp
Source/WebCore/platform/LocalizedStrings.cpp
Source/WebCore/platform/audio/HRTFElevation.cpp
Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp
Source/WebCore/rendering/RenderLayerCompositor.cpp
Source/WebCore/rendering/RenderTheme.cpp
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm
Source/WebKitLegacy/win/ChangeLog
Source/WebKitLegacy/win/FullscreenVideoController.cpp
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WTF/StringConcatenate.cpp