Deprecate qGlobalQHashSeed and qSetGlobalQHashSeed in Qt 6.6

That's two years from when the replacements were added (6.2).

Change-Id: Id2983978ad544ff79911fffd1671f7dd38fede02
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
Thiago Macieira 2021-04-01 23:51:10 -07:00
parent a24ced7474
commit 4ef99b8fbb
5 changed files with 11 additions and 7 deletions

View File

@ -868,9 +868,10 @@ void QHashSeed::resetRandomGlobalSeed()
qt_qhash_seed.storeRelaxed(seed + 1);
}
#if QT_DEPRECATED_SINCE(6,6)
/*! \relates QHash
\since 5.6
\obsolete Use QHashSeed::globalSeed() instead.
Returns the current global QHash seed.
@ -886,6 +887,7 @@ int qGlobalQHashSeed()
/*! \relates QHash
\since 5.6
\obsolete Use QHashSeed instead.
Sets the global QHash seed to \a newSeed.
@ -919,6 +921,7 @@ void qSetGlobalQHashSeed(int newSeed)
fprintf(stderr, "qSetGlobalQHashSeed: forced seed value is not 0; ignoring call\n");
}
}
#endif // QT_DEPRECATED_SINCE(6,6)
/*!
\internal

View File

@ -475,7 +475,7 @@ struct Data
numBuckets = GrowthPolicy::bucketsForCapacity(reserve);
size_t nSpans = (numBuckets + Span::LocalBucketMask) / Span::NEntries;
spans = new Span[nSpans];
seed = qGlobalQHashSeed();
seed = QHashSeed::globalSeed();
}
Data(const Data &other, size_t reserved = 0)
: size(other.size),

View File

@ -64,9 +64,12 @@ class QByteArray;
class QString;
class QLatin1String;
// ### Qt 7: these should use size_t, not int.
#if QT_DEPRECATED_SINCE(6,6)
QT_DEPRECATED_VERSION_X_6_6("Use QHashSeed instead")
Q_CORE_EXPORT int qGlobalQHashSeed();
QT_DEPRECATED_VERSION_X_6_6("Use QHashSeed instead")
Q_CORE_EXPORT void qSetGlobalQHashSeed(int newSeed);
#endif
struct QHashSeed
{

View File

@ -53,7 +53,7 @@ static bool readFromDevice(QIODevice *device, QJsonArray *allMetaObjects)
int collectJson(const QStringList &jsonFiles, const QString &outputFile)
{
qSetGlobalQHashSeed(0);
QHashSeed::setDeterministicGlobalSeed();
QFile output;
if (outputFile.isEmpty()) {

View File

@ -441,9 +441,7 @@ int main(int argc, char *argv[])
// rcc uses a QHash to store files in the resource system.
// we must force a certain hash order when testing or tst_rcc will fail, see QTBUG-25078
// similar requirements exist for reproducibly builds.
qSetGlobalQHashSeed(0);
if (qGlobalQHashSeed() != 0)
qWarning("Cannot force QHash seed");
QHashSeed::setDeterministicGlobalSeed();
return QT_PREPEND_NAMESPACE(runRcc)(argc, argv);
}