2010-10-14 Nikolas Zimmermann <nzimmermann@rim.com>
authorzimmermann@webkit.org <zimmermann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Oct 2010 19:48:45 +0000 (19:48 +0000)
committerzimmermann@webkit.org <zimmermann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Oct 2010 19:48:45 +0000 (19:48 +0000)
        Reviewed by Gavin Barraclough.

        Replace lots of String::format() usages by StringConcatenate
        https://bugs.webkit.org/show_bug.cgi?id=47664

        Add StringTypeAdapter<char> to accept single characters for makeString().

        * wtf/text/StringConcatenate.h:
        (WTF::makeString):
2010-10-14  Nikolas Zimmermann  <nzimmermann@rim.com>

        Reviewed by Gavin Barraclough.

        Replace lots of String::format() usages by StringConcatenate
        https://bugs.webkit.org/show_bug.cgi?id=47664

        * ForwardingHeaders/wtf/text/StringConcatenate.h: Added.
        * bindings/js/JSDOMWindowBase.cpp:
        (WebCore::JSDOMWindowBase::crossDomainAccessErrorMessage):
        * bindings/v8/V8Proxy.cpp:
        (WebCore::V8Proxy::reportUnsafeAccessTo):
        * dom/ExceptionBase.cpp:
        (WebCore::ExceptionBase::ExceptionBase):
        * dom/XMLDocumentParser.cpp:
        (WebCore::XMLDocumentParser::handleError):
        * history/PageCache.cpp:
        (WebCore::logCanCacheFrameDecision):
        * html/FTPDirectoryDocument.cpp:
        (WebCore::processFileDateString):
        * inspector/CodeGeneratorInspector.pm:
        * inspector/InspectorController.cpp:
        (WebCore::InspectorController::didReceiveResponse):
        (WebCore::InspectorController::count):
        * inspector/InspectorDOMAgent.cpp:
        (WebCore::InspectorDOMAgent::createBreakpointId):
        * inspector/InspectorDebuggerAgent.cpp:
        (WebCore::formatBreakpointId):
        * inspector/InspectorProfilerAgent.cpp:
        (WebCore::InspectorProfilerAgent::addProfileFinishedMessageToConsole):
        (WebCore::InspectorProfilerAgent::addStartProfilingMessageToConsole):
        (WebCore::InspectorProfilerAgent::getCurrentUserInitiatedProfileName):
        (WebCore::InspectorProfilerAgent::takeHeapSnapshot):
        * loader/CachedResourceLoader.cpp:
        (WebCore::CachedResourceLoader::printAccessDeniedMessage):
        * loader/FrameLoader.cpp:
        (WebCore::FrameLoader::checkIfDisplayInsecureContent):
        (WebCore::FrameLoader::checkIfRunInsecureContent):
        (WebCore::FrameLoader::shouldAllowNavigation):
        * loader/archive/cf/LegacyWebArchive.cpp:
        (WebCore::LegacyWebArchive::createFromSelection):
        * page/DOMWindow.cpp:
        (WebCore::DOMWindow::postMessageTimerFired):
        * page/PrintContext.cpp:
        (WebCore::PrintContext::pageProperty):
        (WebCore::PrintContext::pageSizeAndMarginsInPixels):
        * page/XSSAuditor.cpp:
        (WebCore::XSSAuditor::canLoadObject):
        * platform/efl/PlatformKeyboardEventEfl.cpp:
        (WebCore::createKeyMap):
        (WebCore::createWindowsKeyMap):
        * platform/graphics/GraphicsLayer.cpp:
        (WebCore::GraphicsLayer::animationNameForTransition):
        * platform/graphics/brew/ImageBrew.cpp:
        (WebCore::Image::loadPlatformResource):
        * platform/graphics/cg/ImageBufferCG.cpp:
        (WebCore::ImageBuffer::toDataURL):
        * platform/graphics/efl/ImageEfl.cpp:
        (WebCore::loadResourceSharedBuffer):
        * platform/graphics/gtk/ImageBufferGtk.cpp:
        (WebCore::ImageBuffer::toDataURL):
        * platform/graphics/haiku/ImageBufferHaiku.cpp:
        (WebCore::ImageBuffer::toDataURL):
        * platform/graphics/mac/GraphicsLayerCA.mm:
        (WebCore::animationIdentifier):
        * platform/graphics/qt/ImageBufferQt.cpp:
        (WebCore::ImageBuffer::toDataURL):
        * platform/graphics/skia/ImageBufferSkia.cpp:
        (WebCore::ImageBuffer::toDataURL):
        * platform/graphics/win/WebLayer.cpp:
        (WebCore::WebLayer::drawInContext):
        * platform/network/CredentialStorage.cpp:
        (WebCore::originStringFromURL):
        * platform/sql/SQLiteDatabase.cpp:
        (WebCore::SQLiteDatabase::setSynchronous):
        * platform/text/wince/TextCodecWinCE.cpp:
        (WebCore::LanguageManager::LanguageManager):
        * platform/win/ClipboardUtilitiesWin.cpp:
        (WebCore::markupToCFHTML):
        * platform/win/Language.cpp:
        (WebCore::defaultLanguage):
        * plugins/PluginStream.cpp:
        (WebCore::PluginStream::startStream):
        * svg/SVGUseElement.cpp:
        (WebCore::dumpInstanceTree):
        * websockets/WebSocket.cpp:
        (WebCore::WebSocket::connect):
        * websockets/WebSocketChannel.cpp:
        (WebCore::WebSocketChannel::appendToBuffer):
        * websockets/WebSocketHandshake.cpp:
        (WebCore::WebSocketHandshake::readServerHandshake):
2010-10-14  Nikolas Zimmermann  <nzimmermann@rim.com>

        Reviewed by Gavin Barraclough.

        Replace lots of String::format() usages by StringConcatenate
        https://bugs.webkit.org/show_bug.cgi?id=47664

        Rebaseline two xssAuditor tests, that have been changed, after switching from String::format() -> makeString().

        * http/tests/security/xssAuditor/embed-tag-null-char-expected.txt:
        * http/tests/security/xssAuditor/object-embed-tag-null-char-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@69798 268f45cc-cd09-0410-ab3c-d52691b4dbfc

45 files changed:
JavaScriptCore/ChangeLog
JavaScriptCore/wtf/text/StringConcatenate.h
LayoutTests/ChangeLog
LayoutTests/http/tests/security/xssAuditor/embed-tag-null-char-expected.txt
LayoutTests/http/tests/security/xssAuditor/object-embed-tag-null-char-expected.txt
WebCore/ChangeLog
WebCore/ForwardingHeaders/wtf/text/StringConcatenate.h [new file with mode: 0644]
WebCore/bindings/js/JSDOMWindowBase.cpp
WebCore/bindings/v8/V8Proxy.cpp
WebCore/dom/ExceptionBase.cpp
WebCore/dom/XMLDocumentParser.cpp
WebCore/history/PageCache.cpp
WebCore/html/FTPDirectoryDocument.cpp
WebCore/inspector/CodeGeneratorInspector.pm
WebCore/inspector/InspectorController.cpp
WebCore/inspector/InspectorDOMAgent.cpp
WebCore/inspector/InspectorDebuggerAgent.cpp
WebCore/inspector/InspectorProfilerAgent.cpp
WebCore/loader/CachedResourceLoader.cpp
WebCore/loader/FrameLoader.cpp
WebCore/loader/archive/cf/LegacyWebArchive.cpp
WebCore/page/DOMWindow.cpp
WebCore/page/PrintContext.cpp
WebCore/page/XSSAuditor.cpp
WebCore/platform/efl/PlatformKeyboardEventEfl.cpp
WebCore/platform/graphics/GraphicsLayer.cpp
WebCore/platform/graphics/brew/ImageBrew.cpp
WebCore/platform/graphics/cg/ImageBufferCG.cpp
WebCore/platform/graphics/efl/ImageEfl.cpp
WebCore/platform/graphics/gtk/ImageBufferGtk.cpp
WebCore/platform/graphics/haiku/ImageBufferHaiku.cpp
WebCore/platform/graphics/mac/GraphicsLayerCA.mm
WebCore/platform/graphics/qt/ImageBufferQt.cpp
WebCore/platform/graphics/skia/ImageBufferSkia.cpp
WebCore/platform/graphics/win/WebLayer.cpp
WebCore/platform/network/CredentialStorage.cpp
WebCore/platform/sql/SQLiteDatabase.cpp
WebCore/platform/text/wince/TextCodecWinCE.cpp
WebCore/platform/win/ClipboardUtilitiesWin.cpp
WebCore/platform/win/Language.cpp
WebCore/plugins/PluginStream.cpp
WebCore/svg/SVGUseElement.cpp
WebCore/websockets/WebSocket.cpp
WebCore/websockets/WebSocketChannel.cpp
WebCore/websockets/WebSocketHandshake.cpp

