Title: [131652] trunk/Source/WTF
- Revision
- 131652
- Author
- [email protected]
- Date
- 2012-10-17 15:08:20 -0700 (Wed, 17 Oct 2012)
Log Message
AtomicString::HashAndUTF8CharactersTranslator::equal() doesn't optimally handle 8 bit strings
https://bugs.webkit.org/show_bug.cgi?id=99223
Reviewed by Geoffrey Garen.
Added an 8 bit path.
* wtf/text/AtomicString.cpp:
(WTF::HashAndUTF8CharactersTranslator::equal):
Modified Paths
Diff
Modified: trunk/Source/WTF/ChangeLog (131651 => 131652)
--- trunk/Source/WTF/ChangeLog 2012-10-17 22:06:52 UTC (rev 131651)
+++ trunk/Source/WTF/ChangeLog 2012-10-17 22:08:20 UTC (rev 131652)
@@ -1,3 +1,15 @@
+2012-10-17 Michael Saboff <[email protected]>
+
+ AtomicString::HashAndUTF8CharactersTranslator::equal() doesn't optimally handle 8 bit strings
+ https://bugs.webkit.org/show_bug.cgi?id=99223
+
+ Reviewed by Geoffrey Garen.
+
+ Added an 8 bit path.
+
+ * wtf/text/AtomicString.cpp:
+ (WTF::HashAndUTF8CharactersTranslator::equal):
+
2012-10-17 Anders Carlsson <[email protected]>
Always use fastRealloc when growing or shrinking the Vector buffer
Modified: trunk/Source/WTF/wtf/text/AtomicString.cpp (131651 => 131652)
--- trunk/Source/WTF/wtf/text/AtomicString.cpp 2012-10-17 22:06:52 UTC (rev 131651)
+++ trunk/Source/WTF/wtf/text/AtomicString.cpp 2012-10-17 22:08:20 UTC (rev 131652)
@@ -187,12 +187,27 @@
if (buffer.utf16Length != string->length())
return false;
- const UChar* stringCharacters = string->characters();
+ // If buffer contains only ASCII characters UTF-8 and UTF16 length are the same.
+ if (buffer.utf16Length != buffer.length) {
+ const UChar* stringCharacters = string->characters();
- // If buffer contains only ASCII characters UTF-8 and UTF16 length are the same.
- if (buffer.utf16Length != buffer.length)
return equalUTF16WithUTF8(stringCharacters, stringCharacters + string->length(), buffer.characters, buffer.characters + buffer.length);
+ }
+ if (string->is8Bit()) {
+ const LChar* stringCharacters = string->characters8();
+
+ for (unsigned i = 0; i < buffer.length; ++i) {
+ ASSERT(isASCII(buffer.characters[i]));
+ if (stringCharacters[i] != buffer.characters[i])
+ return false;
+ }
+
+ return true;
+ }
+
+ const UChar* stringCharacters = string->characters16();
+
for (unsigned i = 0; i < buffer.length; ++i) {
ASSERT(isASCII(buffer.characters[i]));
if (stringCharacters[i] != buffer.characters[i])
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes