summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qhash.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2014-05-22 07:44:45 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2014-05-22 07:46:17 +0200
commit508b95899d4764d879a01b3990e44ce849cd9abc (patch)
tree3dbb215480c98ee75b5aacc5e3d691e04d8ce8c8 /src/corelib/tools/qhash.cpp
parentf2891be00808c82f5069661d60d8727fe28774b7 (diff)
parent5d2939344eb8fbd3c2115f52a7a8d47365bdf820 (diff)
Merge remote-tracking branch 'origin/stable' into dev
Diffstat (limited to 'src/corelib/tools/qhash.cpp')
-rw-r--r--src/corelib/tools/qhash.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/corelib/tools/qhash.cpp b/src/corelib/tools/qhash.cpp
index 928707660b..e227a483c4 100644
--- a/src/corelib/tools/qhash.cpp
+++ b/src/corelib/tools/qhash.cpp
@@ -125,7 +125,7 @@ static uint crc32(const Char *ptr, size_t len, uint h)
# else
p += 4;
for ( ; p <= e; p += 4)
- h = _mm_crc32_u32(h, *reinterpret_cast<const uint *>(p));
+ h = _mm_crc32_u32(h, *reinterpret_cast<const uint *>(p - 4));
p -= 4;
len = e - p;
# endif
@@ -227,12 +227,13 @@ uint qHash(QLatin1String key, uint seed) Q_DECL_NOTHROW
*/
static uint qt_create_qhash_seed()
{
+ uint seed = 0;
+
+#ifndef QT_BOOTSTRAPPED
QByteArray envSeed = qgetenv("QT_HASH_SEED");
if (!envSeed.isNull())
return envSeed.toUInt();
- uint seed = 0;
-
#ifdef Q_OS_UNIX
int randomfd = qt_safe_open("/dev/urandom", O_RDONLY);
if (randomfd == -1)
@@ -259,17 +260,16 @@ static uint qt_create_qhash_seed()
seed ^= timestamp;
seed ^= (timestamp >> 32);
-#ifndef QT_BOOTSTRAPPED
quint64 pid = QCoreApplication::applicationPid();
seed ^= pid;
seed ^= (pid >> 32);
-#endif // QT_BOOTSTRAPPED
quintptr seedPtr = reinterpret_cast<quintptr>(&seed);
seed ^= seedPtr;
#if QT_POINTER_SIZE == 8
seed ^= (seedPtr >> 32);
#endif
+#endif // QT_BOOTSTRAPPED
return seed;
}