Title: [132736] trunk/Source/WTF
- Revision
- 132736
- Author
- [email protected]
- Date
- 2012-10-27 11:25:56 -0700 (Sat, 27 Oct 2012)
Log Message
String::fromUTF8() should take advantage of the ASCII check in convertUTF8ToUTF16()
https://bugs.webkit.org/show_bug.cgi?id=100577
Reviewed by Oliver Hunt.
Passed is ASCII flag to convertUTF8ToUTF16() and if try, create an 8 bit string from the original arguments.
* wtf/text/WTFString.cpp:
(WTF::String::fromUTF8):
Modified Paths
Diff
Modified: trunk/Source/WTF/ChangeLog (132735 => 132736)
--- trunk/Source/WTF/ChangeLog 2012-10-27 18:18:34 UTC (rev 132735)
+++ trunk/Source/WTF/ChangeLog 2012-10-27 18:25:56 UTC (rev 132736)
@@ -1,3 +1,15 @@
+2012-10-27 Michael Saboff <[email protected]>
+
+ String::fromUTF8() should take advantage of the ASCII check in convertUTF8ToUTF16()
+ https://bugs.webkit.org/show_bug.cgi?id=100577
+
+ Reviewed by Oliver Hunt.
+
+ Passed is ASCII flag to convertUTF8ToUTF16() and if try, create an 8 bit string from the original arguments.
+
+ * wtf/text/WTFString.cpp:
+ (WTF::String::fromUTF8):
+
2012-10-27 Dan Bernstein <[email protected]>
REAL_PLATFORM_NAME build setting is no longer needed
Modified: trunk/Source/WTF/wtf/text/WTFString.cpp (132735 => 132736)
--- trunk/Source/WTF/wtf/text/WTFString.cpp 2012-10-27 18:18:34 UTC (rev 132735)
+++ trunk/Source/WTF/wtf/text/WTFString.cpp 2012-10-27 18:25:56 UTC (rev 132736)
@@ -862,9 +862,13 @@
// Try converting into the buffer.
const char* stringCurrent = reinterpret_cast<const char*>(stringStart);
- if (convertUTF8ToUTF16(&stringCurrent, reinterpret_cast<const char *>(stringStart + length), &buffer, bufferEnd) != conversionOK)
+ bool isAllASCII;
+ if (convertUTF8ToUTF16(&stringCurrent, reinterpret_cast<const char *>(stringStart + length), &buffer, bufferEnd, &isAllASCII) != conversionOK)
return String();
+ if (isAllASCII)
+ return String(stringStart, length);
+
// stringBuffer is full (the input must have been all ascii) so just return it!
if (buffer == bufferEnd)
return stringBuffer;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes