Title: [106020] trunk/Source/_javascript_Core
Revision
106020
Author
msab...@apple.com
Date
2012-01-26 11:26:15 -0800 (Thu, 26 Jan 2012)

Log Message

String::latin1() should take advantage of 8 bit strings
https://bugs.webkit.org/show_bug.cgi?id=76646

Reviewed by Geoffrey Garen.

* wtf/text/WTFString.cpp:
(WTF::String::latin1): For 8 bit strings, use existing buffer
without conversion.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (106019 => 106020)


--- trunk/Source/_javascript_Core/ChangeLog	2012-01-26 19:23:50 UTC (rev 106019)
+++ trunk/Source/_javascript_Core/ChangeLog	2012-01-26 19:26:15 UTC (rev 106020)
@@ -1,5 +1,16 @@
 2012-01-26  Michael Saboff  <msab...@apple.com>
 
+        String::latin1() should take advantage of 8 bit strings
+        https://bugs.webkit.org/show_bug.cgi?id=76646
+
+        Reviewed by Geoffrey Garen.
+
+        * wtf/text/WTFString.cpp:
+        (WTF::String::latin1): For 8 bit strings, use existing buffer
+        without conversion.
+
+2012-01-26  Michael Saboff  <msab...@apple.com>
+
         Dromaeo tests usage of StringImpl find routines cause 8->16 bit conversions
         https://bugs.webkit.org/show_bug.cgi?id=76645
 

Modified: trunk/Source/_javascript_Core/wtf/text/WTFString.cpp (106019 => 106020)


--- trunk/Source/_javascript_Core/wtf/text/WTFString.cpp	2012-01-26 19:23:50 UTC (rev 106019)
+++ trunk/Source/_javascript_Core/wtf/text/WTFString.cpp	2012-01-26 19:26:15 UTC (rev 106020)
@@ -687,6 +687,13 @@
     // preserved, characters outside of this range are converted to '?'.
 
     unsigned length = this->length();
+
+    if (!length)
+        return CString("", 0);
+
+    if (is8Bit())
+        return CString(reinterpret_cast<const char*>(this->characters8()), length);
+
     const UChar* characters = this->characters();
 
     char* characterBuffer;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to