Title: [150985] trunk/Source/WebCore
Revision
150985
Author
[email protected]
Date
2013-05-30 14:15:46 -0700 (Thu, 30 May 2013)

Log Message

Remove some 16bits conversion.
https://bugs.webkit.org/show_bug.cgi?id=116935

Patch by Benjamin Poulain <[email protected]> on 2013-05-30
Reviewed by Darin Adler.

Merge chromium ce35a544d09e6cb907457535340eb0e9984e57b8.
https://chromium.googlesource.com/chromium/blink/+/ce35a544d09e6cb907457535340eb0e9984e57b8

* html/parser/InputStreamPreprocessor.h:
* platform/FileSystem.cpp:
(WebCore::encodeForFileName):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (150984 => 150985)


--- trunk/Source/WebCore/ChangeLog	2013-05-30 21:11:50 UTC (rev 150984)
+++ trunk/Source/WebCore/ChangeLog	2013-05-30 21:15:46 UTC (rev 150985)
@@ -1,3 +1,17 @@
+2013-05-30  Benjamin Poulain  <[email protected]>
+
+        Remove some 16bits conversion.
+        https://bugs.webkit.org/show_bug.cgi?id=116935
+
+        Reviewed by Darin Adler.
+
+        Merge chromium ce35a544d09e6cb907457535340eb0e9984e57b8.
+        https://chromium.googlesource.com/chromium/blink/+/ce35a544d09e6cb907457535340eb0e9984e57b8
+
+        * html/parser/InputStreamPreprocessor.h:
+        * platform/FileSystem.cpp:
+        (WebCore::encodeForFileName):
+
 2013-05-30  Anders Carlsson  <[email protected]>
 
         REGRESSION (r119759): Adobe Flash Player "smaller" installer relies on the incorrect firing of a load event and needs an app-specific hack for compatibility

Modified: trunk/Source/WebCore/html/parser/InputStreamPreprocessor.h (150984 => 150985)


--- trunk/Source/WebCore/html/parser/InputStreamPreprocessor.h	2013-05-30 21:11:50 UTC (rev 150984)
+++ trunk/Source/WebCore/html/parser/InputStreamPreprocessor.h	2013-05-30 21:15:46 UTC (rev 150985)
@@ -33,7 +33,7 @@
 
 namespace WebCore {
 
-const UChar kEndOfFileMarker = 0;
+const LChar kEndOfFileMarker = 0;
 
 // http://www.whatwg.org/specs/web-apps/current-work/#preprocessing-the-input-stream
 template <typename Tokenizer>

Modified: trunk/Source/WebCore/platform/FileSystem.cpp (150984 => 150985)


--- trunk/Source/WebCore/platform/FileSystem.cpp	2013-05-30 21:11:50 UTC (rev 150984)
+++ trunk/Source/WebCore/platform/FileSystem.cpp	2013-05-30 21:15:46 UTC (rev 150985)
@@ -27,6 +27,7 @@
 #include "FileSystem.h"
 
 #include <wtf/HexNumber.h>
+#include <wtf/text/StringBuilder.h>
 
 namespace WebCore {
 
@@ -77,27 +78,21 @@
     return c > 127 ? false : needsEscaping[c];
 }
 
-String encodeForFileName(const String& inputStr)
+String encodeForFileName(const String& inputString)
 {
-    unsigned length = inputStr.length();
-    Vector<UChar, 512> buffer(length * 3 + 1);
-    UChar* p = buffer.data();
-
-    const UChar* str = inputStr.characters();
-    const UChar* strEnd = str + length;
-
-    while (str < strEnd) {
-        UChar c = *str++;
-        if (shouldEscapeUChar(c)) {
-            *p++ = '%';
-            placeByteAsHex(c, p);
+    StringBuilder result;
+    StringImpl* stringImpl = inputString.impl();
+    unsigned length = inputString.length();
+    for (unsigned i = 0; i < length; ++i) {
+        UChar character = (*stringImpl)[i];
+        if (shouldEscapeUChar(character)) {
+            result.append('%');
+            appendByteAsHex(character, result);
         } else
-            *p++ = c;
+            result.append(character);
     }
 
-    ASSERT(p - buffer.data() <= static_cast<int>(buffer.size()));
-
-    return String(buffer.data(), p - buffer.data());
+    return result.toString();
 }
 
 #if !PLATFORM(MAC) || PLATFORM(IOS)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to