QHash: remove the ability to set a non-zero global seed

We've been warning since commit 4ba740b3bac6e1824c18614f579d106eee930d42
(2017-03-31, Qt 5.9.0).

Change-Id: Id2983978ad544ff79911fffd1671f505fee6f282
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
Thiago Macieira 2021-04-01 22:59:07 -07:00
parent 042e728752
commit 9252b9bb92

View File

@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2020 The Qt Company Ltd.
** Copyright (C) 2016 Intel Corporation.
** Copyright (C) 2021 Intel Corporation.
** Copyright (C) 2012 Giuseppe D'Angelo <dangelog@gmail.com>.
** Contact: https://www.qt.io/licensing/
**
@ -725,8 +725,8 @@ static uint qt_create_qhash_seed()
uint seed = envSeed.toUInt();
if (seed) {
// can't use qWarning here (reentrancy)
fprintf(stderr, "QT_HASH_SEED: forced seed value is not 0, cannot guarantee that the "
"hashing functions will produce a stable value.");
fprintf(stderr, "QT_HASH_SEED: forced seed value is not 0; ignored.\n");
seed = 0;
}
return seed;
}
@ -812,10 +812,9 @@ void qSetGlobalQHashSeed(int newSeed)
} else {
if (newSeed) {
// can't use qWarning here (reentrancy)
fprintf(stderr, "qSetGlobalQHashSeed: forced seed value is not 0, cannot guarantee that the "
"hashing functions will produce a stable value.");
fprintf(stderr, "qSetGlobalQHashSeed: forced seed value is not 0; ignoring call\n");
}
qt_qhash_seed.storeRelaxed(newSeed & INT_MAX);
qt_qhash_seed.storeRelaxed(0);
}
}