CaseFoldingHash::hash() doesn't handle 8 bit strings directly
authormsaboff@apple.com <msaboff@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 30 Jan 2012 19:09:23 +0000 (19:09 +0000)
committermsaboff@apple.com <msaboff@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 30 Jan 2012 19:09:23 +0000 (19:09 +0000)
https://bugs.webkit.org/show_bug.cgi?id=76652

Reviewed by Andreas Kling.

* wtf/text/StringHash.h:
(WTF::CaseFoldingHash::hash): Added 8 bit string code path.

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

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/wtf/text/StringHash.h

index a2493fe..bf710b8 100644 (file)
@@ -1,5 +1,15 @@
 2012-01-30  Michael Saboff  <msaboff@apple.com>
 
+        CaseFoldingHash::hash() doesn't handle 8 bit strings directly
+        https://bugs.webkit.org/show_bug.cgi?id=76652
+
+        Reviewed by Andreas Kling.
+
+        * wtf/text/StringHash.h:
+        (WTF::CaseFoldingHash::hash): Added 8 bit string code path.
+
+2012-01-30  Michael Saboff  <msaboff@apple.com>
+
         stringProtoFuncReplace converts 8 bit strings to 16 bit during replacement
         https://bugs.webkit.org/show_bug.cgi?id=76651
 
index cde591c..1b7a2ee 100644 (file)
@@ -100,7 +100,9 @@ namespace WTF {
 
         static unsigned hash(StringImpl* str)
         {
-            return hash(str->characters(), str->length());
+            if (str->is8Bit())
+                return hash(str->characters8(), str->length());
+            return hash(str->characters16(), str->length());
         }
 
         static unsigned hash(const LChar* data, unsigned length)