OSDN Git Service

use the same hash for 8 bit strings as in QByteArray
authorIvailo Monev <xakepa10@laimg.moc>
Mon, 22 Aug 2016 21:02:29 +0000 (21:02 +0000)
committerIvailo Monev <xakepa10@laimg.moc>
Mon, 22 Aug 2016 21:02:29 +0000 (21:02 +0000)
upstream actually uses QLatingString, but anyway

upstream commits:
https://github.com/qt/qtbase/commit/8fca1e70e7a8b1dc21a0134b6786e84faff91823

Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
src/tools/moc/symbols.h

index 48538c4..a4fe8f1 100644 (file)
@@ -72,18 +72,7 @@ struct SubArray
 
 inline uint qHash(const SubArray &key)
 {
-    const uchar *p = reinterpret_cast<const uchar *>(key.array.data() + key.from);
-    int n = key.len;
-    uint h = 0;
-    uint g;
-
-    while (n--) {
-        h = (h << 4) + *p++;
-        if ((g = (h & 0xf0000000)) != 0)
-            h ^= g >> 23;
-        h &= ~g;
-    }
-    return h;
+    return qHash(QString::fromLatin1(key.array.constData() + key.from, key.len));
 }