index 45bdc08..7752d9a 100644 (file)
@@ -1,3 +1,15 @@
+2010-10-14  Nikolas Zimmermann  <nzimmermann@rim.com>
+
+        Reviewed by Gavin Barraclough.
+
+        Replace lots of String::format() usages by StringConcatenate
+        https://bugs.webkit.org/show_bug.cgi?id=47664
+
+        Add StringTypeAdapter<char> to accept single characters for makeString().
+
+        * wtf/text/StringConcatenate.h:
+        (WTF::makeString):
+
 2010-10-14  David Goodwin  <david_goodwin@apple.com>
 
         Reviewed by Darin Adler.
index 891e515..030bf64 100644 (file)
@@ -35,6 +35,21 @@ class StringTypeAdapter {
 };
 
 template<>
+class StringTypeAdapter<char> {
+public:
+    StringTypeAdapter<char>(char buffer)
+        : m_buffer(buffer)
+    {
+    }
+
+    unsigned length() { return 1; }
+    void writeTo(UChar* destination) { *destination = m_buffer; }
+
+private:
+    unsigned char m_buffer;
+};
+
+template<>
 class StringTypeAdapter<char*> {
 public:
     StringTypeAdapter<char*>(char* buffer)
@@ -360,6 +375,13 @@ PassRefPtr<StringImpl> tryMakeString(StringType1 string1, StringType2 string2, S
     return resultImpl;
 }
 
+// Convenience only.
+template<typename StringType1>
+String makeString(StringType1 string1)
+{
+    return String(string1);
+}
+
 template<typename StringType1, typename StringType2>
 String makeString(StringType1 string1, StringType2 string2)
 {
@@ -425,4 +447,6 @@ String makeString(StringType1 string1, StringType2 string2, StringType3 string3,
 
 } // namespace WTF
 
+using WTF::makeString;
+
 #endif
index 0e206ea..0d95326 100644 (file)
@@ -1,3 +1,15 @@
+2010-10-14  Nikolas Zimmermann  <nzimmermann@rim.com>
+
+        Reviewed by Gavin Barraclough.
+
+        Replace lots of String::format() usages by StringConcatenate
+        https://bugs.webkit.org/show_bug.cgi?id=47664
+
+        Rebaseline two xssAuditor tests, that have been changed, after switching from String::format() -> makeString().
+
+        * http/tests/security/xssAuditor/embed-tag-null-char-expected.txt:
+        * http/tests/security/xssAuditor/object-embed-tag-null-char-expected.txt:
+
 2010-10-14  Robert Hogan  <robert@webkit.org>
 
         Reviewed by Antonio Gomes.
index f1c571a..f3f4215 100644 (file)
@@ -1,3 +1,3 @@
-CONSOLE MESSAGE: line 1: Refused to load an object. URL found within request: "http://127.0.0.1:8000/sec�urity/xssAuditor/resources/dummy.swf".
+CONSOLE MESSAGE: line 1: Refused to load an object. URL found within request: "http://127.0.0.1:8000/sec�urity/xssAuditor/resources/dummy.swf".
 
 
index a022a8c..bfd3936 100644 (file)
@@ -1,5 +1,5 @@
-CONSOLE MESSAGE: line 1: Refused to load an object. URL found within request: "http://127.0.0.1:8000/sec�urity/xssAuditor/resources/dummy.swf".
+CONSOLE MESSAGE: line 1: Refused to load an object. URL found within request: "http://127.0.0.1:8000/sec�urity/xssAuditor/resources/dummy.swf".
 
-CONSOLE MESSAGE: line 1: Refused to load an object. URL found within request: "http://127.0.0.1:8000/sec�urity/xssAuditor/resources/dummy.swf".
+CONSOLE MESSAGE: line 1: Refused to load an object. URL found within request: "http://127.0.0.1:8000/sec�urity/xssAuditor/resources/dummy.swf".
 
 
index a864c2c..cde1b0b 100644 (file)
@@ -1,3 +1,95 @@
+2010-10-14  Nikolas Zimmermann  <nzimmermann@rim.com>
+
+        Reviewed by Gavin Barraclough.
+
+        Replace lots of String::format() usages by StringConcatenate
+        https://bugs.webkit.org/show_bug.cgi?id=47664
+
+        * ForwardingHeaders/wtf/text/StringConcatenate.h: Added.
+        * bindings/js/JSDOMWindowBase.cpp:
+        (WebCore::JSDOMWindowBase::crossDomainAccessErrorMessage):
+        * bindings/v8/V8Proxy.cpp:
+        (WebCore::V8Proxy::reportUnsafeAccessTo):
+        * dom/ExceptionBase.cpp:
+        (WebCore::ExceptionBase::ExceptionBase):
+        * dom/XMLDocumentParser.cpp:
+        (WebCore::XMLDocumentParser::handleError):
+        * history/PageCache.cpp:
+        (WebCore::logCanCacheFrameDecision):
+        * html/FTPDirectoryDocument.cpp:
+        (WebCore::processFileDateString):
+        * inspector/CodeGeneratorInspector.pm:
+        * inspector/InspectorController.cpp:
+        (WebCore::InspectorController::didReceiveResponse):
+        (WebCore::InspectorController::count):
+        * inspector/InspectorDOMAgent.cpp:
+        (WebCore::InspectorDOMAgent::createBreakpointId):
+        * inspector/InspectorDebuggerAgent.cpp:
+        (WebCore::formatBreakpointId):
+        * inspector/InspectorProfilerAgent.cpp:
+        (WebCore::InspectorProfilerAgent::addProfileFinishedMessageToConsole):
+        (WebCore::InspectorProfilerAgent::addStartProfilingMessageToConsole):
+        (WebCore::InspectorProfilerAgent::getCurrentUserInitiatedProfileName):
+        (WebCore::InspectorProfilerAgent::takeHeapSnapshot):
+        * loader/CachedResourceLoader.cpp:
+        (WebCore::CachedResourceLoader::printAccessDeniedMessage):
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::checkIfDisplayInsecureContent):
+        (WebCore::FrameLoader::checkIfRunInsecureContent):
+        (WebCore::FrameLoader::shouldAllowNavigation):
+        * loader/archive/cf/LegacyWebArchive.cpp:
+        (WebCore::LegacyWebArchive::createFromSelection):
+        * page/DOMWindow.cpp:
+        (WebCore::DOMWindow::postMessageTimerFired):
+        * page/PrintContext.cpp:
+        (WebCore::PrintContext::pageProperty):
+        (WebCore::PrintContext::pageSizeAndMarginsInPixels):
+        * page/XSSAuditor.cpp:
+        (WebCore::XSSAuditor::canLoadObject):
+        * platform/efl/PlatformKeyboardEventEfl.cpp:
+        (WebCore::createKeyMap):
+        (WebCore::createWindowsKeyMap):
+        * platform/graphics/GraphicsLayer.cpp:
+        (WebCore::GraphicsLayer::animationNameForTransition):
+        * platform/graphics/brew/ImageBrew.cpp:
+        (WebCore::Image::loadPlatformResource):
+        * platform/graphics/cg/ImageBufferCG.cpp:
+        (WebCore::ImageBuffer::toDataURL):
+        * platform/graphics/efl/ImageEfl.cpp:
+        (WebCore::loadResourceSharedBuffer):
+        * platform/graphics/gtk/ImageBufferGtk.cpp:
+        (WebCore::ImageBuffer::toDataURL):
+        * platform/graphics/haiku/ImageBufferHaiku.cpp:
+        (WebCore::ImageBuffer::toDataURL):
+        * platform/graphics/mac/GraphicsLayerCA.mm:
+        (WebCore::animationIdentifier):
+        * platform/graphics/qt/ImageBufferQt.cpp:
+        (WebCore::ImageBuffer::toDataURL):
+        * platform/graphics/skia/ImageBufferSkia.cpp:
+        (WebCore::ImageBuffer::toDataURL):
+        * platform/graphics/win/WebLayer.cpp:
+        (WebCore::WebLayer::drawInContext):
+        * platform/network/CredentialStorage.cpp:
+        (WebCore::originStringFromURL):
+        * platform/sql/SQLiteDatabase.cpp:
+        (WebCore::SQLiteDatabase::setSynchronous):
+        * platform/text/wince/TextCodecWinCE.cpp:
+        (WebCore::LanguageManager::LanguageManager):
+        * platform/win/ClipboardUtilitiesWin.cpp:
+        (WebCore::markupToCFHTML):
+        * platform/win/Language.cpp:
+        (WebCore::defaultLanguage):
+        * plugins/PluginStream.cpp:
+        (WebCore::PluginStream::startStream):
+        * svg/SVGUseElement.cpp:
+        (WebCore::dumpInstanceTree):
+        * websockets/WebSocket.cpp:
+        (WebCore::WebSocket::connect):
+        * websockets/WebSocketChannel.cpp:
+        (WebCore::WebSocketChannel::appendToBuffer):
+        * websockets/WebSocketHandshake.cpp:
+        (WebCore::WebSocketHandshake::readServerHandshake):
+
 2010-10-14  Xan Lopez  <xlopez@igalia.com>
 
         Reviewed by Martin Robinson.
diff --git a/WebCore/ForwardingHeaders/wtf/text/StringConcatenate.h b/WebCore/ForwardingHeaders/wtf/text/StringConcatenate.h
new file mode 100644 (file)
index 0000000..666ac08
--- /dev/null
@@ -0,0 +1,4 @@
+#ifndef WebCore_FWD_StringConcatenate_h
+#define WebCore_FWD_StringConcatenate_h
+#include <JavaScriptCore/StringConcatenate.h>
+#endif
index 2872a54..e2b50d0 100644 (file)
@@ -37,7 +37,7 @@
 #include "Settings.h"
 #include "WebCoreJSClientData.h"
 #include <wtf/Threading.h>
-#include <wtf/text/CString.h>
+#include <wtf/text/StringConcatenate.h>
 
 using namespace JSC;
 
@@ -83,8 +83,8 @@ String JSDOMWindowBase::crossDomainAccessErrorMessage(const JSGlobalObject* othe
         return String();
 
     // FIXME: this error message should contain more specifics of why the same origin check has failed.
-    return String::format("Unsafe JavaScript attempt to access frame with URL %s from frame with URL %s. Domains, protocols and ports must match.\n",
-        targetURL.string().utf8().data(), originURL.string().utf8().data());
+    return makeString("Unsafe JavaScript attempt to access frame with URL ", targetURL.string(),
+                      " from frame with URL ", originURL.string(), ". Domains, protocols and ports must match.\n");
 }
 
 void JSDOMWindowBase::printErrorMessage(const String& message) const
index 67218c6..90c2ed8 100644 (file)
@@ -77,7 +77,7 @@
 #include <wtf/StdLibExtras.h>
 #include <wtf/StringExtras.h>
 #include <wtf/UnusedParam.h>
-#include <wtf/text/CString.h>
+#include <wtf/text/StringConcatenate.h>
 
 namespace WebCore {
 
@@ -191,11 +191,8 @@ void V8Proxy::reportUnsafeAccessTo(Frame* target, DelayReporting delay)
 
     // FIXME: This error message should contain more specifics of why the same
     // origin check has failed.
-    String str = String::format("Unsafe JavaScript attempt to access frame "
-                                "with URL %s from frame with URL %s. "
-                                "Domains, protocols and ports must match.\n",
-                                targetDocument->url().string().utf8().data(),
-                                sourceDocument->url().string().utf8().data());
+    String str = makeString("Unsafe JavaScript attempt to access frame with URL ", targetDocument->url().string(),
+                            " from frame with URL ", sourceDocument->url().string(), ". Domains, protocols and ports must match.\n");
 
     // Build a console message with fake source ID and line number.
     const String kSourceID = "";
index d175d8b..edca706 100644 (file)
@@ -29,6 +29,8 @@
 #include "config.h"
 #include "ExceptionBase.h"
 
+#include <wtf/text/StringConcatenate.h>
+
 namespace WebCore {
 
 ExceptionBase::ExceptionBase(const ExceptionCodeDescription& description)
@@ -37,9 +39,9 @@ ExceptionBase::ExceptionBase(const ExceptionCodeDescription& description)
     , m_description(description.description)
 {
     if (description.name)
-        m_message = String::format("%s: %s Exception %d", description.name, description.typeName, description.code);
+        m_message = makeString(description.name, ": ", description.typeName, " Exception ", String::number(description.code));
     else
-        m_message = String::format("%s Exception %d", description.typeName, description.code);
+        m_message = makeString(description.typeName, " Exception ", String::number(description.code));
 }
 
 String ExceptionBase::toString() const
index 4ae18a1..0b002f1 100644 (file)
@@ -51,7 +51,7 @@
 #include "ScriptValue.h"
 #include "TextResourceDecoder.h"
 #include "TreeDepthLimit.h"
-#include <wtf/text/CString.h>
+#include <wtf/text/StringConcatenate.h>
 #include <wtf/StringExtras.h>
 #include <wtf/Threading.h>
 #include <wtf/Vector.h>
@@ -151,11 +151,11 @@ void XMLDocumentParser::handleError(ErrorType type, const char* m, int lineNumbe
     if (type == fatal || (m_errorCount < maxErrors && m_lastErrorLine != lineNumber && m_lastErrorColumn != columnNumber)) {
         switch (type) {
             case warning:
-                m_errorMessages += String::format("warning on line %d at column %d: %s", lineNumber, columnNumber, m);
+                m_errorMessages += makeString("warning on line ", String::number(lineNumber), " at column ", String::number(columnNumber), ": ", m);
                 break;
             case fatal:
             case nonFatal:
-                m_errorMessages += String::format("error on line %d at column %d: %s", lineNumber, columnNumber, m);
+                m_errorMessages += makeString("error on line ", String::number(lineNumber), " at column ", String::number(columnNumber), ": ", m);
         }
 
         m_lastErrorLine = lineNumber;
index 08ec40a..fedc1e3 100644 (file)
@@ -47,6 +47,7 @@
 #include "SystemTime.h"
 #include <wtf/CurrentTime.h>
 #include <wtf/text/CString.h>
+#include <wtf/text/StringConcatenate.h>
 
 using namespace std;
 
@@ -76,7 +77,7 @@ static void pageCacheLog(const String& prefix, const String& message)
     LOG(PageCache, "%s%s", prefix.utf8().data(), message.utf8().data());
 }
     
-#define PCLOG(...) pageCacheLog(pageCacheLogPrefix(indentLevel), String::format(__VA_ARGS__))
+#define PCLOG(...) pageCacheLog(pageCacheLogPrefix(indentLevel), makeString(__VA_ARGS__))
     
 static bool logCanCacheFrameDecision(Frame* frame, int indentLevel)
 {
@@ -90,9 +91,9 @@ static bool logCanCacheFrameDecision(Frame* frame, int indentLevel)
     PCLOG("+---");
     KURL newURL = frame->loader()->provisionalDocumentLoader() ? frame->loader()->provisionalDocumentLoader()->url() : KURL();
     if (!newURL.isEmpty())
-        PCLOG(" Determining if frame can be cached navigating from (%s) to (%s):", currentURL.string().utf8().data(), newURL.string().utf8().data());
+        PCLOG(" Determining if frame can be cached navigating from (", currentURL.string(), ") to (", newURL.string(), "):");
     else
-        PCLOG(" Determining if subframe with URL (%s) can be cached:", currentURL.string().utf8().data());
+        PCLOG(" Determining if subframe with URL (", currentURL.string(), ") can be cached:");
     
     bool cannotCache = false;
     
index 6475ea9..2a08696 100644 (file)
@@ -39,6 +39,7 @@
 #include "Text.h"
 
 #include <wtf/text/CString.h>
+#include <wtf/text/StringConcatenate.h>
 #include <wtf/CurrentTime.h>
 #include <wtf/StdLibExtras.h>
 
@@ -253,9 +254,9 @@ static String processFileDateString(const FTPTime& fileTime)
     String dateString;
 
     if (fileTime.tm_year > -1)
-        dateString = String::format("%s %i, %i", months[month], fileTime.tm_mday, fileTime.tm_year);
+        dateString = makeString(months[month], ' ', String::number(fileTime.tm_mday), ", ", String::number(fileTime.tm_year));
     else
-        dateString = String::format("%s %i, %i", months[month], fileTime.tm_mday, now.tm_year);
+        dateString = makeString(months[month], ' ', String::number(fileTime.tm_mday), ", ", String::number(now.tm_year));
 
     return dateString + timeOfDay;
 }
index 402df8b..13e05b0 100644 (file)
@@ -314,7 +314,7 @@ sub generateBackendFunction
     my $domainAccessor = $typeTransform{$domain}->{"domainAccessor"};
     $backendTypes{$domain} = 1;
     push(@function, "    if (!$domainAccessor)");
-    push(@function, "        protocolErrors->pushString(String::format(\"Protocol Error: %s handler is not available.\", \"$domain\"));");
+    push(@function, "        protocolErrors->pushString(\"Protocol Error: $domain handler is not available.\");");
     push(@function, "");
 
     if (scalar(@inArgs)) {
@@ -324,7 +324,7 @@ sub generateBackendFunction
         push(@function, "");
         push(@function, "    RefPtr<InspectorObject> argumentsContainer;");
         push(@function, "    if (!(argumentsContainer = requestMessageObject->getObject(\"arguments\"))) {");
-        push(@function, "        protocolErrors->pushString(String::format(\"Protocol Error: 'arguments' property with type 'object' was not found.\"));");
+        push(@function, "        protocolErrors->pushString(\"Protocol Error: 'arguments' property with type 'object' was not found.\");");
         push(@function, "    } else {");
         push(@function, "        InspectorObject::const_iterator argumentsEndIterator = argumentsContainer->end();");
 
@@ -337,10 +337,10 @@ sub generateBackendFunction
             push(@function, "");
             push(@function, "        InspectorObject::const_iterator ${name}ValueIterator = argumentsContainer->find(\"$name\");");
             push(@function, "        if (${name}ValueIterator == argumentsEndIterator) {");
-            push(@function, "            protocolErrors->pushString(String::format(\"Protocol Error: Argument '%s' with type '%s' was not found.\", \"$name\", \"$JSONType\"));");
+            push(@function, "            protocolErrors->pushString(\"Protocol Error: Argument '$name' with type '$JSONType' was not found.\");");
             push(@function, "        } else {");
             push(@function, "            if (!${name}ValueIterator->second->as$JSONType(&$name)) {");
-            push(@function, "                protocolErrors->pushString(String::format(\"Protocol Error: Argument '%s' has wrong type. It should be '%s'.\", \"$name\", \"$JSONType\"));");
+            push(@function, "                protocolErrors->pushString(\"Protocol Error: Argument '$name' has wrong type. It should be '$JSONType'.\");");
             push(@function, "            }");
             push(@function, "        }");
         }
@@ -454,7 +454,7 @@ $mapEntries
 
     HashMap<String, CallHandler>::iterator it = dispatchMap.find(command);
     if (it == dispatchMap.end()) {
-        reportProtocolError(callId, String::format("Protocol Error: Invalid command was received. '%s' wasn't found.", command.utf8().data()));
+        reportProtocolError(callId, makeString("Protocol Error: Invalid command was received. '", command, "' wasn't found."));
         return;
     }
 
@@ -614,7 +614,7 @@ sub generateSource
     my @sourceContent = split("\r", $licenseTemplate);
     push(@sourceContent, "\n#include \"config.h\"");
     push(@sourceContent, "#include \"$className.h\"");
-    push(@sourceContent, "#include <wtf/text/CString.h>");
+    push(@sourceContent, "#include <wtf/text/StringConcatenate.h>");
     push(@sourceContent, "");
     push(@sourceContent, "#if ENABLE(INSPECTOR)");
     push(@sourceContent, "");
index 3bd979c..1652714 100644 (file)
@@ -92,7 +92,7 @@
 #include "TextEncoding.h"
 #include "TextIterator.h"
 #include "WindowFeatures.h"
-#include <wtf/text/CString.h>
+#include <wtf/text/StringConcatenate.h>
 #include <wtf/CurrentTime.h>
 #include <wtf/ListHashSet.h>
 #include <wtf/RefCounted.h>
@@ -1067,9 +1067,7 @@ void InspectorController::didReceiveResponse(unsigned long identifier, const Res
             resource->updateScriptObject(m_frontend.get());
     }
     if (response.httpStatusCode() >= 400) {
-        // The ugly code below is due to that String::format() is not utf8-safe at the moment.
-        String message = String::format("Failed to load resource: the server responded with a status of %u (", response.httpStatusCode()) + response.httpStatusText() + ")";
-
+        String message = makeString("Failed to load resource: the server responded with a status of ", String::number(response.httpStatusCode()), " (", response.httpStatusText(), ')');
         addMessageToConsole(OtherMessageSource, LogMessageType, ErrorMessageLevel, message, 0, response.url().string());
     }
 }
@@ -2032,7 +2030,7 @@ void InspectorController::openInInspectedWindow(const String& url)
 
 void InspectorController::count(const String& title, unsigned lineNumber, const String& sourceID)
 {
-    String identifier = title + String::format("@%s:%d", sourceID.utf8().data(), lineNumber);
+    String identifier = makeString(title, '@', sourceID, ':', String::number(lineNumber));
     HashMap<String, unsigned>::iterator it = m_counts.find(identifier);
     int count;
     if (it == m_counts.end())
@@ -2044,7 +2042,7 @@ void InspectorController::count(const String& title, unsigned lineNumber, const
 
     m_counts.add(identifier, count);
 
-    String message = String::format("%s: %d", title.utf8().data(), count);
+    String message = makeString(title, ": ", String::number(count));
     addMessageToConsole(JSMessageSource, LogMessageType, LogMessageLevel, message, lineNumber, sourceID);
 }
 
index adaf52e..2739191 100644 (file)
@@ -77,6 +77,7 @@
 #include "markup.h"
 
 #include <wtf/text/CString.h>
+#include <wtf/text/StringConcatenate.h>
 #include <wtf/HashSet.h>
 #include <wtf/ListHashSet.h>
 #include <wtf/OwnPtr.h>
@@ -1190,7 +1191,7 @@ void InspectorDOMAgent::removeBreakpointsForNode(Node* node)
 
 String InspectorDOMAgent::createBreakpointId(long nodeId, long type)
 {
-    return String::format("dom:%ld:%ld", nodeId, type);
+    return makeString("dom:", String::number(nodeId), ':', String::number(type));
 }
 
 void InspectorDOMAgent::getStyles(long nodeId, bool authorOnly, RefPtr<InspectorValue>* styles)
index 986e9c0..a7eacf6 100644 (file)
 #include "PlatformString.h"
 #include "ScriptDebugServer.h"
 #include <wtf/MD5.h>
-#include <wtf/text/CString.h>
+#include <wtf/text/StringConcatenate.h>
 
 namespace WebCore {
 
 static String formatBreakpointId(const String& sourceID, unsigned lineNumber)
 {
-    return String::format("%s:%d", sourceID.utf8().data(), lineNumber);
+    return makeString(sourceID, ':', String::number(lineNumber));
 }
 
 PassOwnPtr<InspectorDebuggerAgent> InspectorDebuggerAgent::create(InspectorController* inspectorController, InspectorFrontend* frontend)
index 09b2b32..71c7231 100644 (file)
@@ -43,7 +43,7 @@
 #include "ScriptProfile.h"
 #include "ScriptProfiler.h"
 #include <wtf/OwnPtr.h>
-#include <wtf/text/CString.h>
+#include <wtf/text/StringConcatenate.h>
 
 #if USE(JSC)
 #include "JSDOMWindow.h"
@@ -89,13 +89,13 @@ void InspectorProfilerAgent::addProfileFinishedMessageToConsole(PassRefPtr<Scrip
 {
     RefPtr<ScriptProfile> profile = prpProfile;
     String title = profile->title();
-    String message = String::format("Profile \"webkit-profile://%s/%s#%d\" finished.", CPUProfileType, encodeWithURLEscapeSequences(title).utf8().data(), profile->uid());
+    String message = makeString("Profile \"webkit-profile://", CPUProfileType, '/', encodeWithURLEscapeSequences(title), '#', String::number(profile->uid()), "\" finished.");
     m_inspectorController->addMessageToConsole(JSMessageSource, LogMessageType, LogMessageLevel, message, lineNumber, sourceURL);
 }
 
 void InspectorProfilerAgent::addStartProfilingMessageToConsole(const String& title, unsigned lineNumber, const String& sourceURL)
 {
-    String message = String::format("Profile \"webkit-profile://%s/%s#0\" started.", CPUProfileType, encodeWithURLEscapeSequences(title).utf8().data());
+    String message = makeString("Profile \"webkit-profile://", CPUProfileType, '/', encodeWithURLEscapeSequences(title), "#0 \" started.");
     m_inspectorController->addMessageToConsole(JSMessageSource, LogMessageType, LogMessageLevel, message, lineNumber, sourceURL);
 }
 
@@ -143,7 +143,7 @@ String InspectorProfilerAgent::getCurrentUserInitiatedProfileName(bool increment
     if (incrementProfileNumber)
         m_currentUserInitiatedProfileNumber = m_nextUserInitiatedProfileNumber++;
 
-    return String::format("%s.%d", UserInitiatedProfileName, m_currentUserInitiatedProfileNumber);
+    return makeString(UserInitiatedProfileName, '.', String::number(m_currentUserInitiatedProfileNumber));
 }
 
 void InspectorProfilerAgent::getProfileHeaders(RefPtr<InspectorArray>* headers)
@@ -232,7 +232,9 @@ void InspectorProfilerAgent::stopUserInitiatedProfiling()
 
 void InspectorProfilerAgent::takeHeapSnapshot()
 {
-    String title = String::format("%s.%d", UserInitiatedProfileName, m_nextUserInitiatedHeapSnapshotNumber++);
+    String title = makeString(UserInitiatedProfileName, '.', String::number(m_nextUserInitiatedHeapSnapshotNumber));
+    ++m_nextUserInitiatedHeapSnapshotNumber;
+
     RefPtr<ScriptHeapSnapshot> snapshot = ScriptProfiler::takeHeapSnapshot(title);
     if (snapshot) {
         m_snapshots.add(snapshot->uid(), snapshot);
index 1f84a49..ce9dc2b 100644 (file)
@@ -44,7 +44,7 @@
 #include "PingLoader.h"
 #include "SecurityOrigin.h"
 #include "Settings.h"
-#include <wtf/text/CString.h>
+#include <wtf/text/StringConcatenate.h>
 
 #define PRELOAD_DEBUG 0
 
@@ -289,12 +289,8 @@ void CachedResourceLoader::printAccessDeniedMessage(const KURL& url) const
         return;
 
     String message = m_doc->url().isNull() ?
-        String::format("Unsafe attempt to load URL %s.",
-                       url.string().utf8().data()) :
-        String::format("Unsafe attempt to load URL %s from frame with URL %s. "
-                       "Domains, protocols and ports must match.\n",
-                       url.string().utf8().data(),
-                       m_doc->url().string().utf8().data());
+        makeString("Unsafe attempt to load URL ", url.string(), '.') :
+        makeString("Unsafe attempt to load URL ", url.string(), " from frame with URL ", m_doc->url().string(), ". Domains, protocols and ports must match.\n");
 
     // FIXME: provide a real line number and source URL.
     frame()->domWindow()->console()->addMessage(OtherMessageSource, LogMessageType, ErrorMessageLevel, message, 1, String());
index 7b925cb..8d1954c 100644 (file)
 #include <wtf/CurrentTime.h>
 #include <wtf/StdLibExtras.h>
 #include <wtf/text/CString.h>
+#include <wtf/text/StringConcatenate.h>
 
 #if ENABLE(SHARED_WORKERS)
 #include "SharedWorkerRepository.h"
@@ -1016,8 +1017,7 @@ void FrameLoader::checkIfDisplayInsecureContent(SecurityOrigin* context, const K
     if (!isMixedContent(context, url))
         return;
 
-    String message = String::format("The page at %s displayed insecure content from %s.\n",
-        m_URL.string().utf8().data(), url.string().utf8().data());
+    String message = makeString("The page at ", m_URL.string(), " displayed insecure content from ", url.string(), ".\n");
     m_frame->domWindow()->console()->addMessage(HTMLMessageSource, LogMessageType, WarningMessageLevel, message, 1, String());
 
     m_client->didDisplayInsecureContent();
@@ -1028,8 +1028,7 @@ void FrameLoader::checkIfRunInsecureContent(SecurityOrigin* context, const KURL&
     if (!isMixedContent(context, url))
         return;
 
-    String message = String::format("The page at %s ran insecure content from %s.\n",
-        m_URL.string().utf8().data(), url.string().utf8().data());
+    String message = makeString("The page at ", m_URL.string(), " ran insecure content from ", url.string(), ".\n");
     m_frame->domWindow()->console()->addMessage(HTMLMessageSource, LogMessageType, WarningMessageLevel, message, 1, String());
 
     m_client->didRunInsecureContent(context);
@@ -1666,8 +1665,8 @@ bool FrameLoader::shouldAllowNavigation(Frame* targetFrame) const
     if (settings && !settings->privateBrowsingEnabled()) {
         Document* targetDocument = targetFrame->document();
         // FIXME: this error message should contain more specifics of why the navigation change is not allowed.
-        String message = String::format("Unsafe JavaScript attempt to initiate a navigation change for frame with URL %s from frame with URL %s.\n",
-            targetDocument->url().string().utf8().data(), activeDocument->url().string().utf8().data());
+        String message = makeString("Unsafe JavaScript attempt to initiate a navigation change for frame with URL ",
+                                    targetDocument->url().string(), " from frame with URL ", activeDocument->url().string(), ".\n");
 
         // FIXME: should we print to the console of the activeFrame as well?
         targetFrame->domWindow()->console()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, message, 1, String());
index ea0ce74..061f4d9 100644 (file)
@@ -47,6 +47,7 @@
 #include "SelectionController.h"
 #include "SharedBuffer.h"
 #include <wtf/text/CString.h>
+#include <wtf/text/StringConcatenate.h>
 #include <wtf/ListHashSet.h>
 #include <wtf/RetainPtr.h>
 
@@ -573,8 +574,8 @@ PassRefPtr<LegacyWebArchive> LegacyWebArchive::createFromSelection(Frame* frame)
         
     // Wrap the frameset document in an iframe so it can be pasted into
     // another document (which will have a body or frameset of its own). 
-    String iframeMarkup = String::format("<iframe frameborder=\"no\" marginwidth=\"0\" marginheight=\"0\" width=\"98%%\" height=\"98%%\" src=\"%s\"></iframe>", 
-                                         frame->loader()->documentLoader()->response().url().string().utf8().data());
+    String iframeMarkup = makeString("<iframe frameborder=\"no\" marginwidth=\"0\" marginheight=\"0\" width=\"98%%\" height=\"98%%\" src=\"",
+                                     frame->loader()->documentLoader()->response().url().string(), "\"></iframe>");
     RefPtr<ArchiveResource> iframeResource = ArchiveResource::create(utf8Buffer(iframeMarkup), blankURL(), "text/html", "UTF-8", String());
 
     Vector<PassRefPtr<ArchiveResource> > subresources;
index d9c4ac9..9d6c610 100644 (file)
@@ -86,7 +86,7 @@
 #include <algorithm>
 #include <wtf/CurrentTime.h>
 #include <wtf/MathExtras.h>
-#include <wtf/text/CString.h>
+#include <wtf/text/StringConcatenate.h>
 
 #if ENABLE(FILE_SYSTEM)
 #include "AsyncFileSystem.h"
@@ -798,8 +798,8 @@ void DOMWindow::postMessageTimerFired(PostMessageTimer* t)
     if (timer->targetOrigin()) {
         // Check target origin now since the target document may have changed since the simer was scheduled.
         if (!timer->targetOrigin()->isSameSchemeHostPort(document()->securityOrigin())) {
-            String message = String::format("Unable to post message to %s. Recipient has origin %s.\n", 
-                timer->targetOrigin()->toString().utf8().data(), document()->securityOrigin()->toString().utf8().data());
+            String message = makeString("Unable to post message to ", timer->targetOrigin()->toString(),
+                                        ". Recipient has origin ", document()->securityOrigin()->toString(), ".\n");
             console()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, message, 0, String());
             return;
         }
index 8cc7dd6..d99c8fe 100644 (file)
@@ -26,7 +26,7 @@
 #include "FrameView.h"
 #include "RenderLayer.h"
 #include "RenderView.h"
-#include <wtf/text/CString.h>
+#include <wtf/text/StringConcatenate.h>
 
 using namespace WebCore;
 
@@ -210,18 +210,18 @@ String PrintContext::pageProperty(Frame* frame, const char* propertyName, int pa
     if (!strcmp(propertyName, "margin-left")) {
         if (style->marginLeft().isAuto())
             return String("auto");
-        return String::format("%d", style->marginLeft().rawValue());
+        return String::number(style->marginLeft().rawValue());
     }
     if (!strcmp(propertyName, "line-height"))
-        return String::format("%d", style->lineHeight().rawValue());
+        return String::number(style->lineHeight().rawValue());
     if (!strcmp(propertyName, "font-size"))
-        return String::format("%d", style->fontDescription().computedPixelSize());
+        return String::number(style->fontDescription().computedPixelSize());
     if (!strcmp(propertyName, "font-family"))
-        return String::format("%s", style->fontDescription().family().family().string().utf8().data());
+        return style->fontDescription().family().family().string();
     if (!strcmp(propertyName, "size"))
-        return String::format("%d %d", style->pageSize().width().rawValue(), style->pageSize().height().rawValue());
+        return makeString(String::number(style->pageSize().width().rawValue()), ' ', String::number(style->pageSize().height().rawValue()));
 
-    return String::format("pageProperty() unimplemented for: %s", propertyName);
+    return makeString("pageProperty() unimplemented for: ", propertyName);
 }
 
 bool PrintContext::isPageBoxVisible(Frame* frame, int pageNumber)
@@ -233,7 +233,10 @@ String PrintContext::pageSizeAndMarginsInPixels(Frame* frame, int pageNumber, in
 {
     IntSize pageSize(width, height);
     frame->document()->pageSizeAndMarginsInPixels(pageNumber, pageSize, marginTop, marginRight, marginBottom, marginLeft);
-    return String::format("(%d, %d) %d %d %d %d", pageSize.width(), pageSize.height(), marginTop, marginRight, marginBottom, marginLeft);
+
+    // We don't have a makeString() function that takes up to 12 arguments, if this is a hot function, we can provide one.
+    return makeString('(', String::number(pageSize.width()), ", ", String::number(pageSize.height()), ") ") +
+           makeString(String::number(marginTop), ' ', String::number(marginRight), ' ', String::number(marginBottom), ' ', String::number(marginLeft));
 }
 
 int PrintContext::numberOfPages(Frame* frame, const FloatSize& pageSizeInPixels)
index f0e74ea..1940d52 100644 (file)
@@ -41,8 +41,7 @@
 #include "Settings.h"
 #include "TextResourceDecoder.h"
 #include <wtf/text/CString.h>
-
-using namespace WTF;
+#include <wtf/text/StringConcatenate.h>
 
 namespace WebCore {
 
@@ -203,7 +202,7 @@ bool XSSAuditor::canLoadObject(const String& url) const
     task.allowRequestIfNoIllegalURICharacters = true;
 
     if (findInRequest(task)) {
-        String consoleMessage = String::format("Refused to load an object. URL found within request: \"%s\".\n", url.utf8().data());
+        String consoleMessage = makeString("Refused to load an object. URL found within request: \"", url, "\".\n");
         m_frame->domWindow()->console()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, consoleMessage, 1, String());
         return false;
     }
index fd84b15..0645cd5 100644 (file)
@@ -39,7 +39,7 @@
 #include <Evas.h>
 #include <stdio.h>
 #include <wtf/HashMap.h>
-#include <wtf/text/CString.h>
+#include <wtf/text/StringConcatenate.h>
 #include <wtf/text/StringHash.h>
 
 namespace WebCore {
@@ -53,7 +53,7 @@ static WindowsKeyMap gWindowsKeyMap;
 static void createKeyMap()
 {
     for (unsigned int i = 1; i < 25; i++) {
-        String key = String::format("F%d", i);
+        String key = makeString('F', String::number(i));
         gKeyMap.set(key, key);
     }
     gKeyMap.set("Alt_L", "Alt");
@@ -133,13 +133,13 @@ static void createWindowsKeyMap()
     // Alphabet
     String alphabet = "abcdefghijklmnopqrstuvwxyz";
     for (unsigned int i = 0; i < 26; i++) {
-        String key = String::format("%c", alphabet[i]);
+        String key = alphabet[i];
         gWindowsKeyMap.set(key, VK_A + i);
     }
 
     // Digits
     for (unsigned int i = 0; i < 10; i++) {
-        String key = String::format("%d", i);
+        String key = String::number(i);
         gWindowsKeyMap.set(key, VK_0 + i);
     }
 
@@ -161,7 +161,7 @@ static void createWindowsKeyMap()
 
     // F_XX
     for (unsigned int i = 1; i < 25; i++) {
-        String key = String::format("F%d", i);
+        String key = makeString('F', String::number(i));
         gWindowsKeyMap.set(key, VK_F1 + i);
     }
 }
index 412f06d..08b79ab 100644 (file)
@@ -33,6 +33,7 @@
 #include "RotateTransformOperation.h"
 #include "TextStream.h"
 #include <wtf/text/CString.h>
+#include <wtf/text/StringConcatenate.h>
 
 #ifndef NDEBUG
 #include <stdio.h>
@@ -249,7 +250,7 @@ void GraphicsLayer::paintGraphicsLayerContents(GraphicsContext& context, const I
 String GraphicsLayer::animationNameForTransition(AnimatedPropertyID property)
 {
     // | is not a valid identifier character in CSS, so this can never conflict with a keyframe identifier.
-    return String::format("-|transition%c-", property);
+    return makeString("-|transition", static_cast<char>(property), '-');
 }
 
 void GraphicsLayer::suspendAnimations(double)
index f5c855d..b574b0a 100644 (file)
 #include "SharedBuffer.h"
 
 #include <wtf/text/CString.h>
-#include <wtf/text/WTFString.h>
+#include <wtf/text/StringConcatenate.h>
 
 namespace WebCore {
 
 PassRefPtr<Image> Image::loadPlatformResource(const char *name)
 {
-    String resourcePath = homeDirectoryPath() + String::format("res/%s.png", name);
+    String resourcePath = makeString(homeDirectoryPath(), "res/", name, ".png");
 
     RefPtr<SharedBuffer> buffer = SharedBuffer::createWithContentsOfFile(resourcePath.utf8().data());
     if (!buffer)
index ecbcf60..ab66cbb 100644 (file)
 #include "GraphicsContext.h"
 #include "ImageData.h"
 #include "MIMETypeRegistry.h"
-#include "PlatformString.h"
 #include <ApplicationServices/ApplicationServices.h>
 #include <wtf/Assertions.h>
-#include <wtf/text/CString.h>
+#include <wtf/text/StringConcatenate.h>
 #include <wtf/OwnArrayPtr.h>
 #include <wtf/RetainPtr.h>
 #include <wtf/Threading.h>
@@ -371,7 +370,7 @@ String ImageBuffer::toDataURL(const String& mimeType, const double* quality) con
     base64Encode(reinterpret_cast<const char*>(CFDataGetBytePtr(data.get())), CFDataGetLength(data.get()), out);
     out.append('\0');
 
-    return String::format("data:%s;base64,%s", mimeType.utf8().data(), out.data());
+    return makeString("data:", mimeType, ";base64,", out.data());
 }
 
 } // namespace WebCore
index 112770f..a86ba4e 100644 (file)
@@ -32,6 +32,7 @@
 #include "BitmapImage.h"
 #include "SharedBuffer.h"
 
+#include <wtf/text/StringConcatenate.h>
 #include <cairo.h>
 
 namespace WebCore {
@@ -51,7 +52,7 @@ static PassRefPtr<SharedBuffer> loadResourceSharedBufferFallback()
 
 static PassRefPtr<SharedBuffer> loadResourceSharedBuffer(const char* name)
 {
-    RefPtr<SharedBuffer> buffer = SharedBuffer::createWithContentsOfFile(String::format(DATA_DIR "/webkit-1.0/images/%s.png", name));
+    RefPtr<SharedBuffer> buffer = SharedBuffer::createWithContentsOfFile(makeString(DATA_DIR "/webkit-1.0/images/", name, ".png"));    
     if (buffer)
         return buffer.release();
     return loadResourceSharedBufferFallback();
index edb26f0..486a317 100644 (file)
@@ -28,6 +28,7 @@
 #include <cairo.h>
 #include <gtk/gtk.h>
 #include <wtf/text/CString.h>
+#include <wtf/text/StringConcatenate.h>
 
 namespace WebCore {
 
@@ -67,7 +68,7 @@ String ImageBuffer::toDataURL(const String& mimeType, const double* quality) con
     base64Encode(reinterpret_cast<const char*>(buffer.get()), bufferSize, out);
     out.append('\0');
 
-    return String::format("data:%s;base64,%s", mimeType.utf8().data(), out.data());
+    return makeString("data:", mimeType, ";base64,", out.data());
 }
 
 }
index c5de485..d1b06f3 100644 (file)
@@ -33,6 +33,7 @@
 #include "MIMETypeRegistry.h"
 #include "StillImageHaiku.h"
 #include <wtf/text/CString.h>
+#include <wtf/text/StringConcatenate.h>
 #include <BitmapStream.h>
 #include <String.h>
 #include <TranslatorRoster.h>
@@ -367,8 +368,7 @@ String ImageBuffer::toDataURL(const String& mimeType, const double*) const
     base64Encode(reinterpret_cast<const char*>(translatedStream.Buffer()),
                  translatedStream.BufferLength(), encodedBuffer);
 
-    return String::format("data:%s;base64,%s", mimeType.utf8().data(),
-                          encodedBuffer.data());
+    return makeString("data:", mimeType, ";base64,", encodedBuffer.data());
 }
 
 } // namespace WebCore
index 4e77e13..fea2968 100644 (file)
@@ -47,6 +47,7 @@
 #import <wtf/CurrentTime.h>
 #import <wtf/UnusedParam.h>
 #import <wtf/RetainPtr.h>
+#import <wtf/text/StringConcatenate.h>
 
 using namespace std;
 
@@ -247,7 +248,7 @@ static String propertyIdToString(AnimatedPropertyID property)
 
 static String animationIdentifier(const String& animationName, AnimatedPropertyID property, int index)
 {
-    return animationName + String::format("_%d_%d", property, index);
+    return makeString(animationName, '_', String::number(property), '_', String::number(index));
 }
 
 static CAMediaTimingFunction* getCAMediaTimingFunction(const TimingFunction* timingFunction)
index 5c190b3..35b35b0 100644 (file)
@@ -35,6 +35,7 @@
 #include "StillImageQt.h"
 #include "TransparencyLayer.h"
 #include <wtf/text/CString.h>
+#include <wtf/text/StringConcatenate.h>
 
 #include <QBuffer>
 #include <QColor>
@@ -401,7 +402,8 @@ String ImageBuffer::toDataURL(const String& mimeType, const double* quality) con
     }
 
     buffer.close();
-    return String::format("data:%s;base64,%s", mimeType.utf8().data(), data.toBase64().data());
+
+    return makeString("data:", mimeType, ";base64,", data.toBase64().data());
 }
 
 }
index e816f85..be60340 100644 (file)
@@ -45,6 +45,8 @@
 #include "SkColorPriv.h"
 #include "SkiaUtils.h"
 
+#include <wtf/text/StringConcatenate.h>
+
 using namespace std;
 
 namespace WebCore {
@@ -312,7 +314,7 @@ String ImageBuffer::toDataURL(const String&, const double*) const
     base64EncodedData.append('\0');
 
     // And the resulting string.
-    return String::format("data:image/png;base64,%s", base64EncodedData.data());
+    return makeString("data:image/png;base64,", base64EncodedData.data());
 }
 
 } // namespace WebCore
index 70a522d..807a607 100644 (file)
@@ -94,7 +94,7 @@ void WebLayer::drawInContext(PlatformGraphicsContext* context)
 #endif
 
     if (m_owner->showRepaintCounter()) {
-        String text = String::format("%d", m_owner->incrementRepaintCount());;
+        String text = String::number(m_owner->incrementRepaintCount());
 
         CGContextSaveGState(context);
 
index 38f71a4..428181d 100644 (file)
@@ -29,7 +29,7 @@
 #include "Credential.h"
 #include "KURL.h"
 #include "ProtectionSpaceHash.h"
-#include <wtf/text/CString.h>
+#include <wtf/text/StringConcatenate.h>
 #include <wtf/text/StringHash.h>
 #include <wtf/HashMap.h>
 #include <wtf/HashSet.h>
@@ -60,9 +60,9 @@ static PathToDefaultProtectionSpaceMap& pathToDefaultProtectionSpaceMap()
 static String originStringFromURL(const KURL& url)
 {
     if (url.port())
-        return url.protocol() + "://" + url.host() + String::format(":%i/", url.port());
-    
-    return url.protocol() + "://" + url.host() + "/";
+        return makeString(url.protocol(), "://", url.host(), ':', String::number(url.port()), '/');
+
+    return makeString(url.protocol(), "://", url.host(), '/');
 }
 
 static String protectionSpaceMapKeyFromURL(const KURL& url)
index 80d3946..7096dfc 100644 (file)
@@ -34,6 +34,7 @@
 #include <sqlite3.h>
 #include <wtf/Threading.h>
 #include <wtf/text/CString.h>
+#include <wtf/text/StringConcatenate.h>
 
 namespace WebCore {
 
@@ -217,7 +218,7 @@ int64_t SQLiteDatabase::totalSize()
 
 void SQLiteDatabase::setSynchronous(SynchronousPragma sync)
 {
-    executeCommand(String::format("PRAGMA synchronous = %i", sync));
+    executeCommand(makeString("PRAGMA synchronous = ", String::number(sync)));
 }
 
 void SQLiteDatabase::setBusyTimeout(int ms)
index 499035f..82454f5 100644 (file)
@@ -32,7 +32,7 @@
 #include <winnls.h>
 #include <wtf/HashMap.h>
 #include <wtf/HashSet.h>
-#include <wtf/text/CString.h>
+#include <wtf/text/StringConcatenate.h>
 #include <wtf/text/StringHash.h>
 #include <wtf/unicode/UTF8.h>
 
@@ -110,7 +110,7 @@ LanguageManager::LanguageManager()
                 info.m_aliases.append(name);
                 info.m_aliases.append(String(cpInfo.wszHeaderCharset).latin1());
                 info.m_aliases.append(String(cpInfo.wszBodyCharset).latin1());
-                String cpName = String::format("cp%d", cpInfo.uiCodePage);
+                String cpName = makeString("cp", String::number(cpInfo.uiCodePage));
                 info.m_aliases.append(cpName.latin1());
                 supportedCharsets().add(i->second.data());
             }
index 0130a70..815a0aa 100644 (file)
@@ -34,6 +34,7 @@
 #include <shlwapi.h>
 #include <wininet.h> // for INTERNET_MAX_URL_LENGTH
 #include <wtf/text/CString.h>
+#include <wtf/text/StringConcatenate.h>
 
 #if PLATFORM(CF)
 #include <CoreFoundation/CoreFoundation.h>
@@ -239,7 +240,7 @@ void markupToCFHTML(const String& markup, const String& srcURL, Vector<char>& re
     unsigned endFragmentOffset = startFragmentOffset + markupUTF8.length();
     unsigned endHTMLOffset = endFragmentOffset + strlen(endMarkup);
 
-    append(result, String::format(header, startHTMLOffset, endHTMLOffset, startFragmentOffset, endFragmentOffset).utf8());
+    append(result, makeString(header, startHTMLOffset, endHTMLOffset, startFragmentOffset, endFragmentOffset).utf8());
     if (sourceURLUTF8.length()) {
         append(result, sourceURLPrefix);
         append(result, sourceURLUTF8);
index 676510b..1915549 100644 (file)
@@ -26,8 +26,7 @@
 #include "config.h"
 #include "Language.h"
 
-#include "PlatformString.h"
-#include <wtf/text/CString.h>
+#include <wtf/text/StringConcatenate.h>
 
 namespace WebCore {
 
@@ -60,7 +59,7 @@ String defaultLanguage()
     if (countryName.isEmpty())
         computedDefaultLanguage = languageName;
     else
-        computedDefaultLanguage = String::format("%s-%s", languageName.latin1().data(), countryName.latin1().data());
+        computedDefaultLanguage = makeString(languageName, '-', countryName);
 
     return computedDefaultLanguage;
 }
index 7b985a1..3e04c79 100644 (file)
@@ -35,6 +35,7 @@
 #include "SubresourceLoader.h"
 #include <StringExtras.h>
 #include <wtf/text/CString.h>
+#include <wtf/text/StringConcatenate.h>
 
 // We use -2 here because some plugins like to return -1 to indicate error
 // and this way we won't clash with them.
@@ -145,8 +146,7 @@ void PluginStream::startStream()
         Vector<UChar> stringBuilder;
         String separator(": ");
 
-        String statusLine = String::format("HTTP %d OK\n", m_resourceResponse.httpStatusCode());
-
+        String statusLine = makeString("HTTP ", String::number(m_resourceResponse.httpStatusCode()), " OK\n");
         stringBuilder.append(statusLine.characters(), statusLine.length());
 
         HTTPHeaderMap::const_iterator end = m_resourceResponse.httpHeaderFields().end();
index 12786ee..d4452ec 100644 (file)
@@ -47,6 +47,8 @@
 #include "XMLDocumentParser.h"
 #include "XMLSerializer.h"
 
+#include <wtf/text/StringConcatenate.h>
+
 // Dump SVGElementInstance object tree - useful to debug instanceRoot problems
 // #define DUMP_INSTANCE_TREE
 
@@ -370,7 +372,7 @@ void dumpInstanceTree(unsigned int& depth, String& text, SVGElementInstance* tar
         text += "  ";
 
     const HashSet<SVGElementInstance*>& elementInstances = element->instancesForElement();
-    text += String::format("Corresponding element is associated with %i instance(s):\n", elementInstances.size());
+    text += makeString("Corresponding element is associated with ", String::number(elementInstances.size()), " instance(s):\n");
 
     const HashSet<SVGElementInstance*>::const_iterator end = elementInstances.end();
     for (HashSet<SVGElementInstance*>::const_iterator it = elementInstances.begin(); it != end; ++it) {
index eb4b567..358a742 100644 (file)
@@ -47,6 +47,7 @@
 #include <wtf/StdLibExtras.h>
 #include <wtf/text/CString.h>
 #include <wtf/text/StringBuilder.h>
+#include <wtf/text/StringConcatenate.h>
 
 namespace WebCore {
 
@@ -140,7 +141,7 @@ void WebSocket::connect(const KURL& url, const String& protocol, ExceptionCode&
         return;
     }
     if (!portAllowed(url)) {
-        scriptExecutionContext()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, String::format("WebSocket port %d blocked", url.port()), 0, scriptExecutionContext()->securityOrigin()->toString());
+        scriptExecutionContext()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, makeString("WebSocket port ", String::number(url.port()), " blocked"), 0, scriptExecutionContext()->securityOrigin()->toString());
         m_state = CLOSED;
         ec = SECURITY_ERR;
         return;
index 7528e05..45bb206 100644 (file)
@@ -48,6 +48,7 @@
 #include "WebSocketHandshake.h"
 
 #include <wtf/text/CString.h>
+#include <wtf/text/StringConcatenate.h>
 #include <wtf/text/StringHash.h>
 #include <wtf/Deque.h>
 #include <wtf/FastMalloc.h>
@@ -246,7 +247,7 @@ bool WebSocketChannel::appendToBuffer(const char* data, size_t len)
         m_bufferSize = newBufferSize;
         return true;
     }
-    m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, String::format("WebSocket frame (at %lu bytes) is too long.", static_cast<unsigned long>(newBufferSize)), 0, m_handshake.clientOrigin());
+    m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, makeString("WebSocket frame (at ", String::number(static_cast<unsigned long>(newBufferSize)), " bytes) is too long."), 0, m_handshake.clientOrigin());
     return false;
 }
 
index 45e47a8..5049098 100644 (file)
@@ -52,6 +52,7 @@
 #include <wtf/text/AtomicString.h>
 #include <wtf/text/CString.h>
 #include <wtf/text/StringBuilder.h>
+#include <wtf/text/StringConcatenate.h>
 
 namespace WebCore {
 
@@ -318,7 +319,7 @@ int WebSocketHandshake::readServerHandshake(const char* header, size_t len)
     m_response.setStatusText(statusText);
     if (statusCode != 101) {
         m_mode = Failed;
-        m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, String::format("Unexpected response code: %d", statusCode), 0, clientOrigin());
+        m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, makeString("Unexpected response code: ", String::number(statusCode)), 0, clientOrigin());
         return len;
     }
     m_mode = Normal;