summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2020-01-31 12:11:54 +0100
committerLars Knoll <lars.knoll@qt.io>2020-04-09 20:03:25 +0200
commitc6cdf38e752c22babdbe645366bdfb7ce51d01ff (patch)
tree450b02523cb5a16791674ad1d06fb68c72eac971
parent775945137b6ef62de9a7d416b1fe59d79006ba82 (diff)
downloadqtbase-c6cdf38e752c22babdbe645366bdfb7ce51d01ff.tar.gz
Change qHash() to work with size_t instead of uint
This is required, so that QHash and QSet can hold more than 2^32 items on 64 bit platforms. The actual hashing functions for strings are still 32bit, this will be changed in a follow-up commit. Change-Id: I4372125252486075ff3a0b45ecfa818359fe103b Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
-rw-r--r--examples/embedded/lightmaps/slippymap.cpp2
-rw-r--r--examples/widgets/tools/i18n/languagechooser.cpp2
-rw-r--r--qmake/cachekeys.h4
-rw-r--r--qmake/generators/makefile.h6
-rw-r--r--qmake/library/proitems.cpp2
-rw-r--r--qmake/library/proitems.h4
-rw-r--r--qmake/library/qmakeevaluator.cpp2
-rw-r--r--qmake/library/qmakeglobals.h2
-rw-r--r--src/corelib/doc/snippets/code/src_corelib_tools_qhash.cpp16
-rw-r--r--src/corelib/io/qfilesystemwatcher_win_p.h2
-rw-r--r--src/corelib/io/qurl.cpp2
-rw-r--r--src/corelib/io/qurl.h4
-rw-r--r--src/corelib/io/qurlquery.cpp2
-rw-r--r--src/corelib/io/qurlquery.h4
-rw-r--r--src/corelib/itemmodels/qabstractitemmodel.cpp2
-rw-r--r--src/corelib/itemmodels/qabstractitemmodel.h10
-rw-r--r--src/corelib/itemmodels/qitemselectionmodel.h3
-rw-r--r--src/corelib/mimetypes/qmimetype.cpp2
-rw-r--r--src/corelib/mimetypes/qmimetype.h4
-rw-r--r--src/corelib/plugin/quuid.cpp2
-rw-r--r--src/corelib/plugin/quuid.h2
-rw-r--r--src/corelib/serialization/qcborarray.cpp2
-rw-r--r--src/corelib/serialization/qcborarray.h2
-rw-r--r--src/corelib/serialization/qcborcommon.h4
-rw-r--r--src/corelib/serialization/qcbormap.cpp2
-rw-r--r--src/corelib/serialization/qcbormap.h2
-rw-r--r--src/corelib/serialization/qcborvalue.cpp2
-rw-r--r--src/corelib/serialization/qcborvalue.h2
-rw-r--r--src/corelib/serialization/qjsonarray.cpp2
-rw-r--r--src/corelib/serialization/qjsonarray.h2
-rw-r--r--src/corelib/serialization/qjsonobject.cpp2
-rw-r--r--src/corelib/serialization/qjsonobject.h2
-rw-r--r--src/corelib/serialization/qjsonvalue.cpp2
-rw-r--r--src/corelib/serialization/qjsonvalue.h2
-rw-r--r--src/corelib/statemachine/qstatemachine_p.h5
-rw-r--r--src/corelib/text/qbytearray.cpp2
-rw-r--r--src/corelib/text/qbytearray.h2
-rw-r--r--src/corelib/text/qlocale.cpp2
-rw-r--r--src/corelib/text/qlocale.h4
-rw-r--r--src/corelib/text/qregexp.cpp4
-rw-r--r--src/corelib/text/qregexp.h4
-rw-r--r--src/corelib/text/qregularexpression.cpp2
-rw-r--r--src/corelib/text/qregularexpression.h4
-rw-r--r--src/corelib/time/qcalendar.cpp2
-rw-r--r--src/corelib/time/qdatetime.cpp12
-rw-r--r--src/corelib/time/qdatetime.h6
-rw-r--r--src/corelib/tools/qbitarray.h2
-rw-r--r--src/corelib/tools/qhash.cpp84
-rw-r--r--src/corelib/tools/qhash.h4
-rw-r--r--src/corelib/tools/qhashfunctions.h79
-rw-r--r--src/corelib/tools/qset.h2
-rw-r--r--src/corelib/tools/qset.qdoc2
-rw-r--r--src/corelib/tools/qshareddata.h4
-rw-r--r--src/corelib/tools/qsharedpointer_impl.h2
-rw-r--r--src/corelib/tools/qvarlengtharray.h2
-rw-r--r--src/corelib/tools/qvarlengtharray.qdoc2
-rw-r--r--src/corelib/tools/qvector.h2
-rw-r--r--src/corelib/tools/qvector.qdoc2
-rw-r--r--src/corelib/tools/qversionnumber.cpp4
-rw-r--r--src/corelib/tools/qversionnumber.h4
-rw-r--r--src/dbus/qdbusextratypes.h4
-rw-r--r--src/gui/image/qpixmapcache.cpp4
-rw-r--r--src/gui/image/qpixmapcache_p.h2
-rw-r--r--src/gui/kernel/qevent.cpp2
-rw-r--r--src/gui/kernel/qevent.h2
-rw-r--r--src/gui/kernel/qguiapplication.cpp4
-rw-r--r--src/gui/kernel/qguiapplication_p.h2
-rw-r--r--src/gui/kernel/qkeysequence.cpp2
-rw-r--r--src/gui/kernel/qkeysequence.h4
-rw-r--r--src/gui/opengl/qopengl_p.h4
-rw-r--r--src/gui/opengl/qopenglversionfunctions.h2
-rw-r--r--src/gui/opengl/qopenglversionprofile.h2
-rw-r--r--src/gui/painting/qicc.cpp2
-rw-r--r--src/gui/painting/qtextureglyphcache_p.h2
-rw-r--r--src/gui/painting/qtransform.cpp2
-rw-r--r--src/gui/painting/qtransform.h2
-rw-r--r--src/gui/rhi/qrhi.cpp16
-rw-r--r--src/gui/rhi/qrhi_p.h18
-rw-r--r--src/gui/rhi/qshader.cpp4
-rw-r--r--src/gui/rhi/qshader_p.h6
-rw-r--r--src/gui/text/qfont.cpp2
-rw-r--r--src/gui/text/qfont.h2
-rw-r--r--src/gui/text/qfont_p.h2
-rw-r--r--src/gui/text/qfontengine_p.h2
-rw-r--r--src/gui/text/qrawfont.cpp2
-rw-r--r--src/gui/text/qrawfont.h2
-rw-r--r--src/gui/vulkan/qvulkaninstance.cpp4
-rw-r--r--src/gui/vulkan/qvulkaninstance.h4
-rw-r--r--src/network/kernel/qhostaddress.cpp2
-rw-r--r--src/network/kernel/qhostaddress.h4
-rw-r--r--src/network/ssl/qocspresponse.cpp6
-rw-r--r--src/network/ssl/qocspresponse.h4
-rw-r--r--src/network/ssl/qsslcertificate.cpp2
-rw-r--r--src/network/ssl/qsslcertificate.h4
-rw-r--r--src/network/ssl/qsslcertificate_openssl.cpp2
-rw-r--r--src/network/ssl/qsslcertificate_qt.cpp2
-rw-r--r--src/network/ssl/qssldiffiehellmanparameters.cpp2
-rw-r--r--src/network/ssl/qssldiffiehellmanparameters.h4
-rw-r--r--src/network/ssl/qsslellipticcurve.cpp2
-rw-r--r--src/network/ssl/qsslellipticcurve.h6
-rw-r--r--src/network/ssl/qsslerror.cpp2
-rw-r--r--src/network/ssl/qsslerror.h2
-rw-r--r--src/platformsupport/fontdatabases/freetype/qfontengine_ft_p.h2
-rw-r--r--src/plugins/platforms/windows/qwindowscursor.h4
-rw-r--r--src/plugins/platforms/winrt/qwinrtintegration.cpp2
-rw-r--r--src/plugins/platforms/winrt/qwinrtscreen.cpp8
-rw-r--r--src/plugins/platforms/xcb/qxcbcursor.h4
-rw-r--r--src/plugins/styles/mac/qmacstyle_mac.mm2
-rw-r--r--src/plugins/styles/windowsvista/qwindowsxpstyle_p_p.h2
-rw-r--r--src/tools/moc/symbols.h2
-rw-r--r--src/widgets/dialogs/qfilesystemmodel_p.h2
-rw-r--r--src/widgets/kernel/qsizepolicy.cpp2
-rw-r--r--src/widgets/kernel/qsizepolicy.h4
-rw-r--r--tests/auto/corelib/plugin/quuid/tst_quuid.cpp2
-rw-r--r--tests/auto/corelib/tools/collections/tst_collections.cpp6
-rw-r--r--tests/auto/corelib/tools/containerapisymmetry/tst_containerapisymmetry.cpp6
-rw-r--r--tests/auto/corelib/tools/qcache/tst_qcache.cpp2
-rw-r--r--tests/auto/corelib/tools/qhash/tst_qhash.cpp34
-rw-r--r--tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp10
-rw-r--r--tests/auto/corelib/tools/qset/tst_qset.cpp2
-rw-r--r--tests/auto/corelib/tools/qvector/tst_qvector.cpp4
-rw-r--r--tests/auto/gui/painting/qpainter/tst_qpainter.cpp2
-rw-r--r--util/glgen/qopenglversionfunctions.h.header2
-rw-r--r--util/glgen/specparser.h4
-rw-r--r--util/lexgen/nfa.cpp6
125 files changed, 305 insertions, 310 deletions
diff --git a/examples/embedded/lightmaps/slippymap.cpp b/examples/embedded/lightmaps/slippymap.cpp
index da003981ff..66957bea18 100644
--- a/examples/embedded/lightmaps/slippymap.cpp
+++ b/examples/embedded/lightmaps/slippymap.cpp
@@ -53,7 +53,7 @@
#include "slippymap.h"
#include "qmath.h"
-uint qHash(const QPoint& p)
+size_t qHash(const QPoint& p)
{
return p.x() * 17 ^ p.y();
}
diff --git a/examples/widgets/tools/i18n/languagechooser.cpp b/examples/widgets/tools/i18n/languagechooser.cpp
index 2ce3471873..51dfce915f 100644
--- a/examples/widgets/tools/i18n/languagechooser.cpp
+++ b/examples/widgets/tools/i18n/languagechooser.cpp
@@ -173,7 +173,7 @@ QString LanguageChooser::languageName(const QString &qmFile)
QColor LanguageChooser::colorForLanguage(const QString &language)
{
- uint hashValue = qHash(language);
+ size_t hashValue = qHash(language);
int red = 156 + (hashValue & 0x3F);
int green = 156 + ((hashValue >> 6) & 0x3F);
int blue = 156 + ((hashValue >> 12) & 0x3F);
diff --git a/qmake/cachekeys.h b/qmake/cachekeys.h
index 8050f148aa..e9278653bd 100644
--- a/qmake/cachekeys.h
+++ b/qmake/cachekeys.h
@@ -64,7 +64,7 @@ struct FixStringCacheKey
return hash;
}
};
-inline uint qHash(const FixStringCacheKey &f) { return f.hashCode(); }
+inline size_t qHash(const FixStringCacheKey &f) { return f.hashCode(); }
// -------------------------------------------------------------------------------------------------
struct FileInfoCacheKey
@@ -102,7 +102,7 @@ struct FileInfoCacheKey
|| (c0 == QLatin1Char('\\') && c1 == QLatin1Char('\\')));
}
};
-inline uint qHash(const FileInfoCacheKey &f) { return f.hashCode(); }
+inline size_t qHash(const FileInfoCacheKey &f) { return f.hashCode(); }
// -------------------------------------------------------------------------------------------------
template <typename T>
diff --git a/qmake/generators/makefile.h b/qmake/generators/makefile.h
index a96b9c54da..bae32883b4 100644
--- a/qmake/generators/makefile.h
+++ b/qmake/generators/makefile.h
@@ -306,13 +306,13 @@ struct ReplaceExtraCompilerCacheKey
MakefileGenerator::ReplaceFor forShell;
ReplaceExtraCompilerCacheKey(const QString &v, const QStringList &i, const QStringList &o, MakefileGenerator::ReplaceFor s);
bool operator==(const ReplaceExtraCompilerCacheKey &f) const;
- inline uint hashCode() const {
+ inline size_t hashCode() const {
if (!hash)
- hash = (uint)forShell ^ qHash(var) ^ qHash(in) ^ qHash(out) /*^ qHash(pwd)*/;
+ hash = (size_t)forShell ^ qHash(var) ^ qHash(in) ^ qHash(out) /*^ qHash(pwd)*/;
return hash;
}
};
-inline uint qHash(const ReplaceExtraCompilerCacheKey &f) { return f.hashCode(); }
+inline size_t qHash(const ReplaceExtraCompilerCacheKey &f) { return f.hashCode(); }
QT_END_NAMESPACE
diff --git a/qmake/library/proitems.cpp b/qmake/library/proitems.cpp
index 9330c2b1bf..6bef098874 100644
--- a/qmake/library/proitems.cpp
+++ b/qmake/library/proitems.cpp
@@ -116,7 +116,7 @@ uint ProString::updatedHash() const
return (m_hash = hash(m_string.constData() + m_offset, m_length));
}
-uint qHash(const ProString &str)
+size_t qHash(const ProString &str)
{
if (!(str.m_hash & 0x80000000))
return str.m_hash;
diff --git a/qmake/library/proitems.h b/qmake/library/proitems.h
index 01370959c7..333f9ed889 100644
--- a/qmake/library/proitems.h
+++ b/qmake/library/proitems.h
@@ -173,7 +173,7 @@ private:
mutable uint m_hash;
QChar *prepareExtend(int extraLen, int thisTarget, int extraTarget);
uint updatedHash() const;
- friend uint qHash(const ProString &str);
+ friend size_t qHash(const ProString &str);
friend QString operator+(const ProString &one, const ProString &two);
friend class ProKey;
};
@@ -206,7 +206,7 @@ private:
};
Q_DECLARE_TYPEINFO(ProKey, Q_MOVABLE_TYPE);
-uint qHash(const ProString &str);
+size_t qHash(const ProString &str);
QString operator+(const ProString &one, const ProString &two);
inline QString operator+(const ProString &one, const QString &two)
{ return one.toQStringRef() + two; }
diff --git a/qmake/library/qmakeevaluator.cpp b/qmake/library/qmakeevaluator.cpp
index e350923e83..7041a2402e 100644
--- a/qmake/library/qmakeevaluator.cpp
+++ b/qmake/library/qmakeevaluator.cpp
@@ -107,7 +107,7 @@ QMakeBaseKey::QMakeBaseKey(const QString &_root, const QString &_stash, bool _ho
{
}
-uint qHash(const QMakeBaseKey &key)
+size_t qHash(const QMakeBaseKey &key)
{
return qHash(key.root) ^ qHash(key.stash) ^ (uint)key.hostBuild;
}
diff --git a/qmake/library/qmakeglobals.h b/qmake/library/qmakeglobals.h
index 6c00b1f3af..58b22ba8c5 100644
--- a/qmake/library/qmakeglobals.h
+++ b/qmake/library/qmakeglobals.h
@@ -62,7 +62,7 @@ public:
bool hostBuild;
};
-uint qHash(const QMakeBaseKey &key);
+size_t qHash(const QMakeBaseKey &key);
bool operator==(const QMakeBaseKey &one, const QMakeBaseKey &two);
class QMakeBaseEnv
diff --git a/src/corelib/doc/snippets/code/src_corelib_tools_qhash.cpp b/src/corelib/doc/snippets/code/src_corelib_tools_qhash.cpp
index d30ad50ffc..1f2c505a02 100644
--- a/src/corelib/doc/snippets/code/src_corelib_tools_qhash.cpp
+++ b/src/corelib/doc/snippets/code/src_corelib_tools_qhash.cpp
@@ -149,7 +149,7 @@ inline bool operator==(const Employee &e1, const Employee &e2)
&& e1.dateOfBirth() == e2.dateOfBirth();
}
-inline uint qHash(const Employee &key, uint seed)
+inline size_t qHash(const Employee &key, size_t seed)
{
return qHash(key.name(), seed) ^ key.dateOfBirth().day();
}
@@ -312,7 +312,7 @@ qDeleteAll(hash2.keyBegin(), hash2.keyEnd());
//! [28]
//! [qhashbits]
-inline uint qHash(const std::vector<int> &key, uint seed = 0)
+inline size_t qHash(const std::vector<int> &key, size_t seed = 0)
{
if (key.empty())
return seed;
@@ -322,14 +322,14 @@ inline uint qHash(const std::vector<int> &key, uint seed = 0)
//! [qhashbits]
//! [qhashrange]
-inline uint qHash(const std::vector<int> &key, uint seed = 0)
+inline size_t qHash(const std::vector<int> &key, size_t seed = 0)
{
return qHashRange(key.begin(), key.end(), seed);
}
//! [qhashrange]
//! [qhashrangecommutative]
-inline uint qHash(const std::unordered_set<int> &key, uint seed = 0)
+inline size_t qHash(const std::unordered_set<int> &key, size_t seed = 0)
{
return qHashRangeCommutative(key.begin(), key.end(), seed);
}
@@ -348,9 +348,9 @@ qHash(qMakePair(key.first, key.second), seed);
//! [31]
//! [32]
-uint qHash(K key);
-uint qHash(const K &key);
+size_t qHash(K key);
+size_t qHash(const K &key);
-uint qHash(K key, uint seed);
-uint qHash(const K &key, uint seed);
+size_t qHash(K key, size_t seed);
+size_t qHash(const K &key, size_t seed);
//! [32]
diff --git a/src/corelib/io/qfilesystemwatcher_win_p.h b/src/corelib/io/qfilesystemwatcher_win_p.h
index 272591ce7a..9d74ca3f61 100644
--- a/src/corelib/io/qfilesystemwatcher_win_p.h
+++ b/src/corelib/io/qfilesystemwatcher_win_p.h
@@ -142,7 +142,7 @@ public:
Q_DECLARE_TYPEINFO(QFileSystemWatcherPathKey, Q_MOVABLE_TYPE);
-inline uint qHash(const QFileSystemWatcherPathKey &key) { return qHash(key.toCaseFolded()); }
+inline size_t qHash(const QFileSystemWatcherPathKey &key) { return qHash(key.toCaseFolded()); }
class QWindowsFileSystemWatcherEngineThread : public QThread
{
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp
index 3e7d8e113c..49570697ef 100644
--- a/src/corelib/io/qurl.cpp
+++ b/src/corelib/io/qurl.cpp
@@ -4116,7 +4116,7 @@ QList<QUrl> QUrl::fromStringList(const QStringList &urls, ParsingMode mode)
\relates QHash
\since 5.0
*/
-uint qHash(const QUrl &url, uint seed) noexcept
+size_t qHash(const QUrl &url, size_t seed) noexcept
{
if (!url.d)
return qHash(-1, seed); // the hash of an unset port (-1)
diff --git a/src/corelib/io/qurl.h b/src/corelib/io/qurl.h
index edf5ee42d7..0425502a52 100644
--- a/src/corelib/io/qurl.h
+++ b/src/corelib/io/qurl.h
@@ -119,7 +119,7 @@ class QTypeInfo<QUrlTwoFlags<E1, E2> > : public QTypeInfoMerger<QUrlTwoFlags<E1,
class QUrl;
// qHash is a friend, but we can't use default arguments for friends (§8.3.6.4)
-Q_CORE_EXPORT uint qHash(const QUrl &url, uint seed = 0) noexcept;
+Q_CORE_EXPORT size_t qHash(const QUrl &url, size_t seed = 0) noexcept;
class Q_CORE_EXPORT QUrl
{
@@ -356,7 +356,7 @@ public:
static QList<QUrl> fromStringList(const QStringList &uris, ParsingMode mode = TolerantMode);
static void setIdnWhitelist(const QStringList &);
- friend Q_CORE_EXPORT uint qHash(const QUrl &url, uint seed) noexcept;
+ friend Q_CORE_EXPORT size_t qHash(const QUrl &url, size_t seed) noexcept;
private:
QUrlPrivate *d;
diff --git a/src/corelib/io/qurlquery.cpp b/src/corelib/io/qurlquery.cpp
index 8d80a2d8bd..325a0c2ba3 100644
--- a/src/corelib/io/qurlquery.cpp
+++ b/src/corelib/io/qurlquery.cpp
@@ -434,7 +434,7 @@ bool QUrlQuery::operator ==(const QUrlQuery &other) const
Returns the hash value for \a key,
using \a seed to seed the calculation.
*/
-uint qHash(const QUrlQuery &key, uint seed) noexcept
+size_t qHash(const QUrlQuery &key, size_t seed) noexcept
{
if (const QUrlQueryPrivate *d = key.d) {
QtPrivate::QHashCombine hash;
diff --git a/src/corelib/io/qurlquery.h b/src/corelib/io/qurlquery.h
index 89d0f88059..0be2cafb0b 100644
--- a/src/corelib/io/qurlquery.h
+++ b/src/corelib/io/qurlquery.h
@@ -52,7 +52,7 @@
QT_BEGIN_NAMESPACE
-Q_CORE_EXPORT uint qHash(const QUrlQuery &key, uint seed = 0) noexcept;
+Q_CORE_EXPORT size_t qHash(const QUrlQuery &key, size_t seed = 0) noexcept;
class QUrlQueryPrivate;
class Q_CORE_EXPORT QUrlQuery
@@ -109,7 +109,7 @@ public:
private:
friend class QUrl;
- friend Q_CORE_EXPORT uint qHash(const QUrlQuery &key, uint seed) noexcept;
+ friend Q_CORE_EXPORT size_t qHash(const QUrlQuery &key, size_t seed) noexcept;
QSharedDataPointer<QUrlQueryPrivate> d;
public:
typedef QSharedDataPointer<QUrlQueryPrivate> DataPtr;
diff --git a/src/corelib/itemmodels/qabstractitemmodel.cpp b/src/corelib/itemmodels/qabstractitemmodel.cpp
index 57a6c2f239..3bc3b546da 100644
--- a/src/corelib/itemmodels/qabstractitemmodel.cpp
+++ b/src/corelib/itemmodels/qabstractitemmodel.cpp
@@ -3978,7 +3978,7 @@ bool QAbstractListModel::dropMimeData(const QMimeData *data, Qt::DropAction acti
*/
/*!
- \fn uint qHash(const QPersistentModelIndex &index, uint seed = 0)
+ \fn size_t qHash(const QPersistentModelIndex &index, size_t seed = 0)
\since 5.0
\relates QPersistentModelIndex
diff --git a/src/corelib/itemmodels/qabstractitemmodel.h b/src/corelib/itemmodels/qabstractitemmodel.h
index 2cc1bd8ce6..86ff361ccb 100644
--- a/src/corelib/itemmodels/qabstractitemmodel.h
+++ b/src/corelib/itemmodels/qabstractitemmodel.h
@@ -103,7 +103,7 @@ Q_CORE_EXPORT QDebug operator<<(QDebug, const QModelIndex &);
class QPersistentModelIndexData;
// qHash is a friend, but we can't use default arguments for friends (§8.3.6.4)
-uint qHash(const QPersistentModelIndex &index, uint seed = 0) noexcept;
+size_t qHash(const QPersistentModelIndex &index, size_t seed = 0) noexcept;
class Q_CORE_EXPORT QPersistentModelIndex
{
@@ -141,14 +141,14 @@ public:
bool isValid() const;
private:
QPersistentModelIndexData *d;
- friend uint qHash(const QPersistentModelIndex &, uint seed) noexcept;
+ friend size_t qHash(const QPersistentModelIndex &, size_t seed) noexcept;
#ifndef QT_NO_DEBUG_STREAM
friend Q_CORE_EXPORT QDebug operator<<(QDebug, const QPersistentModelIndex &);
#endif
};
Q_DECLARE_SHARED(QPersistentModelIndex)
-inline uint qHash(const QPersistentModelIndex &index, uint seed) noexcept
+inline size_t qHash(const QPersistentModelIndex &index, size_t seed) noexcept
{ return qHash(index.d, seed); }
@@ -461,8 +461,8 @@ inline QVariant QModelIndex::data(int arole) const
inline Qt::ItemFlags QModelIndex::flags() const
{ return m ? m->flags(*this) : Qt::ItemFlags(); }
-inline uint qHash(const QModelIndex &index) noexcept
-{ return uint((uint(index.row()) << 4) + index.column() + index.internalId()); }
+inline size_t qHash(const QModelIndex &index, size_t seed) noexcept
+{ return size_t((size_t(index.row()) << 4) + size_t(index.column()) + index.internalId()) ^ seed; }
QT_END_NAMESPACE
diff --git a/src/corelib/itemmodels/qitemselectionmodel.h b/src/corelib/itemmodels/qitemselectionmodel.h
index 5421eb2afa..a1badc7693 100644
--- a/src/corelib/itemmodels/qitemselectionmodel.h
+++ b/src/corelib/itemmodels/qitemselectionmodel.h
@@ -223,9 +223,6 @@ private:
Q_DECLARE_OPERATORS_FOR_FLAGS(QItemSelectionModel::SelectionFlags)
-// dummy implentation of qHash() necessary for instantiating QList<QItemSelectionRange>::toSet() with MSVC
-inline uint qHash(const QItemSelectionRange &) { return 0; }
-
#ifdef Q_CC_MSVC
/*
diff --git a/src/corelib/mimetypes/qmimetype.cpp b/src/corelib/mimetypes/qmimetype.cpp
index de450c68f4..17a6effe03 100644
--- a/src/corelib/mimetypes/qmimetype.cpp
+++ b/src/corelib/mimetypes/qmimetype.cpp
@@ -192,7 +192,7 @@ bool QMimeType::operator==(const QMimeType &other) const
Returns the hash value for \a key, using
\a seed to seed the calculation.
*/
-uint qHash(const QMimeType &key, uint seed) noexcept
+size_t qHash(const QMimeType &key, size_t seed) noexcept
{
return qHash(key.d->name, seed);
}
diff --git a/src/corelib/mimetypes/qmimetype.h b/src/corelib/mimetypes/qmimetype.h
index df1b60f2ce..5aabbb449e 100644
--- a/src/corelib/mimetypes/qmimetype.h
+++ b/src/corelib/mimetypes/qmimetype.h
@@ -55,7 +55,7 @@ QT_BEGIN_NAMESPACE
class QMimeTypePrivate;
class QMimeType;
-Q_CORE_EXPORT uint qHash(const QMimeType &key, uint seed = 0) noexcept;
+Q_CORE_EXPORT size_t qHash(const QMimeType &key, size_t seed = 0) noexcept;
class Q_CORE_EXPORT QMimeType
{
@@ -119,7 +119,7 @@ protected:
friend class QMimeXMLProvider;
friend class QMimeBinaryProvider;
friend class QMimeTypePrivate;
- friend Q_CORE_EXPORT uint qHash(const QMimeType &key, uint seed) noexcept;
+ friend Q_CORE_EXPORT size_t qHash(const QMimeType &key, size_t seed) noexcept;
QExplicitlySharedDataPointer<QMimeTypePrivate> d;
};
diff --git a/src/corelib/plugin/quuid.cpp b/src/corelib/plugin/quuid.cpp
index 83873edf6f..fc70ca1386 100644
--- a/src/corelib/plugin/quuid.cpp
+++ b/src/corelib/plugin/quuid.cpp
@@ -1089,7 +1089,7 @@ QDebug operator<<(QDebug dbg, const QUuid &id)
\relates QUuid
Returns a hash of the UUID \a uuid, using \a seed to seed the calculation.
*/
-uint qHash(const QUuid &uuid, uint seed) noexcept
+size_t qHash(const QUuid &uuid, size_t seed) noexcept
{
return uuid.data1 ^ uuid.data2 ^ (uuid.data3 << 16)
^ ((uuid.data4[0] << 24) | (uuid.data4[1] << 16) | (uuid.data4[2] << 8) | uuid.data4[3])
diff --git a/src/corelib/plugin/quuid.h b/src/corelib/plugin/quuid.h
index 713ca070c8..bdd74f4b77 100644
--- a/src/corelib/plugin/quuid.h
+++ b/src/corelib/plugin/quuid.h
@@ -243,7 +243,7 @@ Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QUuid &);
Q_CORE_EXPORT QDebug operator<<(QDebug, const QUuid &);
#endif
-Q_CORE_EXPORT uint qHash(const QUuid &uuid, uint seed = 0) noexcept;
+Q_CORE_EXPORT size_t qHash(const QUuid &uuid, size_t seed = 0) noexcept;
inline bool operator<=(const QUuid &lhs, const QUuid &rhs) noexcept
{ return !(rhs < lhs); }
diff --git a/src/corelib/serialization/qcborarray.cpp b/src/corelib/serialization/qcborarray.cpp
index ca0156e07d..3bb99176af 100644
--- a/src/corelib/serialization/qcborarray.cpp
+++ b/src/corelib/serialization/qcborarray.cpp
@@ -1200,7 +1200,7 @@ void QCborArray::detach(qsizetype reserved)
Returns the offset of this iterator relative to \a other.
*/
-uint qHash(const QCborArray &array, uint seed)
+size_t qHash(const QCborArray &array, size_t seed)
{
return qHashRange(array.begin(), array.end(), seed);
}
diff --git a/src/corelib/serialization/qcborarray.h b/src/corelib/serialization/qcborarray.h
index fe06b8630f..0438b920ab 100644
--- a/src/corelib/serialization/qcborarray.h
+++ b/src/corelib/serialization/qcborarray.h
@@ -294,7 +294,7 @@ inline QCborArray QCborValueRef::toArray(const QCborArray &a) const
return concrete().toArray(a);
}
-Q_CORE_EXPORT uint qHash(const QCborArray &array, uint seed = 0);
+Q_CORE_EXPORT size_t qHash(const QCborArray &array, size_t seed = 0);
#if !defined(QT_NO_DEBUG_STREAM)
Q_CORE_EXPORT QDebug operator<<(QDebug, const QCborArray &a);
diff --git a/src/corelib/serialization/qcborcommon.h b/src/corelib/serialization/qcborcommon.h
index bec46399ce..1497da3d2e 100644
--- a/src/corelib/serialization/qcborcommon.h
+++ b/src/corelib/serialization/qcborcommon.h
@@ -138,12 +138,12 @@ QDataStream &operator<<(QDataStream &ds, QCborSimpleType st);
QDataStream &operator>>(QDataStream &ds, QCborSimpleType &st);
#endif
-inline uint qHash(QCborSimpleType tag, uint seed = 0)
+inline size_t qHash(QCborSimpleType tag, size_t seed = 0)
{
return qHash(quint8(tag), seed);
}
-inline uint qHash(QCborTag tag, uint seed = 0)
+inline size_t qHash(QCborTag tag, size_t seed = 0)
{
return qHash(quint64(tag), seed);
}
diff --git a/src/corelib/serialization/qcbormap.cpp b/src/corelib/serialization/qcbormap.cpp
index 4b28ca4a2e..9a8a2c4417 100644
--- a/src/corelib/serialization/qcbormap.cpp
+++ b/src/corelib/serialization/qcbormap.cpp
@@ -1744,7 +1744,7 @@ void QCborMap::detach(qsizetype reserved)
\sa operator+=(), operator-()
*/
-uint qHash(const QCborMap &map, uint seed)
+size_t qHash(const QCborMap &map, size_t seed)
{
return qHashRange(map.begin(), map.end(), seed);
}
diff --git a/src/corelib/serialization/qcbormap.h b/src/corelib/serialization/qcbormap.h
index 6636ce776a..0609c0a39e 100644
--- a/src/corelib/serialization/qcbormap.h
+++ b/src/corelib/serialization/qcbormap.h
@@ -350,7 +350,7 @@ inline QCborMap QCborValueRef::toMap(const QCborMap &m) const
return concrete().toMap(m);
}
-Q_CORE_EXPORT uint qHash(const QCborMap &map, uint seed = 0);
+Q_CORE_EXPORT size_t qHash(const QCborMap &map, size_t seed = 0);
#if !defined(QT_NO_DEBUG_STREAM)
Q_CORE_EXPORT QDebug operator<<(QDebug, const QCborMap &m);
diff --git a/src/corelib/serialization/qcborvalue.cpp b/src/corelib/serialization/qcborvalue.cpp
index ddc303e15d..298ebcfd72 100644
--- a/src/corelib/serialization/qcborvalue.cpp
+++ b/src/corelib/serialization/qcborvalue.cpp
@@ -2921,7 +2921,7 @@ inline QCborMap::QCborMap(QCborContainerPrivate &dd) noexcept
{
}
-uint qHash(const QCborValue &value, uint seed)
+size_t qHash(const QCborValue &value, size_t seed)
{
switch (value.type()) {
case QCborValue::Integer:
diff --git a/src/corelib/serialization/qcborvalue.h b/src/corelib/serialization/qcborvalue.h
index bbe2774e69..9923710eaa 100644
--- a/src/corelib/serialization/qcborvalue.h
+++ b/src/corelib/serialization/qcborvalue.h
@@ -481,7 +481,7 @@ private:
qsizetype i;
};
-Q_CORE_EXPORT uint qHash(const QCborValue &value, uint seed = 0);
+Q_CORE_EXPORT size_t qHash(const QCborValue &value, size_t seed = 0);
#if !defined(QT_NO_DEBUG_STREAM)
Q_CORE_EXPORT QDebug operator<<(QDebug, const QCborValue &v);
diff --git a/src/corelib/serialization/qjsonarray.cpp b/src/corelib/serialization/qjsonarray.cpp
index 05138ad610..98ace021fc 100644
--- a/src/corelib/serialization/qjsonarray.cpp
+++ b/src/corelib/serialization/qjsonarray.cpp
@@ -1133,7 +1133,7 @@ void QJsonArray::compact()
a->compact(a->elements.size());
}
-uint qHash(const QJsonArray &array, uint seed)
+size_t qHash(const QJsonArray &array, size_t seed)
{
return qHashRange(array.begin(), array.end(), seed);
}
diff --git a/src/corelib/serialization/qjsonarray.h b/src/corelib/serialization/qjsonarray.h
index 9b7e10766f..d39522bd2f 100644
--- a/src/corelib/serialization/qjsonarray.h
+++ b/src/corelib/serialization/qjsonarray.h
@@ -252,7 +252,7 @@ private:
Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QJsonArray)
-Q_CORE_EXPORT uint qHash(const QJsonArray &array, uint seed = 0);
+Q_CORE_EXPORT size_t qHash(const QJsonArray &array, size_t seed = 0);
#if !defined(QT_NO_DEBUG_STREAM) && !defined(QT_JSON_READONLY)
Q_CORE_EXPORT QDebug operator<<(QDebug, const QJsonArray &);
diff --git a/src/corelib/serialization/qjsonobject.cpp b/src/corelib/serialization/qjsonobject.cpp
index b76e50e2d2..1a85429c82 100644
--- a/src/corelib/serialization/qjsonobject.cpp
+++ b/src/corelib/serialization/qjsonobject.cpp
@@ -1487,7 +1487,7 @@ void QJsonObject::removeAt(int index)
o->removeAt(index);
}
-uint qHash(const QJsonObject &object, uint seed)
+size_t qHash(const QJsonObject &object, size_t seed)
{
QtPrivate::QHashCombine hash;
for (auto it = object.begin(), end = object.end(); it != end; ++it) {
diff --git a/src/corelib/serialization/qjsonobject.h b/src/corelib/serialization/qjsonobject.h
index c31be0353d..dc449eecf4 100644
--- a/src/corelib/serialization/qjsonobject.h
+++ b/src/corelib/serialization/qjsonobject.h
@@ -302,7 +302,7 @@ private:
Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QJsonObject)
-Q_CORE_EXPORT uint qHash(const QJsonObject &object, uint seed = 0);
+Q_CORE_EXPORT size_t qHash(const QJsonObject &object, size_t seed = 0);
#if !defined(QT_NO_DEBUG_STREAM) && !defined(QT_JSON_READONLY)
Q_CORE_EXPORT QDebug operator<<(QDebug, const QJsonObject &);
diff --git a/src/corelib/serialization/qjsonvalue.cpp b/src/corelib/serialization/qjsonvalue.cpp
index e9ba176d7f..5eb33bd2a3 100644
--- a/src/corelib/serialization/qjsonvalue.cpp
+++ b/src/corelib/serialization/qjsonvalue.cpp
@@ -943,7 +943,7 @@ QJsonValue QJsonValueRef::toValue() const
return o->valueAt(index);
}
-uint qHash(const QJsonValue &value, uint seed)
+size_t qHash(const QJsonValue &value, size_t seed)
{
switch (value.type()) {
case QJsonValue::Null:
diff --git a/src/corelib/serialization/qjsonvalue.h b/src/corelib/serialization/qjsonvalue.h
index bd8bf14baf..fa877ff7ee 100644
--- a/src/corelib/serialization/qjsonvalue.h
+++ b/src/corelib/serialization/qjsonvalue.h
@@ -232,7 +232,7 @@ public:
Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QJsonValue)
-Q_CORE_EXPORT uint qHash(const QJsonValue &value, uint seed = 0);
+Q_CORE_EXPORT size_t qHash(const QJsonValue &value, size_t seed = 0);
#if !defined(QT_NO_DEBUG_STREAM) && !defined(QT_JSON_READONLY)
Q_CORE_EXPORT QDebug operator<<(QDebug, const QJsonValue &);
diff --git a/src/corelib/statemachine/qstatemachine_p.h b/src/corelib/statemachine/qstatemachine_p.h
index f140023e31..7018926bd3 100644
--- a/src/corelib/statemachine/qstatemachine_p.h
+++ b/src/corelib/statemachine/qstatemachine_p.h
@@ -216,12 +216,9 @@ public:
QPointer<QObject> guard;
QObject *obj;
QByteArray prop;
- // two overloads because friends can't have default arguments
- friend uint qHash(const RestorableId &key, uint seed)
+ friend size_t qHash(const RestorableId &key, size_t seed)
noexcept(noexcept(qHash(std::declval<QByteArray>())))
{ return qHash(qMakePair(key.obj, key.prop), seed); }
- friend uint qHash(const RestorableId &key) noexcept(noexcept(qHash(key, 0U)))
- { return qHash(key, 0U); }
friend bool operator==(const RestorableId &lhs, const RestorableId &rhs) noexcept
{ return lhs.obj == rhs.obj && lhs.prop == rhs.prop; }
friend bool operator!=(const RestorableId &lhs, const RestorableId &rhs) noexcept
diff --git a/src/corelib/text/qbytearray.cpp b/src/corelib/text/qbytearray.cpp
index 52bde98b62..b778316a15 100644
--- a/src/corelib/text/qbytearray.cpp
+++ b/src/corelib/text/qbytearray.cpp
@@ -5028,7 +5028,7 @@ QByteArray QByteArray::toPercentEncoding(const QByteArray &exclude, const QByteA
Returns the hash value for \a key, using
\a seed to seed the calculation.
*/
-uint qHash(const QByteArray::FromBase64Result &key, uint seed) noexcept
+size_t qHash(const QByteArray::FromBase64Result &key, size_t seed) noexcept
{
QtPrivate::QHashCombine hash;
seed = hash(seed, key.decoded);
diff --git a/src/corelib/text/qbytearray.h b/src/corelib/text/qbytearray.h
index d260a9d678..55d4c87e92 100644
--- a/src/corelib/text/qbytearray.h
+++ b/src/corelib/text/qbytearray.h
@@ -697,7 +697,7 @@ inline bool operator!=(const QByteArray::FromBase64Result &lhs, const QByteArray
return !operator==(lhs, rhs);
}
-Q_CORE_EXPORT Q_DECL_PURE_FUNCTION uint qHash(const QByteArray::FromBase64Result &key, uint seed = 0) noexcept;
+Q_CORE_EXPORT Q_DECL_PURE_FUNCTION size_t qHash(const QByteArray::FromBase64Result &key, size_t seed = 0) noexcept;
QT_END_NAMESPACE
diff --git a/src/corelib/text/qlocale.cpp b/src/corelib/text/qlocale.cpp
index 9e3043046d..4af039298f 100644
--- a/src/corelib/text/qlocale.cpp
+++ b/src/corelib/text/qlocale.cpp
@@ -1089,7 +1089,7 @@ bool QLocale::operator!=(const QLocale &other) const
Returns the hash value for \a key, using
\a seed to seed the calculation.
*/
-uint qHash(const QLocale &key, uint seed) noexcept
+size_t qHash(const QLocale &key, size_t seed) noexcept
{
QtPrivate::QHashCombine hash;
seed = hash(seed, key.d->m_data);
diff --git a/src/corelib/text/qlocale.h b/src/corelib/text/qlocale.h
index 45e39aa60d..e501a33764 100644
--- a/src/corelib/text/qlocale.h
+++ b/src/corelib/text/qlocale.h
@@ -59,7 +59,7 @@ class QTextStreamPrivate;
class QLocalePrivate;
-Q_CORE_EXPORT uint qHash(const QLocale &key, uint seed = 0) noexcept;
+Q_CORE_EXPORT size_t qHash(const QLocale &key, size_t seed = 0) noexcept;
class Q_CORE_EXPORT QLocale
{
@@ -1131,7 +1131,7 @@ private:
friend class QSystemLocale;
friend class QCalendarBackend;
friend class QGregorianCalendar;
- friend Q_CORE_EXPORT uint qHash(const QLocale &key, uint seed) noexcept;
+ friend Q_CORE_EXPORT size_t qHash(const QLocale &key, size_t seed) noexcept;
QSharedDataPointer<QLocalePrivate> d;
};
diff --git a/src/corelib/text/qregexp.cpp b/src/corelib/text/qregexp.cpp
index 3b6cdb133a..eac529e5b7 100644
--- a/src/corelib/text/qregexp.cpp
+++ b/src/corelib/text/qregexp.cpp
@@ -891,7 +891,7 @@ static bool operator==(const QRegExpEngineKey &key1, const QRegExpEngineKey &key
&& key1.cs == key2.cs;
}
-static uint qHash(const QRegExpEngineKey &key, uint seed = 0) noexcept
+static size_t qHash(const QRegExpEngineKey &key, size_t seed = 0) noexcept
{
QtPrivate::QHashCombine hash;
seed = hash(seed, key.pattern);
@@ -4041,7 +4041,7 @@ bool QRegExp::operator==(const QRegExp &rx) const
Returns the hash value for \a key, using
\a seed to seed the calculation.
*/
-uint qHash(const QRegExp &key, uint seed) noexcept
+size_t qHash(const QRegExp &key, size_t seed) noexcept
{
QtPrivate::QHashCombine hash;
seed = hash(seed, key.priv->engineKey);
diff --git a/src/corelib/text/qregexp.h b/src/corelib/text/qregexp.h
index 8f6de24c74..b42214f1db 100644
--- a/src/corelib/text/qregexp.h
+++ b/src/corelib/text/qregexp.h
@@ -53,7 +53,7 @@ struct QRegExpPrivate;
class QStringList;
class QRegExp;
-Q_CORE_EXPORT uint qHash(const QRegExp &key, uint seed = 0) noexcept;
+Q_CORE_EXPORT size_t qHash(const QRegExp &key, size_t seed = 0) noexcept;
class Q_CORE_EXPORT QRegExp
{
@@ -110,7 +110,7 @@ public:
static QString escape(const QString &str);
- friend Q_CORE_EXPORT uint qHash(const QRegExp &key, uint seed) noexcept;
+ friend Q_CORE_EXPORT size_t qHash(const QRegExp &key, size_t seed) noexcept;
private:
QRegExpPrivate *priv;
diff --git a/src/corelib/text/qregularexpression.cpp b/src/corelib/text/qregularexpression.cpp
index 6544abb646..77aad5e294 100644
--- a/src/corelib/text/qregularexpression.cpp
+++ b/src/corelib/text/qregularexpression.cpp
@@ -1828,7 +1828,7 @@ bool QRegularExpression::operator==(const QRegularExpression &re) const
Returns the hash value for \a key, using
\a seed to seed the calculation.
*/
-uint qHash(const QRegularExpression &key, uint seed) noexcept
+size_t qHash(const QRegularExpression &key, size_t seed) noexcept
{
QtPrivate::QHashCombine hash;
seed = hash(seed, key.d->pattern);
diff --git a/src/corelib/text/qregularexpression.h b/src/corelib/text/qregularexpression.h
index 9f618bf7f5..aa6c48bf54 100644
--- a/src/corelib/text/qregularexpression.h
+++ b/src/corelib/text/qregularexpression.h
@@ -59,7 +59,7 @@ class QRegularExpressionMatchIterator;
struct QRegularExpressionPrivate;
class QRegularExpression;
-Q_CORE_EXPORT uint qHash(const QRegularExpression &key, uint seed = 0) noexcept;
+Q_CORE_EXPORT size_t qHash(const QRegularExpression &key, size_t seed = 0) noexcept;
class Q_CORE_EXPORT QRegularExpression
{
@@ -167,7 +167,7 @@ private:
friend class QRegularExpressionMatch;
friend struct QRegularExpressionMatchPrivate;
friend class QRegularExpressionMatchIterator;
- friend Q_CORE_EXPORT uint qHash(const QRegularExpression &key, uint seed) noexcept;
+ friend Q_CORE_EXPORT size_t qHash(const QRegularExpression &key, size_t seed) noexcept;
QRegularExpression(QRegularExpressionPrivate &dd);
QExplicitlySharedDataPointer<QRegularExpressionPrivate> d;
diff --git a/src/corelib/time/qcalendar.cpp b/src/corelib/time/qcalendar.cpp
index 02788f5e23..7b50eb008c 100644
--- a/src/corelib/time/qcalendar.cpp
+++ b/src/corelib/time/qcalendar.cpp
@@ -61,7 +61,7 @@ inline bool operator==(const CalendarName &u, const CalendarName &v)
return u.compare(v, Qt::CaseInsensitive) == 0;
}
-inline uint qHash(const CalendarName &key, uint seed = 0) noexcept
+inline size_t qHash(const CalendarName &key, size_t seed = 0) noexcept
{
return qHash(key.toLower(), seed);
}
diff --git a/src/corelib/time/qdatetime.cpp b/src/corelib/time/qdatetime.cpp
index 5cd410c0b0..15654117a9 100644
--- a/src/corelib/time/qdatetime.cpp
+++ b/src/corelib/time/qdatetime.cpp
@@ -5950,13 +5950,13 @@ QDebug operator<<(QDebug dbg, const QDateTime &date)
}
#endif // debug_stream && datestring
-/*! \fn uint qHash(const QDateTime &key, uint seed = 0)
+/*! \fn size_t qHash(const QDateTime &key, size_t seed = 0)
\relates QHash
\since 5.0
Returns the hash value for the \a key, using \a seed to seed the calculation.
*/
-uint qHash(const QDateTime &key, uint seed)
+size_t qHash(const QDateTime &key, size_t seed)
{
// Use to toMSecsSinceEpoch instead of individual qHash functions for
// QDate/QTime/spec/offset because QDateTime::operator== converts both arguments
@@ -5965,24 +5965,24 @@ uint qHash(const QDateTime &key, uint seed)
return key.isValid() ? qHash(key.toMSecsSinceEpoch(), seed) : seed;
}
-/*! \fn uint qHash(QDate key, uint seed = 0)
+/*! \fn size_t qHash(QDate key, size_t seed = 0)
\relates QHash
\since 5.0
Returns the hash value for the \a key, using \a seed to seed the calculation.
*/
-uint qHash(QDate key, uint seed) noexcept
+size_t qHash(QDate key, size_t seed) noexcept
{
return qHash(key.toJulianDay(), seed);
}
-/*! \fn uint qHash(QTime key, uint seed = 0)
+/*! \fn size_t qHash(QTime key, size_t seed = 0)
\relates QHash
\since 5.0
Returns the hash value for the \a key, using \a seed to seed the calculation.
*/
-uint qHash(QTime key, uint seed) noexcept
+size_t qHash(QTime key, size_t seed) noexcept
{
return qHash(key.msecsSinceStartOfDay(), seed);
}
diff --git a/src/corelib/time/qdatetime.h b/src/corelib/time/qdatetime.h
index b1a3e0b1d6..52524f70a4 100644
--- a/src/corelib/time/qdatetime.h
+++ b/src/corelib/time/qdatetime.h
@@ -447,9 +447,9 @@ Q_CORE_EXPORT QDebug operator<<(QDebug, const QDateTime &);
// QDateTime is not noexcept for now -- to be revised once
// timezone and calendaring support is added
-Q_CORE_EXPORT uint qHash(const QDateTime &key, uint seed = 0);
-Q_CORE_EXPORT uint qHash(QDate key, uint seed = 0) noexcept;
-Q_CORE_EXPORT uint qHash(QTime key, uint seed = 0) noexcept;
+Q_CORE_EXPORT size_t qHash(const QDateTime &key, size_t seed = 0);
+Q_CORE_EXPORT size_t qHash(QDate key, size_t seed = 0) noexcept;
+Q_CORE_EXPORT size_t qHash(QTime key, size_t seed = 0) noexcept;
QT_END_NAMESPACE
diff --git a/src/corelib/tools/qbitarray.h b/src/corelib/tools/qbitarray.h
index ac3a8771d9..e8ef032c24 100644
--- a/src/corelib/tools/qbitarray.h
+++ b/src/corelib/tools/qbitarray.h
@@ -50,7 +50,7 @@ class Q_CORE_EXPORT QBitArray
{
friend Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QBitArray &);
friend Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QBitArray &);
- friend Q_CORE_EXPORT uint qHash(const QBitArray &key, uint seed) noexcept;
+ friend Q_CORE_EXPORT size_t qHash(const QBitArray &key, size_t seed) noexcept;
QByteArray d;
public:
diff --git a/src/corelib/tools/qhash.cpp b/src/corelib/tools/qhash.cpp
index f053341afd..ab699a7f94 100644
--- a/src/corelib/tools/qhash.cpp
+++ b/src/corelib/tools/qhash.cpp
@@ -210,11 +210,6 @@ static inline uint hash(const uchar *p, size_t len, uint seed) noexcept
return h;
}
-uint qHashBits(const void *p, size_t len, uint seed) noexcept
-{
- return hash(static_cast<const uchar*>(p), int(len), seed);
-}
-
static inline uint hash(const QChar *p, size_t len, uint seed) noexcept
{
uint h = seed;
@@ -228,33 +223,38 @@ static inline uint hash(const QChar *p, size_t len, uint seed) noexcept
return h;
}
-uint qHash(const QByteArray &key, uint seed) noexcept
+size_t qHashBits(const void *p, size_t size, size_t seed) noexcept
+{
+ return hash(static_cast<const uchar*>(p), int(size), static_cast<uint>(seed));
+}
+
+
+size_t qHash(const QByteArray &key, size_t seed) noexcept
{
return hash(reinterpret_cast<const uchar *>(key.constData()), size_t(key.size()), seed);
}
#if QT_STRINGVIEW_LEVEL < 2
-uint qHash(const QString &key, uint seed) noexcept
+size_t qHash(const QString &key, size_t seed) noexcept
{
return hash(key.unicode(), size_t(key.size()), seed);
}
-uint qHash(const QStringRef &key, uint seed) noexcept
+size_t qHash(const QStringRef &key, size_t seed) noexcept
{
return hash(key.unicode(), size_t(key.size()), seed);
}
#endif
-uint qHash(QStringView key, uint seed) noexcept
+size_t qHash(QStringView key, size_t seed) noexcept
{
return hash(key.data(), key.size(), seed);
}
-uint qHash(const QBitArray &bitArray, uint seed) noexcept
+size_t qHash(const QBitArray &bitArray, size_t seed) noexcept
{
int m = bitArray.d.size() - 1;
- uint result = hash(reinterpret_cast<const uchar *>(bitArray.d.constData()),
- size_t(qMax(0, m)), seed);
+ size_t result = qHashBits(reinterpret_cast<const uchar *>(bitArray.d.constData()), size_t(qMax(0, m)), seed);
// deal with the last 0 to 7 bits manually, because we can't trust that
// the padding is initialized to 0 in bitArray.d
@@ -264,7 +264,7 @@ uint qHash(const QBitArray &bitArray, uint seed) noexcept
return result;
}
-uint qHash(QLatin1String key, uint seed) noexcept
+size_t qHash(QLatin1String key, size_t seed) noexcept
{
return hash(reinterpret_cast<const uchar *>(key.data()), size_t(key.size()), seed);
}
@@ -406,7 +406,7 @@ uint qt_hash(QStringView key, uint chained) noexcept
}
/*!
- \fn template <typename T1, typename T2> uint qHash(const QPair<T1, T2> &key, uint seed = 0)
+ \fn template <typename T1, typename T2> size_t qHash(const QPair<T1, T2> &key, size_t seed = 0)
\since 5.0
\relates QHash
@@ -416,7 +416,7 @@ uint qt_hash(QStringView key, uint chained) noexcept
*/
/*!
- \fn template <typename T1, typename T2> uint qHash(const std::pair<T1, T2> &key, uint seed = 0)
+ \fn template <typename T1, typename T2> size_t qHash(const std::pair<T1, T2> &key, size_t seed = 0)
\since 5.7
\relates QHash
@@ -430,7 +430,7 @@ uint qt_hash(QStringView key, uint chained) noexcept
constraints, we cannot change the QPair algorithm to match the std::pair one before Qt 6.
*/
-/*! \fn template <typename InputIterator> uint qHashRange(InputIterator first, InputIterator last, uint seed = 0)
+/*! \fn template <typename InputIterator> size_t qHashRange(InputIterator first, InputIterator last, size_t seed = 0)
\relates QHash
\since 5.5
@@ -465,7 +465,7 @@ uint qt_hash(QStringView key, uint chained) noexcept
\sa qHashBits(), qHashRangeCommutative()
*/
-/*! \fn template <typename InputIterator> uint qHashRangeCommutative(InputIterator first, InputIterator last, uint seed = 0)
+/*! \fn template <typename InputIterator> size_t qHashRangeCommutative(InputIterator first, InputIterator last, size_t seed = 0)
\relates QHash
\since 5.5
@@ -501,7 +501,7 @@ uint qt_hash(QStringView key, uint chained) noexcept
\sa qHashBits(), qHashRange()
*/
-/*! \fn uint qHashBits(const void *p, size_t len, uint seed = 0)
+/*! \fn size_t qHashBits(const void *p, size_t len, size_t seed = 0)
\relates QHash
\since 5.4
@@ -526,77 +526,77 @@ uint qt_hash(QStringView key, uint chained) noexcept
\sa qHashRange(), qHashRangeCommutative()
*/
-/*! \fn uint qHash(char key, uint seed = 0)
+/*! \fn size_t qHash(char key, size_t seed = 0)
\relates QHash
\since 5.0
Returns the hash value for the \a key, using \a seed to seed the calculation.
*/
-/*! \fn uint qHash(uchar key, uint seed = 0)
+/*! \fn size_t qHash(uchar key, size_t seed = 0)
\relates QHash
\since 5.0
Returns the hash value for the \a key, using \a seed to seed the calculation.
*/
-/*! \fn uint qHash(signed char key, uint seed = 0)
+/*! \fn size_t qHash(signed char key, size_t seed = 0)
\relates QHash
\since 5.0
Returns the hash value for the \a key, using \a seed to seed the calculation.
*/
-/*! \fn uint qHash(ushort key, uint seed = 0)
+/*! \fn size_t qHash(ushort key, size_t seed = 0)
\relates QHash
\since 5.0
Returns the hash value for the \a key, using \a seed to seed the calculation.
*/
-/*! \fn uint qHash(short key, uint seed = 0)
+/*! \fn size_t qHash(short key, size_t seed = 0)
\relates QHash
\since 5.0
Returns the hash value for the \a key, using \a seed to seed the calculation.
*/
-/*! \fn uint qHash(uint key, uint seed = 0)
+/*! \fn size_t qHash(uint key, size_t seed = 0)
\relates QHash
\since 5.0
Returns the hash value for the \a key, using \a seed to seed the calculation.
*/
-/*! \fn uint qHash(int key, uint seed = 0)
+/*! \fn size_t qHash(int key, size_t seed = 0)
\relates QHash
\since 5.0
Returns the hash value for the \a key, using \a seed to seed the calculation.
*/
-/*! \fn uint qHash(ulong key, uint seed = 0)
+/*! \fn size_t qHash(ulong key, size_t seed = 0)
\relates QHash
\since 5.0
Returns the hash value for the \a key, using \a seed to seed the calculation.
*/
-/*! \fn uint qHash(long key, uint seed = 0)
+/*! \fn size_t qHash(long key, size_t seed = 0)
\relates QHash
\since 5.0
Returns the hash value for the \a key, using \a seed to seed the calculation.
*/
-/*! \fn uint qHash(quint64 key, uint seed = 0)
+/*! \fn size_t qHash(quint64 key, size_t seed = 0)
\relates QHash
\since 5.0
Returns the hash value for the \a key, using \a seed to seed the calculation.
*/
-/*! \fn uint qHash(qint64 key, uint seed = 0)
+/*! \fn size_t qHash(qint64 key, size_t seed = 0)
\relates QHash
\since 5.0
@@ -608,7 +608,7 @@ uint qt_hash(QStringView key, uint chained) noexcept
Returns the hash value for the \a key, using \a seed to seed the calculation.
*/
-uint qHash(float key, uint seed) noexcept
+size_t qHash(float key, size_t seed) noexcept
{
return key != 0.0f ? hash(reinterpret_cast<const uchar *>(&key), sizeof(key), seed) : seed ;
}
@@ -618,7 +618,7 @@ uint qHash(float key, uint seed) noexcept
Returns the hash value for the \a key, using \a seed to seed the calculation.
*/
-uint qHash(double key, uint seed) noexcept
+size_t qHash(double key, size_t seed) noexcept
{
return key != 0.0 ? hash(reinterpret_cast<const uchar *>(&key), sizeof(key), seed) : seed ;
}
@@ -629,62 +629,62 @@ uint qHash(double key, uint seed) noexcept
Returns the hash value for the \a key, using \a seed to seed the calculation.
*/
-uint qHash(long double key, uint seed) noexcept
+size_t qHash(long double key, size_t seed) noexcept
{
return key != 0.0L ? hash(reinterpret_cast<const uchar *>(&key), sizeof(key), seed) : seed ;
}
#endif
-/*! \fn uint qHash(const QChar key, uint seed = 0)
+/*! \fn size_t qHash(const QChar key, size_t seed = 0)
\relates QHash
\since 5.0
Returns the hash value for the \a key, using \a seed to seed the calculation.
*/
-/*! \fn uint qHash(const QByteArray &key, uint seed = 0)
+/*! \fn size_t qHash(const QByteArray &key, size_t seed = 0)
\relates QHash
\since 5.0
Returns the hash value for the \a key, using \a seed to seed the calculation.
*/
-/*! \fn uint qHash(const QBitArray &key, uint seed = 0)
+/*! \fn size_t qHash(const QBitArray &key, size_t seed = 0)
\relates QHash
\since 5.0
Returns the hash value for the \a key, using \a seed to seed the calculation.
*/
-/*! \fn uint qHash(const QString &key, uint seed = 0)
+/*! \fn size_t qHash(const QString &key, size_t seed = 0)
\relates QHash
\since 5.0
Returns the hash value for the \a key, using \a seed to seed the calculation.
*/
-/*! \fn uint qHash(const QStringRef &key, uint seed = 0)
+/*! \fn size_t qHash(const QStringRef &key, size_t seed = 0)
\relates QHash
\since 5.0
Returns the hash value for the \a key, using \a seed to seed the calculation.
*/
-/*! \fn uint qHash(QStringView key, uint seed = 0)
+/*! \fn size_t qHash(QStringView key, size_t seed = 0)
\relates QStringView
\since 5.10
Returns the hash value for the \a key, using \a seed to seed the calculation.
*/
-/*! \fn uint qHash(QLatin1String key, uint seed = 0)
+/*! \fn size_t qHash(QLatin1String key, size_t seed = 0)
\relates QHash
\since 5.0
Returns the hash value for the \a key, using \a seed to seed the calculation.
*/
-/*! \fn template <class T> uint qHash(const T *key, uint seed = 0)
+/*! \fn template <class T> size_t qHash(const T *key, size_t seed = 0)
\relates QHash
\since 5.0
@@ -2855,7 +2855,7 @@ uint qHash(long double key, uint seed) noexcept
*/
/*!
- \fn template <class Key, class T> uint qHash(const QHash<Key, T> &key, uint seed = 0)
+ \fn template <class Key, class T> size_t qHash(const QHash<Key, T> &key, size_t seed = 0)
\since 5.8
\relates QHash
@@ -2865,7 +2865,7 @@ uint qHash(long double key, uint seed) noexcept
*/
/*!
- \fn template <class Key, class T> uint qHash(const QMultiHash<Key, T> &key, uint seed = 0)
+ \fn template <class Key, class T> size_t qHash(const QMultiHash<Key, T> &key, size_t seed = 0)
\since 5.8
\relates QMultiHash
diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h
index d5d13f7bf3..1d3f84d0ec 100644
--- a/src/corelib/tools/qhash.h
+++ b/src/corelib/tools/qhash.h
@@ -2011,7 +2011,7 @@ public:
#endif // !QT_NO_JAVA_STYLE_ITERATORS
template <class Key, class T>
-uint qHash(const QHash<Key, T> &key, uint seed = 0)
+size_t qHash(const QHash<Key, T> &key, size_t seed = 0)
noexcept(noexcept(qHash(std::declval<Key&>())) && noexcept(qHash(std::declval<T&>())))
{
QtPrivate::QHashCombineCommutative hash;
@@ -2024,7 +2024,7 @@ uint qHash(const QHash<Key, T> &key, uint seed = 0)
}
template <class Key, class T>
-inline uint qHash(const QMultiHash<Key, T> &key, uint seed = 0)
+inline size_t qHash(const QMultiHash<Key, T> &key, size_t seed = 0)
noexcept(noexcept(qHash(std::declval<Key&>())) && noexcept(qHash(std::declval<T&>())))
{
const QHash<Key, T> &key2 = key;
diff --git a/src/corelib/tools/qhashfunctions.h b/src/corelib/tools/qhashfunctions.h
index 2e62e93ac4..de3a456f4b 100644
--- a/src/corelib/tools/qhashfunctions.h
+++ b/src/corelib/tools/qhashfunctions.h
@@ -70,7 +70,7 @@ Q_CORE_EXPORT void qSetGlobalQHashSeed(int newSeed);
namespace QHashPrivate {
-Q_DECL_CONST_FUNCTION constexpr uint hash(size_t key, uint seed) noexcept
+Q_DECL_CONST_FUNCTION constexpr size_t hash(size_t key, size_t seed) noexcept
{
key ^= seed;
if constexpr (sizeof(size_t) == 4) {
@@ -86,74 +86,74 @@ Q_DECL_CONST_FUNCTION constexpr uint hash(size_t key, uint seed) noexcept
key ^= key >> 32;
key *= UINT64_C(0xd6e8feb86659fd93);
key ^= key >> 32;
- return uint(key);
+ return key;
}
}
}
-Q_CORE_EXPORT Q_DECL_PURE_FUNCTION uint qHashBits(const void *p, size_t size, uint seed = 0) noexcept;
+Q_CORE_EXPORT Q_DECL_PURE_FUNCTION size_t qHashBits(const void *p, size_t size, size_t seed = 0) noexcept;
-Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qHash(char key, uint seed = 0) noexcept
+Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline size_t qHash(char key, size_t seed = 0) noexcept
{ return QHashPrivate::hash(size_t(key), seed); }
-Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qHash(uchar key, uint seed = 0) noexcept
+Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline size_t qHash(uchar key, size_t seed = 0) noexcept
{ return QHashPrivate::hash(size_t(key), seed); }
-Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qHash(signed char key, uint seed = 0) noexcept
+Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline size_t qHash(signed char key, size_t seed = 0) noexcept
{ return QHashPrivate::hash(size_t(key), seed); }
-Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qHash(ushort key, uint seed = 0) noexcept
+Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline size_t qHash(ushort key, size_t seed = 0) noexcept
{ return QHashPrivate::hash(size_t(key), seed); }
-Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qHash(short key, uint seed = 0) noexcept
+Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline size_t qHash(short key, size_t seed = 0) noexcept
{ return QHashPrivate::hash(size_t(key), seed); }
-Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qHash(uint key, uint seed = 0) noexcept
+Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline size_t qHash(uint key, size_t seed = 0) noexcept
{ return QHashPrivate::hash(size_t(key), seed); }
-Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qHash(int key, uint seed = 0) noexcept
+Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline size_t qHash(int key, size_t seed = 0) noexcept
{ return QHashPrivate::hash(size_t(key), seed); }
-Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qHash(ulong key, uint seed = 0) noexcept
+Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline size_t qHash(ulong key, size_t seed = 0) noexcept
{ return QHashPrivate::hash(size_t(key), seed); }
-Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qHash(long key, uint seed = 0) noexcept
+Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline size_t qHash(long key, size_t seed = 0) noexcept
{ return QHashPrivate::hash(size_t(key), seed); }
-Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qHash(quint64 key, uint seed = 0) noexcept
+Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline size_t qHash(quint64 key, size_t seed = 0) noexcept
{
if (sizeof(quint64) > sizeof(size_t))
key ^= (key >> 32);
return QHashPrivate::hash(size_t(key), seed);
}
-Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qHash(qint64 key, uint seed = 0) noexcept { return qHash(quint64(key), seed); }
-Q_CORE_EXPORT Q_DECL_CONST_FUNCTION uint qHash(float key, uint seed = 0) noexcept;
-Q_CORE_EXPORT Q_DECL_CONST_FUNCTION uint qHash(double key, uint seed = 0) noexcept;
+Q_DECL_CONST_FUNCTION constexpr inline size_t qHash(qint64 key, size_t seed = 0) noexcept { return qHash(quint64(key), seed); }
+Q_CORE_EXPORT Q_DECL_CONST_FUNCTION size_t qHash(float key, size_t seed = 0) noexcept;
+Q_CORE_EXPORT Q_DECL_CONST_FUNCTION size_t qHash(double key, size_t seed = 0) noexcept;
#if !defined(Q_OS_DARWIN) || defined(Q_CLANG_QDOC)
-Q_CORE_EXPORT Q_DECL_CONST_FUNCTION uint qHash(long double key, uint seed = 0) noexcept;
+Q_CORE_EXPORT Q_DECL_CONST_FUNCTION size_t qHash(long double key, size_t seed = 0) noexcept;
#endif
-Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qHash(const QChar key, uint seed = 0) noexcept { return qHash(key.unicode(), seed); }
-Q_CORE_EXPORT Q_DECL_PURE_FUNCTION uint qHash(const QByteArray &key, uint seed = 0) noexcept;
+Q_DECL_CONST_FUNCTION constexpr inline size_t qHash(const QChar key, size_t seed = 0) noexcept { return qHash(key.unicode(), seed); }
+Q_CORE_EXPORT Q_DECL_PURE_FUNCTION size_t qHash(const QByteArray &key, size_t seed = 0) noexcept;
#if QT_STRINGVIEW_LEVEL < 2
-Q_CORE_EXPORT Q_DECL_PURE_FUNCTION uint qHash(const QString &key, uint seed = 0) noexcept;
-Q_CORE_EXPORT Q_DECL_PURE_FUNCTION uint qHash(const QStringRef &key, uint seed = 0) noexcept;
+Q_CORE_EXPORT Q_DECL_PURE_FUNCTION size_t qHash(const QString &key, size_t seed = 0) noexcept;
+Q_CORE_EXPORT Q_DECL_PURE_FUNCTION size_t qHash(const QStringRef &key, size_t seed = 0) noexcept;
#endif
-Q_CORE_EXPORT Q_DECL_PURE_FUNCTION uint qHash(QStringView key, uint seed = 0) noexcept;
-Q_CORE_EXPORT Q_DECL_PURE_FUNCTION uint qHash(const QBitArray &key, uint seed = 0) noexcept;
-Q_CORE_EXPORT Q_DECL_PURE_FUNCTION uint qHash(QLatin1String key, uint seed = 0) noexcept;
+Q_CORE_EXPORT Q_DECL_PURE_FUNCTION size_t qHash(QStringView key, size_t seed = 0) noexcept;
+Q_CORE_EXPORT Q_DECL_PURE_FUNCTION size_t qHash(const QBitArray &key, size_t seed = 0) noexcept;
+Q_CORE_EXPORT Q_DECL_PURE_FUNCTION size_t qHash(QLatin1String key, size_t seed = 0) noexcept;
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION uint qt_hash(QStringView key, uint chained = 0) noexcept;
-Q_DECL_CONST_FUNCTION inline uint qHash(std::nullptr_t, uint seed = 0) noexcept
+Q_DECL_CONST_FUNCTION constexpr inline size_t qHash(std::nullptr_t, size_t seed = 0) noexcept
{
- return qHash(reinterpret_cast<quintptr>(nullptr), seed);
+ return seed;
}
-template <class T> inline uint qHash(const T *key, uint seed = 0) noexcept
+template <class T> inline size_t qHash(const T *key, size_t seed = 0) noexcept
{
return qHash(reinterpret_cast<quintptr>(key), seed);
}
-template<typename T> inline uint qHash(const T &t, uint seed)
+template<typename T> inline size_t qHash(const T &t, size_t seed)
noexcept(noexcept(qHash(t)))
{ return qHash(t) ^ seed; }
namespace QtPrivate {
struct QHashCombine {
- typedef uint result_type;
+ typedef size_t result_type;
template <typename T>
- Q_DECL_CONSTEXPR result_type operator()(uint seed, const T &t) const noexcept(noexcept(qHash(t)))
+ constexpr result_type operator()(size_t seed, const T &t) const noexcept(noexcept(qHash(t)))
// combiner taken from N3876 / boost::hash_combine
{ return seed ^ (qHash(t) + 0x9e3779b9 + (seed << 6) + (seed >> 2)) ; }
};
@@ -164,37 +164,38 @@ struct QHashCombineCommutative {
// usually what we want: {0,1,3} should hash differently than
// {1,3,0}. Except when it isn't (e.g. for QSet and
// QHash). Therefore, provide a commutative combiner, too.
- typedef uint result_type;
+ typedef size_t result_type;
template <typename T>
- Q_DECL_CONSTEXPR result_type operator()(uint seed, const T &t) const noexcept(noexcept(qHash(t)))
+ constexpr result_type operator()(size_t seed, const T &t) const noexcept(noexcept(qHash(t)))
{ return seed + qHash(t); } // don't use xor!
};
} // namespace QtPrivate
template <typename InputIterator>
-inline uint qHashRange(InputIterator first, InputIterator last, uint seed = 0)
+inline size_t qHashRange(InputIterator first, InputIterator last, size_t seed = 0)
noexcept(noexcept(qHash(*first))) // assume iterator operations don't throw
{
return std::accumulate(first, last, seed, QtPrivate::QHashCombine());
}
template <typename InputIterator>
-inline uint qHashRangeCommutative(InputIterator first, InputIterator last, uint seed = 0)
+inline size_t qHashRangeCommutative(InputIterator first, InputIterator last, size_t seed = 0)
noexcept(noexcept(qHash(*first))) // assume iterator operations don't throw
{
return std::accumulate(first, last, seed, QtPrivate::QHashCombineCommutative());
}
-template <typename T1, typename T2> inline uint qHash(const QPair<T1, T2> &key, uint seed = 0)
+template <typename T1, typename T2> inline size_t qHash(const QPair<T1, T2> &key, size_t seed = 0)
noexcept(noexcept(qHash(key.first, seed)) && noexcept(qHash(key.second, seed)))
{
- uint h1 = qHash(key.first, seed);
- uint h2 = qHash(key.second, seed);
- return ((h1 << 16) | (h1 >> 16)) ^ h2 ^ seed;
+ QtPrivate::QHashCombine hash;
+ seed = hash(seed, key.first);
+ seed = hash(seed, key.second);
+ return seed;
}
-template <typename T1, typename T2> inline uint qHash(const std::pair<T1, T2> &key, uint seed = 0)
+template <typename T1, typename T2> inline size_t qHash(const std::pair<T1, T2> &key, size_t seed = 0)
noexcept(noexcept(qHash(key.first, seed)) && noexcept(qHash(key.second, seed)))
{
QtPrivate::QHashCombine hash;
diff --git a/src/corelib/tools/qset.h b/src/corelib/tools/qset.h
index b631587177..f078e62999 100644
--- a/src/corelib/tools/qset.h
+++ b/src/corelib/tools/qset.h
@@ -230,7 +230,7 @@ QSet(InputIterator, InputIterator) -> QSet<ValueType>;
#endif
template <typename T>
-uint qHash(const QSet<T> &key, uint seed = 0)
+size_t qHash(const QSet<T> &key, size_t seed = 0)
noexcept(noexcept(qHashRangeCommutative(key.begin(), key.end(), seed)))
{
return qHashRangeCommutative(key.begin(), key.end(), seed);
diff --git a/src/corelib/tools/qset.qdoc b/src/corelib/tools/qset.qdoc
index 42dd1288ac..eb6b542181 100644
--- a/src/corelib/tools/qset.qdoc
+++ b/src/corelib/tools/qset.qdoc
@@ -1136,7 +1136,7 @@
*/
/*!
- \fn template <class T> uint qHash(const QSet<T> &key, uint seed = 0)
+ \fn template <class T> size_t qHash(const QSet<T> &key, size_t seed = 0)
\relates QHash
\since 5.5
diff --git a/src/corelib/tools/qshareddata.h b/src/corelib/tools/qshareddata.h
index f123f8e7b9..ef3e689e92 100644
--- a/src/corelib/tools/qshareddata.h
+++ b/src/corelib/tools/qshareddata.h
@@ -305,12 +305,12 @@ Q_INLINE_TEMPLATE void swap(QExplicitlySharedDataPointer<T> &p1, QExplicitlyShar
{ p1.swap(p2); }
template <class T>
-Q_INLINE_TEMPLATE uint qHash(const QSharedDataPointer<T> &ptr, uint seed = 0) noexcept
+Q_INLINE_TEMPLATE size_t qHash(const QSharedDataPointer<T> &ptr, size_t seed = 0) noexcept
{
return qHash(ptr.data(), seed);
}
template <class T>
-Q_INLINE_TEMPLATE uint qHash(const QExplicitlySharedDataPointer<T> &ptr, uint seed = 0) noexcept
+Q_INLINE_TEMPLATE size_t qHash(const QExplicitlySharedDataPointer<T> &ptr, size_t seed = 0) noexcept
{
return qHash(ptr.data(), seed);
}
diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h
index 362d57fb9a..b6aad5ff73 100644
--- a/src/corelib/tools/qsharedpointer_impl.h
+++ b/src/corelib/tools/qsharedpointer_impl.h
@@ -882,7 +882,7 @@ Q_INLINE_TEMPLATE bool operator<(T *ptr1, const QSharedPointer<X> &ptr2)
// qHash
//
template <class T>
-Q_INLINE_TEMPLATE uint qHash(const QSharedPointer<T> &ptr, uint seed = 0)
+Q_INLINE_TEMPLATE size_t qHash(const QSharedPointer<T> &ptr, size_t seed = 0)
{
return QT_PREPEND_NAMESPACE(qHash)(ptr.data(), seed);
}
diff --git a/src/corelib/tools/qvarlengtharray.h b/src/corelib/tools/qvarlengtharray.h
index a0de6bf2a1..cf5e2ee8c7 100644
--- a/src/corelib/tools/qvarlengtharray.h
+++ b/src/corelib/tools/qvarlengtharray.h
@@ -611,7 +611,7 @@ inline bool operator>=(const QVarLengthArray<T, Prealloc1> &lhs, const QVarLengt
}
template <typename T, qsizetype Prealloc>
-uint qHash(const QVarLengthArray<T, Prealloc> &key, uint seed = 0)
+size_t qHash(const QVarLengthArray<T, Prealloc> &key, size_t seed = 0)
noexcept(noexcept(qHashRange(key.cbegin(), key.cend(), seed)))
{
return qHashRange(key.cbegin(), key.cend(), seed);
diff --git a/src/corelib/tools/qvarlengtharray.qdoc b/src/corelib/tools/qvarlengtharray.qdoc
index a20583c73a..e43d6f152a 100644
--- a/src/corelib/tools/qvarlengtharray.qdoc
+++ b/src/corelib/tools/qvarlengtharray.qdoc
@@ -903,7 +903,7 @@
*/
/*!
- \fn template <typename T, qsizetype Prealloc> uint qHash(const QVarLengthArray<T, Prealloc> &key, uint seed = 0)
+ \fn template <typename T, qsizetype Prealloc> size_t qHash(const QVarLengthArray<T, Prealloc> &key, size_t seed = 0)
\relates QVarLengthArray
\since 5.14
diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h
index c4670a0817..f973907714 100644
--- a/src/corelib/tools/qvector.h
+++ b/src/corelib/tools/qvector.h
@@ -731,7 +731,7 @@ Q_DECLARE_SEQUENTIAL_ITERATOR(Vector)
Q_DECLARE_MUTABLE_SEQUENTIAL_ITERATOR(Vector)
template <typename T>
-uint qHash(const QVector<T> &key, uint seed = 0)
+size_t qHash(const QVector<T> &key, size_t seed = 0)
noexcept(noexcept(qHashRange(key.cbegin(), key.cend(), seed)))
{
return qHashRange(key.cbegin(), key.cend(), seed);
diff --git a/src/corelib/tools/qvector.qdoc b/src/corelib/tools/qvector.qdoc
index daa6ff95e9..cbb118ddb9 100644
--- a/src/corelib/tools/qvector.qdoc
+++ b/src/corelib/tools/qvector.qdoc
@@ -391,7 +391,7 @@
*/
/*!
- \fn template <typename T> uint qHash(const QVector<T> &key, uint seed = 0)
+ \fn template <typename T> size_t qHash(const QVector<T> &key, size_t seed = 0)
\since 5.6
\relates QVector
diff --git a/src/corelib/tools/qversionnumber.cpp b/src/corelib/tools/qversionnumber.cpp
index 0883896751..267f618020 100644
--- a/src/corelib/tools/qversionnumber.cpp
+++ b/src/corelib/tools/qversionnumber.cpp
@@ -541,14 +541,14 @@ QDebug operator<<(QDebug debug, const QVersionNumber &version)
#endif
/*!
- \fn uint qHash(const QVersionNumber &key, uint seed)
+ \fn size_t qHash(const QVersionNumber &key, size_t seed)
\relates QHash
\since 5.6
Returns the hash value for the \a key, using \a seed to seed the
calculation.
*/
-uint qHash(const QVersionNumber &key, uint seed)
+size_t qHash(const QVersionNumber &key, size_t seed)
{
QtPrivate::QHashCombine hash;
for (int i = 0; i < key.segmentCount(); ++i)
diff --git a/src/corelib/tools/qversionnumber.h b/src/corelib/tools/qversionnumber.h
index f31cdc92a6..c5756bdfb0 100644
--- a/src/corelib/tools/qversionnumber.h
+++ b/src/corelib/tools/qversionnumber.h
@@ -52,7 +52,7 @@
QT_BEGIN_NAMESPACE
class QVersionNumber;
-Q_CORE_EXPORT uint qHash(const QVersionNumber &key, uint seed = 0);
+Q_CORE_EXPORT size_t qHash(const QVersionNumber &key, size_t seed = 0);
#ifndef QT_NO_DATASTREAM
Q_CORE_EXPORT QDataStream& operator<<(QDataStream &out, const QVersionNumber &version);
@@ -283,7 +283,7 @@ private:
#ifndef QT_NO_DATASTREAM
friend Q_CORE_EXPORT QDataStream& operator>>(QDataStream &in, QVersionNumber &version);
#endif
- friend Q_CORE_EXPORT uint qHash(const QVersionNumber &key, uint seed);
+ friend Q_CORE_EXPORT size_t qHash(const QVersionNumber &key, size_t seed);
};
Q_DECLARE_TYPEINFO(QVersionNumber, Q_MOVABLE_TYPE);
diff --git a/src/dbus/qdbusextratypes.h b/src/dbus/qdbusextratypes.h
index 6bb12ffe49..d172d51294 100644
--- a/src/dbus/qdbusextratypes.h
+++ b/src/dbus/qdbusextratypes.h
@@ -105,7 +105,7 @@ inline bool operator!=(const QDBusObjectPath &lhs, const QDBusObjectPath &rhs)
inline bool operator<(const QDBusObjectPath &lhs, const QDBusObjectPath &rhs)
{ return lhs.path() < rhs.path(); }
-inline uint qHash(const QDBusObjectPath &objectPath, uint seed = 0)
+inline size_t qHash(const QDBusObjectPath &objectPath, size_t seed = 0)
{ return qHash(objectPath.path(), seed); }
@@ -158,7 +158,7 @@ inline bool operator!=(const QDBusSignature &lhs, const QDBusSignature &rhs)
inline bool operator<(const QDBusSignature &lhs, const QDBusSignature &rhs)
{ return lhs.signature() < rhs.signature(); }
-inline uint qHash(const QDBusSignature &signature, uint seed = 0)
+inline size_t qHash(const QDBusSignature &signature, size_t seed = 0)
{ return qHash(signature.signature(), seed); }
class QDBusVariant
diff --git a/src/gui/image/qpixmapcache.cpp b/src/gui/image/qpixmapcache.cpp
index 9709df9e0c..118d8c57e8 100644
--- a/src/gui/image/qpixmapcache.cpp
+++ b/src/gui/image/qpixmapcache.cpp
@@ -253,9 +253,9 @@ QT_BEGIN_INCLUDE_NAMESPACE
#include "qpixmapcache.moc"
QT_END_INCLUDE_NAMESPACE
-uint qHash(const QPixmapCache::Key &k)
+size_t qHash(const QPixmapCache::Key &k, size_t seed)
{
- return qHash(QPMCache::get(k)->key);
+ return qHash(QPMCache::get(k)->key, seed);
}
QPMCache::QPMCache()
diff --git a/src/gui/image/qpixmapcache_p.h b/src/gui/image/qpixmapcache_p.h
index ab8e2b7558..fce2b2d9a1 100644
--- a/src/gui/image/qpixmapcache_p.h
+++ b/src/gui/image/qpixmapcache_p.h
@@ -59,7 +59,7 @@
QT_BEGIN_NAMESPACE
-uint qHash(const QPixmapCache::Key &k);
+size_t qHash(const QPixmapCache::Key &k, size_t seed = 0);
class QPixmapCache::KeyData
{
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index dc49d8b324..834f969680 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -5231,7 +5231,7 @@ bool operator==(QPointingDeviceUniqueId lhs, QPointingDeviceUniqueId rhs) noexce
Returns the hash value for \a key, using \a seed to seed the calculation.
*/
-uint qHash(QPointingDeviceUniqueId key, uint seed) noexcept
+size_t qHash(QPointingDeviceUniqueId key, size_t seed) noexcept
{
return qHash(key.numericId(), seed);
}
diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h
index 05d79ad803..fb1df36848 100644
--- a/src/gui/kernel/qevent.h
+++ b/src/gui/kernel/qevent.h
@@ -831,7 +831,7 @@ Q_DECLARE_TYPEINFO(QPointingDeviceUniqueId, Q_MOVABLE_TYPE);
Q_GUI_EXPORT bool operator==(QPointingDeviceUniqueId lhs, QPointingDeviceUniqueId rhs) noexcept;
inline bool operator!=(QPointingDeviceUniqueId lhs, QPointingDeviceUniqueId rhs) noexcept
{ return !operator==(lhs, rhs); }
-Q_GUI_EXPORT uint qHash(QPointingDeviceUniqueId key, uint seed = 0) noexcept;
+Q_GUI_EXPORT size_t qHash(QPointingDeviceUniqueId key, size_t seed = 0) noexcept;
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 92256078dc..1d71c6d075 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -2749,9 +2749,9 @@ void QGuiApplicationPrivate::processContextMenuEvent(QWindowSystemInterfacePriva
}
#endif
-Q_GUI_EXPORT uint qHash(const QGuiApplicationPrivate::ActiveTouchPointsKey &k)
+Q_GUI_EXPORT size_t qHash(const QGuiApplicationPrivate::ActiveTouchPointsKey &k, size_t seed)
{
- return qHash(k.device) + k.touchPointId;
+ return (qHash(k.device) + k.touchPointId) ^ seed;
}
Q_GUI_EXPORT bool operator==(const QGuiApplicationPrivate::ActiveTouchPointsKey &a,
diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h
index ab1e6a46cd..8ce8f2b2d6 100644
--- a/src/gui/kernel/qguiapplication_p.h
+++ b/src/gui/kernel/qguiapplication_p.h
@@ -372,7 +372,7 @@ private:
static qreal m_maxDevicePixelRatio;
};
-Q_GUI_EXPORT uint qHash(const QGuiApplicationPrivate::ActiveTouchPointsKey &k);
+Q_GUI_EXPORT size_t qHash(const QGuiApplicationPrivate::ActiveTouchPointsKey &k, size_t seed = 0);
Q_GUI_EXPORT bool operator==(const QGuiApplicationPrivate::ActiveTouchPointsKey &a,
const QGuiApplicationPrivate::ActiveTouchPointsKey &b);
diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp
index cdcb6e8faf..cfc93eacac 100644
--- a/src/gui/kernel/qkeysequence.cpp
+++ b/src/gui/kernel/qkeysequence.cpp
@@ -1467,7 +1467,7 @@ bool QKeySequence::operator==(const QKeySequence &other) const
Calculates the hash value of \a key, using
\a seed to seed the calculation.
*/
-uint qHash(const QKeySequence &key, uint seed) noexcept
+size_t qHash(const QKeySequence &key, size_t seed) noexcept
{
return qHashRange(key.d->key, key.d->key + QKeySequencePrivate::MaxKeyCount, seed);
}
diff --git a/src/gui/kernel/qkeysequence.h b/src/gui/kernel/qkeysequence.h
index 68f256c37a..67c79519e6 100644
--- a/src/gui/kernel/qkeysequence.h
+++ b/src/gui/kernel/qkeysequence.h
@@ -65,7 +65,7 @@ void qt_set_sequence_auto_mnemonic(bool b);
class QVariant;
class QKeySequencePrivate;
-Q_GUI_EXPORT Q_DECL_PURE_FUNCTION uint qHash(const QKeySequence &key, uint seed = 0) noexcept;
+Q_GUI_EXPORT Q_DECL_PURE_FUNCTION size_t qHash(const QKeySequence &key, size_t seed = 0) noexcept;
class Q_GUI_EXPORT QKeySequence
{
@@ -211,7 +211,7 @@ private:
friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &in, const QKeySequence &ks);
friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &in, QKeySequence &ks);
- friend Q_GUI_EXPORT uint qHash(const QKeySequence &key, uint seed) noexcept;
+ friend Q_GUI_EXPORT size_t qHash(const QKeySequence &key, size_t seed) noexcept;
friend class QShortcutMap;
friend class QShortcut;
diff --git a/src/gui/opengl/qopengl_p.h b/src/gui/opengl/qopengl_p.h
index cda062eacf..07fd159ba8 100644
--- a/src/gui/opengl/qopengl_p.h
+++ b/src/gui/opengl/qopengl_p.h
@@ -133,9 +133,9 @@ inline bool operator!=(const QOpenGLConfig::Gpu &a, const QOpenGLConfig::Gpu &b)
return !a.equals(b);
}
-inline uint qHash(const QOpenGLConfig::Gpu &gpu)
+inline size_t qHash(const QOpenGLConfig::Gpu &gpu, size_t seed = 0)
{
- return qHash(gpu.vendorId) + qHash(gpu.deviceId) + qHash(gpu.driverVersion);
+ return (qHash(gpu.vendorId) + qHash(gpu.deviceId) + qHash(gpu.driverVersion)) ^ seed;
}
QT_END_NAMESPACE
diff --git a/src/gui/opengl/qopenglversionfunctions.h b/src/gui/opengl/qopenglversionfunctions.h
index 4835ea4871..f31db081bf 100644
--- a/src/gui/opengl/qopenglversionfunctions.h
+++ b/src/gui/opengl/qopenglversionfunctions.h
@@ -103,7 +103,7 @@ struct QOpenGLVersionStatus
OpenGLStatus status;
};
-inline uint qHash(const QOpenGLVersionStatus &v, uint seed = 0) noexcept
+inline size_t qHash(const QOpenGLVersionStatus &v, size_t seed = 0) noexcept
{
return qHash(static_cast<int>(v.status * 1000)
+ v.version.first * 100 + v.version.second * 10, seed);
diff --git a/src/gui/opengl/qopenglversionprofile.h b/src/gui/opengl/qopenglversionprofile.h
index f3b67e4eb5..7315f1a2cb 100644
--- a/src/gui/opengl/qopenglversionprofile.h
+++ b/src/gui/opengl/qopenglversionprofile.h
@@ -81,7 +81,7 @@ private:
QOpenGLVersionProfilePrivate* d;
};
-inline uint qHash(const QOpenGLVersionProfile &v, uint seed = 0)
+inline size_t qHash(const QOpenGLVersionProfile &v, size_t seed = 0)
{
return qHash(static_cast<int>(v.profile() * 1000)
+ v.version().first * 100 + v.version().second * 10, seed);
diff --git a/src/gui/painting/qicc.cpp b/src/gui/painting/qicc.cpp
index 2b5cd58fb1..e2257c27da 100644
--- a/src/gui/painting/qicc.cpp
+++ b/src/gui/painting/qicc.cpp
@@ -136,7 +136,7 @@ enum class Tag : quint32 {
aabg = IccTag('a', 'a', 'b', 'g'),
};
-inline uint qHash(const Tag &key, uint seed = 0)
+inline size_t qHash(const Tag &key, size_t seed = 0)
{
return qHash(quint32(key), seed);
}
diff --git a/src/gui/painting/qtextureglyphcache_p.h b/src/gui/painting/qtextureglyphcache_p.h
index b6fc7230a8..2f99f44741 100644
--- a/src/gui/painting/qtextureglyphcache_p.h
+++ b/src/gui/painting/qtextureglyphcache_p.h
@@ -156,7 +156,7 @@ protected:
int m_currentRowHeight; // Height of last row
};
-inline uint qHash(const QTextureGlyphCache::GlyphAndSubPixelPosition &g)
+inline size_t qHash(const QTextureGlyphCache::GlyphAndSubPixelPosition &g)
{
return (g.glyph << 8) | (g.subPixelPosition * 10).round().toInt();
}
diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp
index 4adc2b075e..41237592d5 100644
--- a/src/gui/painting/qtransform.cpp
+++ b/src/gui/painting/qtransform.cpp
@@ -783,7 +783,7 @@ bool QTransform::operator==(const QTransform &o) const
Returns the hash value for \a key, using
\a seed to seed the calculation.
*/
-uint qHash(const QTransform &key, uint seed) noexcept
+size_t qHash(const QTransform &key, size_t seed) noexcept
{
QtPrivate::QHashCombine hash;
seed = hash(seed, key.m11());
diff --git a/src/gui/painting/qtransform.h b/src/gui/painting/qtransform.h
index d235f15029..6e04559c1b 100644
--- a/src/gui/painting/qtransform.h
+++ b/src/gui/painting/qtransform.h
@@ -206,7 +206,7 @@ private:
};
Q_DECLARE_TYPEINFO(QTransform, Q_MOVABLE_TYPE);
-Q_GUI_EXPORT Q_DECL_CONST_FUNCTION uint qHash(const QTransform &key, uint seed = 0) noexcept;
+Q_GUI_EXPORT Q_DECL_CONST_FUNCTION size_t qHash(const QTransform &key, size_t seed = 0) noexcept;
/******* inlines *****/
inline QTransform::TransformationType QTransform::inline_type() const
diff --git a/src/gui/rhi/qrhi.cpp b/src/gui/rhi/qrhi.cpp
index 868ce62da2..7d2af37e96 100644
--- a/src/gui/rhi/qrhi.cpp
+++ b/src/gui/rhi/qrhi.cpp
@@ -711,7 +711,7 @@ bool operator!=(const QRhiDepthStencilClearValue &a, const QRhiDepthStencilClear
\relates QRhiDepthStencilClearValue
*/
-uint qHash(const QRhiDepthStencilClearValue &v, uint seed) Q_DECL_NOTHROW
+size_t qHash(const QRhiDepthStencilClearValue &v, size_t seed) Q_DECL_NOTHROW
{
return seed * (uint(qFloor(qreal(v.depthClearValue()) * 100)) + v.stencilClearValue());
}
@@ -807,7 +807,7 @@ bool operator!=(const QRhiViewport &a, const QRhiViewport &b) Q_DECL_NOTHROW
\relates QRhiViewport
*/
-uint qHash(const QRhiViewport &v, uint seed) Q_DECL_NOTHROW
+size_t qHash(const QRhiViewport &v, size_t seed) Q_DECL_NOTHROW
{
const std::array<float, 4> r = v.viewport();
return seed + uint(r[0]) + uint(r[1]) + uint(r[2]) + uint(r[3])
@@ -898,7 +898,7 @@ bool operator!=(const QRhiScissor &a, const QRhiScissor &b) Q_DECL_NOTHROW
\relates QRhiScissor
*/
-uint qHash(const QRhiScissor &v, uint seed) Q_DECL_NOTHROW
+size_t qHash(const QRhiScissor &v, size_t seed) Q_DECL_NOTHROW
{
const std::array<int, 4> r = v.scissor();
return seed + uint(r[0]) + uint(r[1]) + uint(r[2]) + uint(r[3]);
@@ -1032,7 +1032,7 @@ bool operator!=(const QRhiVertexInputBinding &a, const QRhiVertexInputBinding &b
\relates QRhiVertexInputBinding
*/
-uint qHash(const QRhiVertexInputBinding &v, uint seed) Q_DECL_NOTHROW
+size_t qHash(const QRhiVertexInputBinding &v, size_t seed) Q_DECL_NOTHROW
{
return seed + v.stride() + v.classification();
}
@@ -1185,7 +1185,7 @@ bool operator!=(const QRhiVertexInputAttribute &a, const QRhiVertexInputAttribut
\relates QRhiVertexInputAttribute
*/
-uint qHash(const QRhiVertexInputAttribute &v, uint seed) Q_DECL_NOTHROW
+size_t qHash(const QRhiVertexInputAttribute &v, size_t seed) Q_DECL_NOTHROW
{
return seed + uint(v.binding()) + uint(v.location()) + uint(v.format()) + v.offset();
}
@@ -1246,7 +1246,7 @@ bool operator!=(const QRhiVertexInputLayout &a, const QRhiVertexInputLayout &b)
\relates QRhiVertexInputLayout
*/
-uint qHash(const QRhiVertexInputLayout &v, uint seed) Q_DECL_NOTHROW
+size_t qHash(const QRhiVertexInputLayout &v, size_t seed) Q_DECL_NOTHROW
{
return qHash(v.m_bindings, seed) + qHash(v.m_attributes, seed);
}
@@ -1336,7 +1336,7 @@ bool operator!=(const QRhiShaderStage &a, const QRhiShaderStage &b) Q_DECL_NOTHR
\relates QRhiShaderStage
*/
-uint qHash(const QRhiShaderStage &v, uint seed) Q_DECL_NOTHROW
+size_t qHash(const QRhiShaderStage &v, size_t seed) Q_DECL_NOTHROW
{
return v.type() + qHash(v.shader(), seed) + v.shaderVariant();
}
@@ -3182,7 +3182,7 @@ bool operator!=(const QRhiShaderResourceBinding &a, const QRhiShaderResourceBind
\relates QRhiShaderResourceBinding
*/
-uint qHash(const QRhiShaderResourceBinding &b, uint seed) Q_DECL_NOTHROW
+size_t qHash(const QRhiShaderResourceBinding &b, size_t seed) Q_DECL_NOTHROW
{
const QRhiShaderResourceBinding::Data *d = b.data();
return seed + uint(d->binding) + 10 * uint(d->stage) + 100 * uint(d->type)
diff --git a/src/gui/rhi/qrhi_p.h b/src/gui/rhi/qrhi_p.h
index 9d906d7bbd..5c4cf4a144 100644
--- a/src/gui/rhi/qrhi_p.h
+++ b/src/gui/rhi/qrhi_p.h
@@ -94,7 +94,7 @@ Q_DECLARE_TYPEINFO(QRhiDepthStencilClearValue, Q_MOVABLE_TYPE);
Q_GUI_EXPORT bool operator==(const QRhiDepthStencilClearValue &a, const QRhiDepthStencilClearValue &b) Q_DECL_NOTHROW;
Q_GUI_EXPORT bool operator!=(const QRhiDepthStencilClearValue &a, const QRhiDepthStencilClearValue &b) Q_DECL_NOTHROW;
-Q_GUI_EXPORT uint qHash(const QRhiDepthStencilClearValue &v, uint seed = 0) Q_DECL_NOTHROW;
+Q_GUI_EXPORT size_t qHash(const QRhiDepthStencilClearValue &v, size_t seed = 0) Q_DECL_NOTHROW;
#ifndef QT_NO_DEBUG_STREAM
Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiDepthStencilClearValue &);
#endif
@@ -126,7 +126,7 @@ Q_DECLARE_TYPEINFO(QRhiViewport, Q_MOVABLE_TYPE);
Q_GUI_EXPORT bool operator==(const QRhiViewport &a, const QRhiViewport &b) Q_DECL_NOTHROW;
Q_GUI_EXPORT bool operator!=(const QRhiViewport &a, const QRhiViewport &b) Q_DECL_NOTHROW;
-Q_GUI_EXPORT uint qHash(const QRhiViewport &v, uint seed = 0) Q_DECL_NOTHROW;
+Q_GUI_EXPORT size_t qHash(const QRhiViewport &v, size_t seed = 0) Q_DECL_NOTHROW;
#ifndef QT_NO_DEBUG_STREAM
Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiViewport &);
#endif
@@ -150,7 +150,7 @@ Q_DECLARE_TYPEINFO(QRhiScissor, Q_MOVABLE_TYPE);
Q_GUI_EXPORT bool operator==(const QRhiScissor &a, const QRhiScissor &b) Q_DECL_NOTHROW;
Q_GUI_EXPORT bool operator!=(const QRhiScissor &a, const QRhiScissor &b) Q_DECL_NOTHROW;
-Q_GUI_EXPORT uint qHash(const QRhiScissor &v, uint seed = 0) Q_DECL_NOTHROW;
+Q_GUI_EXPORT size_t qHash(const QRhiScissor &v, size_t seed = 0) Q_DECL_NOTHROW;
#ifndef QT_NO_DEBUG_STREAM
Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiScissor &);
#endif
@@ -185,7 +185,7 @@ Q_DECLARE_TYPEINFO(QRhiVertexInputBinding, Q_MOVABLE_TYPE);
Q_GUI_EXPORT bool operator==(const QRhiVertexInputBinding &a, const QRhiVertexInputBinding &b) Q_DECL_NOTHROW;
Q_GUI_EXPORT bool operator!=(const QRhiVertexInputBinding &a, const QRhiVertexInputBinding &b) Q_DECL_NOTHROW;
-Q_GUI_EXPORT uint qHash(const QRhiVertexInputBinding &v, uint seed = 0) Q_DECL_NOTHROW;
+Q_GUI_EXPORT size_t qHash(const QRhiVertexInputBinding &v, size_t seed = 0) Q_DECL_NOTHROW;
#ifndef QT_NO_DEBUG_STREAM
Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiVertexInputBinding &);
#endif
@@ -229,7 +229,7 @@ Q_DECLARE_TYPEINFO(QRhiVertexInputAttribute, Q_MOVABLE_TYPE);
Q_GUI_EXPORT bool operator==(const QRhiVertexInputAttribute &a, const QRhiVertexInputAttribute &b) Q_DECL_NOTHROW;
Q_GUI_EXPORT bool operator!=(const QRhiVertexInputAttribute &a, const QRhiVertexInputAttribute &b) Q_DECL_NOTHROW;
-Q_GUI_EXPORT uint qHash(const QRhiVertexInputAttribute &v, uint seed = 0) Q_DECL_NOTHROW;
+Q_GUI_EXPORT size_t qHash(const QRhiVertexInputAttribute &v, size_t seed = 0) Q_DECL_NOTHROW;
#ifndef QT_NO_DEBUG_STREAM
Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiVertexInputAttribute &);
#endif
@@ -265,7 +265,7 @@ private:
QVarLengthArray<QRhiVertexInputAttribute, 8> m_attributes;
friend Q_GUI_EXPORT bool operator==(const QRhiVertexInputLayout &a, const QRhiVertexInputLayout &b) Q_DECL_NOTHROW;
- friend Q_GUI_EXPORT uint qHash(const QRhiVertexInputLayout &v, uint seed) Q_DECL_NOTHROW;
+ friend Q_GUI_EXPORT size_t qHash(const QRhiVertexInputLayout &v, size_t seed) Q_DECL_NOTHROW;
friend Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiVertexInputLayout &);
};
@@ -273,7 +273,7 @@ Q_DECLARE_TYPEINFO(QRhiVertexInputLayout, Q_MOVABLE_TYPE);
Q_GUI_EXPORT bool operator==(const QRhiVertexInputLayout &a, const QRhiVertexInputLayout &b) Q_DECL_NOTHROW;
Q_GUI_EXPORT bool operator!=(const QRhiVertexInputLayout &a, const QRhiVertexInputLayout &b) Q_DECL_NOTHROW;
-Q_GUI_EXPORT uint qHash(const QRhiVertexInputLayout &v, uint seed = 0) Q_DECL_NOTHROW;
+Q_GUI_EXPORT size_t qHash(const QRhiVertexInputLayout &v, size_t seed = 0) Q_DECL_NOTHROW;
#ifndef QT_NO_DEBUG_STREAM
Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiVertexInputLayout &);
#endif
@@ -310,7 +310,7 @@ Q_DECLARE_TYPEINFO(QRhiShaderStage, Q_MOVABLE_TYPE);
Q_GUI_EXPORT bool operator==(const QRhiShaderStage &a, const QRhiShaderStage &b) Q_DECL_NOTHROW;
Q_GUI_EXPORT bool operator!=(const QRhiShaderStage &a, const QRhiShaderStage &b) Q_DECL_NOTHROW;
-Q_GUI_EXPORT uint qHash(const QRhiShaderStage &s, uint seed = 0) Q_DECL_NOTHROW;
+Q_GUI_EXPORT size_t qHash(const QRhiShaderStage &s, size_t seed = 0) Q_DECL_NOTHROW;
#ifndef QT_NO_DEBUG_STREAM
Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiShaderStage &);
#endif
@@ -411,7 +411,7 @@ Q_DECLARE_TYPEINFO(QRhiShaderResourceBinding, Q_MOVABLE_TYPE);
Q_GUI_EXPORT bool operator==(const QRhiShaderResourceBinding &a, const QRhiShaderResourceBinding &b) Q_DECL_NOTHROW;
Q_GUI_EXPORT bool operator!=(const QRhiShaderResourceBinding &a, const QRhiShaderResourceBinding &b) Q_DECL_NOTHROW;
-Q_GUI_EXPORT uint qHash(const QRhiShaderResourceBinding &b, uint seed = 0) Q_DECL_NOTHROW;
+Q_GUI_EXPORT size_t qHash(const QRhiShaderResourceBinding &b, size_t seed = 0) Q_DECL_NOTHROW;
#ifndef QT_NO_DEBUG_STREAM
Q_GUI_EXPORT QDebug operator<<(QDebug, const QRhiShaderResourceBinding &);
#endif
diff --git a/src/gui/rhi/qshader.cpp b/src/gui/rhi/qshader.cpp
index 945f4820c2..83d62fc4eb 100644
--- a/src/gui/rhi/qshader.cpp
+++ b/src/gui/rhi/qshader.cpp
@@ -543,7 +543,7 @@ bool operator==(const QShader &lhs, const QShader &rhs) Q_DECL_NOTHROW
\relates QShader
*/
-uint qHash(const QShader &s, uint seed) Q_DECL_NOTHROW
+size_t qHash(const QShader &s, size_t seed) Q_DECL_NOTHROW
{
uint h = s.stage();
for (auto it = s.d->shaders.constBegin(), itEnd = s.d->shaders.constEnd(); it != itEnd; ++it)
@@ -596,7 +596,7 @@ bool operator==(const QShaderKey &lhs, const QShaderKey &rhs) Q_DECL_NOTHROW
\relates QShaderKey
*/
-uint qHash(const QShaderKey &k, uint seed) Q_DECL_NOTHROW
+size_t qHash(const QShaderKey &k, size_t seed) Q_DECL_NOTHROW
{
return seed + 10 * k.source() + k.sourceVersion().version() + k.sourceVersion().flags() + k.sourceVariant();
}
diff --git a/src/gui/rhi/qshader_p.h b/src/gui/rhi/qshader_p.h
index 4b561b6fa9..f2d3c4ac2f 100644
--- a/src/gui/rhi/qshader_p.h
+++ b/src/gui/rhi/qshader_p.h
@@ -158,7 +158,7 @@ private:
QShaderPrivate *d;
friend struct QShaderPrivate;
friend Q_GUI_EXPORT bool operator==(const QShader &, const QShader &) Q_DECL_NOTHROW;
- friend Q_GUI_EXPORT uint qHash(const QShader &, uint) Q_DECL_NOTHROW;
+ friend Q_GUI_EXPORT size_t qHash(const QShader &, size_t) Q_DECL_NOTHROW;
#ifndef QT_NO_DEBUG_STREAM
friend Q_GUI_EXPORT QDebug operator<<(QDebug, const QShader &);
#endif
@@ -190,7 +190,7 @@ private:
Q_DECLARE_TYPEINFO(QShaderKey, Q_MOVABLE_TYPE);
Q_GUI_EXPORT bool operator==(const QShader &lhs, const QShader &rhs) Q_DECL_NOTHROW;
-Q_GUI_EXPORT uint qHash(const QShader &s, uint seed = 0) Q_DECL_NOTHROW;
+Q_GUI_EXPORT size_t qHash(const QShader &s, size_t seed = 0) Q_DECL_NOTHROW;
inline bool operator!=(const QShader &lhs, const QShader &rhs) Q_DECL_NOTHROW
{
@@ -216,7 +216,7 @@ inline bool operator!=(const QShaderCode &lhs, const QShaderCode &rhs) Q_DECL_NO
return !(lhs == rhs);
}
-Q_GUI_EXPORT uint qHash(const QShaderKey &k, uint seed = 0) Q_DECL_NOTHROW;
+Q_GUI_EXPORT size_t qHash(const QShaderKey &k, size_t seed = 0) Q_DECL_NOTHROW;
#ifndef QT_NO_DEBUG_STREAM
Q_GUI_EXPORT QDebug operator<<(QDebug, const QShader &);
diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp
index 8f0d7d9d38..959566d4c1 100644
--- a/src/gui/text/qfont.cpp
+++ b/src/gui/text/qfont.cpp
@@ -2086,7 +2086,7 @@ QString QFont::toString() const
\relates QFont
\since 5.3
*/
-uint qHash(const QFont &font, uint seed) noexcept
+size_t qHash(const QFont &font, size_t seed) noexcept
{
return qHash(QFontPrivate::get(font)->request, seed);
}
diff --git a/src/gui/text/qfont.h b/src/gui/text/qfont.h
index e5734679ed..6317613b67 100644
--- a/src/gui/text/qfont.h
+++ b/src/gui/text/qfont.h
@@ -347,7 +347,7 @@ private:
Q_DECLARE_SHARED(QFont)
-Q_GUI_EXPORT uint qHash(const QFont &font, uint seed = 0) noexcept;
+Q_GUI_EXPORT size_t qHash(const QFont &font, size_t seed = 0) noexcept;
inline bool QFont::bold() const
{ return weight() > Medium; }
diff --git a/src/gui/text/qfont_p.h b/src/gui/text/qfont_p.h
index adbb7a0121..cc210a695b 100644
--- a/src/gui/text/qfont_p.h
+++ b/src/gui/text/qfont_p.h
@@ -136,7 +136,7 @@ struct QFontDef
}
};
-inline uint qHash(const QFontDef &fd, uint seed = 0) noexcept
+inline size_t qHash(const QFontDef &fd, size_t seed = 0) noexcept
{
QtPrivate::QHashCombine hash;
seed = hash(seed, qRound64(fd.pixelSize*10000)); // use only 4 fractional digits
diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h
index 03e14c737a..0fa8f8e826 100644
--- a/src/gui/text/qfontengine_p.h
+++ b/src/gui/text/qfontengine_p.h
@@ -399,7 +399,7 @@ inline bool operator ==(const QFontEngine::FaceId &f1, const QFontEngine::FaceId
return f1.index == f2.index && f1.encoding == f2.encoding && f1.filename == f2.filename && f1.uuid == f2.uuid;
}
-inline uint qHash(const QFontEngine::FaceId &f, uint seed = 0)
+inline size_t qHash(const QFontEngine::FaceId &f, size_t seed = 0)
noexcept(noexcept(qHash(f.filename)))
{
QtPrivate::QHashCombine hash;
diff --git a/src/gui/text/qrawfont.cpp b/src/gui/text/qrawfont.cpp
index b4b60cbaaf..cc96c9262b 100644
--- a/src/gui/text/qrawfont.cpp
+++ b/src/gui/text/qrawfont.cpp
@@ -323,7 +323,7 @@ bool QRawFont::operator==(const QRawFont &other) const
\relates QRawFont
\since 5.8
*/
-uint qHash(const QRawFont &font, uint seed) noexcept
+size_t qHash(const QRawFont &font, size_t seed) noexcept
{
return qHash(QRawFontPrivate::get(font)->fontEngine, seed);
}
diff --git a/src/gui/text/qrawfont.h b/src/gui/text/qrawfont.h
index c6289d6c93..823c92b050 100644
--- a/src/gui/text/qrawfont.h
+++ b/src/gui/text/qrawfont.h
@@ -156,7 +156,7 @@ Q_DECLARE_SHARED(QRawFont)
Q_DECLARE_OPERATORS_FOR_FLAGS(QRawFont::LayoutFlags)
-Q_GUI_EXPORT uint qHash(const QRawFont &font, uint seed = 0) noexcept;
+Q_GUI_EXPORT size_t qHash(const QRawFont &font, size_t seed = 0) noexcept;
inline QVector<QPointF> QRawFont::advancesForGlyphIndexes(const QVector<quint32> &glyphIndexes, QRawFont::LayoutFlags layoutFlags) const
{
diff --git a/src/gui/vulkan/qvulkaninstance.cpp b/src/gui/vulkan/qvulkaninstance.cpp
index 555dee3a9c..ddee0e47a4 100644
--- a/src/gui/vulkan/qvulkaninstance.cpp
+++ b/src/gui/vulkan/qvulkaninstance.cpp
@@ -358,7 +358,7 @@ QVulkanInstance::~QVulkanInstance()
*/
/*!
- \fn uint qHash(const QVulkanLayer &key, uint seed)
+ \fn size_t qHash(const QVulkanLayer &key, size_t seed)
\since 5.10
\relates QVulkanLayer
@@ -401,7 +401,7 @@ QVulkanInstance::~QVulkanInstance()
*/
/*!
- \fn uint qHash(const QVulkanExtension &key, uint seed)
+ \fn size_t qHash(const QVulkanExtension &key, size_t seed)
\since 5.10
\relates QVulkanExtension
diff --git a/src/gui/vulkan/qvulkaninstance.h b/src/gui/vulkan/qvulkaninstance.h
index 5b3db9a4c8..ea0b04da95 100644
--- a/src/gui/vulkan/qvulkaninstance.h
+++ b/src/gui/vulkan/qvulkaninstance.h
@@ -91,7 +91,7 @@ inline bool operator==(const QVulkanLayer &lhs, const QVulkanLayer &rhs) noexcep
inline bool operator!=(const QVulkanLayer &lhs, const QVulkanLayer &rhs) noexcept
{ return !(lhs == rhs); }
-inline uint qHash(const QVulkanLayer &key, uint seed = 0) noexcept
+inline size_t qHash(const QVulkanLayer &key, size_t seed = 0) noexcept
{
QtPrivate::QHashCombine hash;
seed = hash(seed, key.name);
@@ -114,7 +114,7 @@ inline bool operator==(const QVulkanExtension &lhs, const QVulkanExtension &rhs)
inline bool operator!=(const QVulkanExtension &lhs, const QVulkanExtension &rhs) noexcept
{ return !(lhs == rhs); }
-inline uint qHash(const QVulkanExtension &key, uint seed = 0) noexcept
+inline size_t qHash(const QVulkanExtension &key, size_t seed = 0) noexcept
{
QtPrivate::QHashCombine hash;
seed = hash(seed, key.name);
diff --git a/src/network/kernel/qhostaddress.cpp b/src/network/kernel/qhostaddress.cpp
index ed1c23ed6e..b9fc129685 100644
--- a/src/network/kernel/qhostaddress.cpp
+++ b/src/network/kernel/qhostaddress.cpp
@@ -1333,7 +1333,7 @@ QDebug operator<<(QDebug d, const QHostAddress &address)
\relates QHostAddress
Returns a hash of the host address \a key, using \a seed to seed the calculation.
*/
-uint qHash(const QHostAddress &key, uint seed) noexcept
+size_t qHash(const QHostAddress &key, size_t seed) noexcept
{
return qHashBits(key.d->a6.c, 16, seed);
}
diff --git a/src/network/kernel/qhostaddress.h b/src/network/kernel/qhostaddress.h
index 799247695e..ffa08aca30 100644
--- a/src/network/kernel/qhostaddress.h
+++ b/src/network/kernel/qhostaddress.h
@@ -66,7 +66,7 @@ typedef QIPv6Address Q_IPV6ADDR;
class QHostAddress;
// qHash is a friend, but we can't use default arguments for friends (§8.3.6.4)
-Q_NETWORK_EXPORT uint qHash(const QHostAddress &key, uint seed = 0) noexcept;
+Q_NETWORK_EXPORT size_t qHash(const QHostAddress &key, size_t seed = 0) noexcept;
class Q_NETWORK_EXPORT QHostAddress
{
@@ -154,7 +154,7 @@ public:
static QPair<QHostAddress, int> parseSubnet(const QString &subnet);
- friend Q_NETWORK_EXPORT uint qHash(const QHostAddress &key, uint seed) noexcept;
+ friend Q_NETWORK_EXPORT size_t qHash(const QHostAddress &key, size_t seed) noexcept;
protected:
friend class QHostAddressPrivate;
QExplicitlySharedDataPointer<QHostAddressPrivate> d;
diff --git a/src/network/ssl/qocspresponse.cpp b/src/network/ssl/qocspresponse.cpp
index bf27bb768b..fbbf8d9708 100644
--- a/src/network/ssl/qocspresponse.cpp
+++ b/src/network/ssl/qocspresponse.cpp
@@ -232,20 +232,20 @@ Q_NETWORK_EXPORT bool operator==(const QOcspResponse &lhs, const QOcspResponse &
*/
/*!
- \fn uint qHash(const QOcspResponse &response, uint seed)
+ \fn size_t qHash(const QOcspResponse &response, size_t seed)
Returns the hash value for the \a response, using \a seed to seed the calculation.
\since 5.13
\relates QHash
*/
-uint qHash(const QOcspResponse &response, uint seed) noexcept
+size_t qHash(const QOcspResponse &response, size_t seed) noexcept
{
const QOcspResponsePrivate *d = response.d.data();
Q_ASSERT(d);
QtPrivate::QHashCombine hasher;
- uint hash = hasher(seed, int(d->certificateStatus));
+ size_t hash = hasher(seed, int(d->certificateStatus));
hash = hasher(hash, int(d->revocationReason));
if (!d->signerCert.isNull())
hash = hasher(hash, d->signerCert);
diff --git a/src/network/ssl/qocspresponse.h b/src/network/ssl/qocspresponse.h
index cf6be5a369..1fc3377d58 100644
--- a/src/network/ssl/qocspresponse.h
+++ b/src/network/ssl/qocspresponse.h
@@ -73,7 +73,7 @@ enum class QOcspRevocationReason
};
class QOcspResponse;
-Q_NETWORK_EXPORT uint qHash(const QOcspResponse &response, uint seed = 0) noexcept;
+Q_NETWORK_EXPORT size_t qHash(const QOcspResponse &response, size_t seed = 0) noexcept;
class QOcspResponsePrivate;
class Q_NETWORK_EXPORT QOcspResponse
@@ -100,7 +100,7 @@ private:
friend class QSslSocketBackendPrivate;
friend Q_NETWORK_EXPORT bool operator==(const QOcspResponse &lhs, const QOcspResponse &rhs);
- friend Q_NETWORK_EXPORT uint qHash(const QOcspResponse &response, uint seed) noexcept;
+ friend Q_NETWORK_EXPORT size_t qHash(const QOcspResponse &response, size_t seed) noexcept;
QSharedDataPointer<QOcspResponsePrivate> d;
};
diff --git a/src/network/ssl/qsslcertificate.cpp b/src/network/ssl/qsslcertificate.cpp
index 28dda14436..bcfd2a349a 100644
--- a/src/network/ssl/qsslcertificate.cpp
+++ b/src/network/ssl/qsslcertificate.cpp
@@ -761,7 +761,7 @@ QString QSslCertificate::subjectDisplayName() const
}
/*!
- \fn uint qHash(const QSslCertificate &key, uint seed)
+ \fn size_t qHash(const QSslCertificate &key, size_t seed)
Returns the hash value for the \a key, using \a seed to seed the calculation.
\since 5.4
diff --git a/src/network/ssl/qsslcertificate.h b/src/network/ssl/qsslcertificate.h
index 4d3f7d8ddb..46119ae046 100644
--- a/src/network/ssl/qsslcertificate.h
+++ b/src/network/ssl/qsslcertificate.h
@@ -65,7 +65,7 @@ class QStringList;
class QSslCertificate;
// qHash is a friend, but we can't use default arguments for friends (§8.3.6.4)
-Q_NETWORK_EXPORT uint qHash(const QSslCertificate &key, uint seed = 0) noexcept;
+Q_NETWORK_EXPORT size_t qHash(const QSslCertificate &key, size_t seed = 0) noexcept;
class QSslCertificatePrivate;
class Q_NETWORK_EXPORT QSslCertificate
@@ -170,7 +170,7 @@ private:
friend class QSslCertificatePrivate;
friend class QSslSocketBackendPrivate;
- friend Q_NETWORK_EXPORT uint qHash(const QSslCertificate &key, uint seed) noexcept;
+ friend Q_NETWORK_EXPORT size_t qHash(const QSslCertificate &key, size_t seed) noexcept;
};
Q_DECLARE_SHARED(QSslCertificate)
diff --git a/src/network/ssl/qsslcertificate_openssl.cpp b/src/network/ssl/qsslcertificate_openssl.cpp
index 6f1fb26add..2bb7c930f2 100644
--- a/src/network/ssl/qsslcertificate_openssl.cpp
+++ b/src/network/ssl/qsslcertificate_openssl.cpp
@@ -72,7 +72,7 @@ bool QSslCertificate::operator==(const QSslCertificate &other) const
return false;
}
-uint qHash(const QSslCertificate &key, uint seed) noexcept
+size_t qHash(const QSslCertificate &key, size_t seed) noexcept
{
if (X509 * const x509 = key.d->x509) {
const EVP_MD *sha1 = q_EVP_sha1();
diff --git a/src/network/ssl/qsslcertificate_qt.cpp b/src/network/ssl/qsslcertificate_qt.cpp
index 8b5035ad96..33deaf558f 100644
--- a/src/network/ssl/qsslcertificate_qt.cpp
+++ b/src/network/ssl/qsslcertificate_qt.cpp
@@ -64,7 +64,7 @@ bool QSslCertificate::operator==(const QSslCertificate &other) const
return d->derData == other.d->derData;
}
-uint qHash(const QSslCertificate &key, uint seed) noexcept
+size_t qHash(const QSslCertificate &key, size_t seed) noexcept
{
// DER is the native encoding here, so toDer() is just "return d->derData":
return qHash(key.toDer(), seed);
diff --git a/src/network/ssl/qssldiffiehellmanparameters.cpp b/src/network/ssl/qssldiffiehellmanparameters.cpp
index 7807afaa30..c8f3e564a5 100644
--- a/src/network/ssl/qssldiffiehellmanparameters.cpp
+++ b/src/network/ssl/qssldiffiehellmanparameters.cpp
@@ -316,7 +316,7 @@ QDebug operator<<(QDebug debug, const QSslDiffieHellmanParameters &dhparam)
Returns an hash value for \a dhparam, using \a seed to seed
the calculation.
*/
-uint qHash(const QSslDiffieHellmanParameters &dhparam, uint seed) noexcept
+size_t qHash(const QSslDiffieHellmanParameters &dhparam, size_t seed) noexcept
{
return qHash(dhparam.d->derData, seed);
}
diff --git a/src/network/ssl/qssldiffiehellmanparameters.h b/src/network/ssl/qssldiffiehellmanparameters.h
index f62a3b8f44..6a3cf01ddc 100644
--- a/src/network/ssl/qssldiffiehellmanparameters.h
+++ b/src/network/ssl/qssldiffiehellmanparameters.h
@@ -56,7 +56,7 @@ class QSslDiffieHellmanParametersPrivate;
class QSslDiffieHellmanParameters;
// qHash is a friend, but we can't use default arguments for friends (§8.3.6.4)
-Q_NETWORK_EXPORT uint qHash(const QSslDiffieHellmanParameters &dhparam, uint seed = 0) noexcept;
+Q_NETWORK_EXPORT size_t qHash(const QSslDiffieHellmanParameters &dhparam, size_t seed = 0) noexcept;
#ifndef QT_NO_DEBUG_STREAM
class QDebug;
@@ -106,7 +106,7 @@ private:
#ifndef QT_NO_DEBUG_STREAM
friend Q_NETWORK_EXPORT QDebug operator<<(QDebug debug, const QSslDiffieHellmanParameters &dhparam);
#endif
- friend Q_NETWORK_EXPORT uint qHash(const QSslDiffieHellmanParameters &dhparam, uint seed) noexcept;
+ friend Q_NETWORK_EXPORT size_t qHash(const QSslDiffieHellmanParameters &dhparam, size_t seed) noexcept;
};
Q_DECLARE_SHARED(QSslDiffieHellmanParameters)
diff --git a/src/network/ssl/qsslellipticcurve.cpp b/src/network/ssl/qsslellipticcurve.cpp
index 5608d32fa7..f7faa607bd 100644
--- a/src/network/ssl/qsslellipticcurve.cpp
+++ b/src/network/ssl/qsslellipticcurve.cpp
@@ -156,7 +156,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn uint qHash(QSslEllipticCurve curve, uint seed)
+ \fn size_t qHash(QSslEllipticCurve curve, size_t seed)
\since 5.5
\relates QHash
diff --git a/src/network/ssl/qsslellipticcurve.h b/src/network/ssl/qsslellipticcurve.h
index 28de3a03b4..c63552c680 100644
--- a/src/network/ssl/qsslellipticcurve.h
+++ b/src/network/ssl/qsslellipticcurve.h
@@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE
class QSslEllipticCurve;
// qHash is a friend, but we can't use default arguments for friends (§8.3.6.4)
-Q_DECL_CONSTEXPR uint qHash(QSslEllipticCurve curve, uint seed = 0) noexcept;
+Q_DECL_CONSTEXPR size_t qHash(QSslEllipticCurve curve, size_t seed = 0) noexcept;
class QSslEllipticCurve {
public:
@@ -78,7 +78,7 @@ private:
int id;
friend Q_DECL_CONSTEXPR bool operator==(QSslEllipticCurve lhs, QSslEllipticCurve rhs) noexcept;
- friend Q_DECL_CONSTEXPR uint qHash(QSslEllipticCurve curve, uint seed) noexcept;
+ friend Q_DECL_CONSTEXPR size_t qHash(QSslEllipticCurve curve, size_t seed) noexcept;
friend class QSslContext;
friend class QSslSocketPrivate;
@@ -87,7 +87,7 @@ private:
Q_DECLARE_TYPEINFO(QSslEllipticCurve, Q_PRIMITIVE_TYPE);
-Q_DECL_CONSTEXPR inline uint qHash(QSslEllipticCurve curve, uint seed) noexcept
+Q_DECL_CONSTEXPR inline size_t qHash(QSslEllipticCurve curve, size_t seed) noexcept
{ return qHash(curve.id, seed); }
Q_DECL_CONSTEXPR inline bool operator==(QSslEllipticCurve lhs, QSslEllipticCurve rhs) noexcept
diff --git a/src/network/ssl/qsslerror.cpp b/src/network/ssl/qsslerror.cpp
index cdc018a508..5e935adf09 100644
--- a/src/network/ssl/qsslerror.cpp
+++ b/src/network/ssl/qsslerror.cpp
@@ -362,7 +362,7 @@ QSslCertificate QSslError::certificate() const
\since 5.4
\relates QHash
*/
-uint qHash(const QSslError &key, uint seed) noexcept
+size_t qHash(const QSslError &key, size_t seed) noexcept
{
QtPrivate::QHashCombine hash;
seed = hash(seed, key.error());
diff --git a/src/network/ssl/qsslerror.h b/src/network/ssl/qsslerror.h
index 28eb1a9ea8..834684cd9d 100644
--- a/src/network/ssl/qsslerror.h
+++ b/src/network/ssl/qsslerror.h
@@ -124,7 +124,7 @@ private:
};
Q_DECLARE_SHARED(QSslError)
-Q_NETWORK_EXPORT uint qHash(const QSslError &key, uint seed = 0) noexcept;
+Q_NETWORK_EXPORT size_t qHash(const QSslError &key, size_t seed = 0) noexcept;
#ifndef QT_NO_DEBUG_STREAM
class QDebug;
diff --git a/src/platformsupport/fontdatabases/freetype/qfontengine_ft_p.h b/src/platformsupport/fontdatabases/freetype/qfontengine_ft_p.h
index 8019588bf5..0e719c7457 100644
--- a/src/platformsupport/fontdatabases/freetype/qfontengine_ft_p.h
+++ b/src/platformsupport/fontdatabases/freetype/qfontengine_ft_p.h
@@ -343,7 +343,7 @@ private:
Q_DECLARE_TYPEINFO(QFontEngineFT::QGlyphSet, Q_MOVABLE_TYPE);
-inline uint qHash(const QFontEngineFT::GlyphAndSubPixelPosition &g)
+inline size_t qHash(const QFontEngineFT::GlyphAndSubPixelPosition &g)
{
return (g.glyph << 8) | (g.subPixelPosition * 10).round().toInt();
}
diff --git a/src/plugins/platforms/windows/qwindowscursor.h b/src/plugins/platforms/windows/qwindowscursor.h
index cf3635bd6b..fc2a111aac 100644
--- a/src/plugins/platforms/windows/qwindowscursor.h
+++ b/src/plugins/platforms/windows/qwindowscursor.h
@@ -61,9 +61,9 @@ inline bool operator==(const QWindowsPixmapCursorCacheKey &k1, const QWindowsPix
return k1.bitmapCacheKey == k2.bitmapCacheKey && k1.maskCacheKey == k2.maskCacheKey;
}
-inline uint qHash(const QWindowsPixmapCursorCacheKey &k, uint seed) noexcept
+inline size_t qHash(const QWindowsPixmapCursorCacheKey &k, size_t seed) noexcept
{
- return (uint(k.bitmapCacheKey) + uint(k.maskCacheKey)) ^ seed;
+ return (size_t(k.bitmapCacheKey) + size_t(k.maskCacheKey)) ^ seed;
}
class CursorHandle
diff --git a/src/plugins/platforms/winrt/qwinrtintegration.cpp b/src/plugins/platforms/winrt/qwinrtintegration.cpp
index dd8cd80fd9..f7d44c6f28 100644
--- a/src/plugins/platforms/winrt/qwinrtintegration.cpp
+++ b/src/plugins/platforms/winrt/qwinrtintegration.cpp
@@ -95,7 +95,7 @@ typedef IEventHandler<SuspendingEventArgs *> SuspendHandler;
QT_BEGIN_NAMESPACE
typedef HRESULT (__stdcall ICoreApplication::*CoreApplicationCallbackRemover)(EventRegistrationToken);
-uint qHash(CoreApplicationCallbackRemover key) { void *ptr = *(void **)(&key); return qHash(ptr); }
+size_t qHash(CoreApplicationCallbackRemover key) { void *ptr = *(void **)(&key); return qHash(ptr); }
class QWinRTIntegrationPrivate
{
diff --git a/src/plugins/platforms/winrt/qwinrtscreen.cpp b/src/plugins/platforms/winrt/qwinrtscreen.cpp
index 86ab7651c6..5db1459213 100644
--- a/src/plugins/platforms/winrt/qwinrtscreen.cpp
+++ b/src/plugins/platforms/winrt/qwinrtscreen.cpp
@@ -471,13 +471,13 @@ static inline Qt::Key qKeyFromCode(quint32 code, int mods)
}
typedef HRESULT (__stdcall ICoreWindow::*CoreWindowCallbackRemover)(EventRegistrationToken);
-uint qHash(CoreWindowCallbackRemover key) { void *ptr = *(void **)(&key); return qHash(ptr); }
+size_t qHash(CoreWindowCallbackRemover key) { void *ptr = *(void **)(&key); return qHash(ptr); }
typedef HRESULT (__stdcall IDisplayInformation::*DisplayCallbackRemover)(EventRegistrationToken);
-uint qHash(DisplayCallbackRemover key) { void *ptr = *(void **)(&key); return qHash(ptr); }
+size_t qHash(DisplayCallbackRemover key) { void *ptr = *(void **)(&key); return qHash(ptr); }
typedef HRESULT (__stdcall ICorePointerRedirector::*RedirectorCallbackRemover)(EventRegistrationToken);
-uint qHash(RedirectorCallbackRemover key) { void *ptr = *(void **)(&key); return qHash(ptr); }
+size_t qHash(RedirectorCallbackRemover key) { void *ptr = *(void **)(&key); return qHash(ptr); }
typedef HRESULT (__stdcall IApplicationView2::*ApplicationView2CallbackRemover)(EventRegistrationToken);
-uint qHash(ApplicationView2CallbackRemover key) { void *ptr = *(void **)(&key); return qHash(ptr); }
+size_t qHash(ApplicationView2CallbackRemover key) { void *ptr = *(void **)(&key); return qHash(ptr); }
class QWinRTScreenPrivate
{
diff --git a/src/plugins/platforms/xcb/qxcbcursor.h b/src/plugins/platforms/xcb/qxcbcursor.h
index 0b238823f0..83c2db086a 100644
--- a/src/plugins/platforms/xcb/qxcbcursor.h
+++ b/src/plugins/platforms/xcb/qxcbcursor.h
@@ -65,9 +65,9 @@ inline bool operator==(const QXcbCursorCacheKey &k1, const QXcbCursorCacheKey &k
return k1.shape == k2.shape && k1.bitmapCacheKey == k2.bitmapCacheKey && k1.maskCacheKey == k2.maskCacheKey;
}
-inline uint qHash(const QXcbCursorCacheKey &k, uint seed) noexcept
+inline size_t qHash(const QXcbCursorCacheKey &k, size_t seed) noexcept
{
- return (uint(k.shape) + uint(k.bitmapCacheKey) + uint(k.maskCacheKey)) ^ seed;
+ return (size_t(k.shape) + size_t(k.bitmapCacheKey) + size_t(k.maskCacheKey)) ^ seed;
}
#endif // !QT_NO_CURSOR
diff --git a/src/plugins/styles/mac/qmacstyle_mac.mm b/src/plugins/styles/mac/qmacstyle_mac.mm
index 70e97b0295..3b52ba8992 100644
--- a/src/plugins/styles/mac/qmacstyle_mac.mm
+++ b/src/plugins/styles/mac/qmacstyle_mac.mm
@@ -1536,7 +1536,7 @@ QStyleHelper::WidgetSizePolicy QMacStylePrivate::aquaSizeConstrain(const QStyleO
#endif
}
-uint qHash(const QMacStylePrivate::CocoaControl &cw, uint seed = 0)
+size_t qHash(const QMacStylePrivate::CocoaControl &cw, size_t seed = 0)
{
return ((cw.type << 2) | cw.size) ^ seed;
}
diff --git a/src/plugins/styles/windowsvista/qwindowsxpstyle_p_p.h b/src/plugins/styles/windowsvista/qwindowsxpstyle_p_p.h
index 06b37a6e5c..bfba950523 100644
--- a/src/plugins/styles/windowsvista/qwindowsxpstyle_p_p.h
+++ b/src/plugins/styles/windowsvista/qwindowsxpstyle_p_p.h
@@ -153,7 +153,7 @@ struct ThemeMapKey {
};
-inline uint qHash(const ThemeMapKey &key)
+inline size_t qHash(const ThemeMapKey &key)
{ return key.theme ^ key.partId ^ key.stateId; }
inline bool operator==(const ThemeMapKey &k1, const ThemeMapKey &k2)
diff --git a/src/tools/moc/symbols.h b/src/tools/moc/symbols.h
index af5e90e300..4bcb640760 100644
--- a/src/tools/moc/symbols.h
+++ b/src/tools/moc/symbols.h
@@ -59,7 +59,7 @@ struct SubArray
}
};
-inline uint qHash(const SubArray &key)
+inline size_t qHash(const SubArray &key)
{
return qHash(QLatin1String(key.array.constData() + key.from, key.len));
}
diff --git a/src/widgets/dialogs/qfilesystemmodel_p.h b/src/widgets/dialogs/qfilesystemmodel_p.h
index ad98b9ef44..ccfa40c5f7 100644
--- a/src/widgets/dialogs/qfilesystemmodel_p.h
+++ b/src/widgets/dialogs/qfilesystemmodel_p.h
@@ -84,7 +84,7 @@ public:
Q_DECLARE_TYPEINFO(QFileSystemModelNodePathKey, Q_MOVABLE_TYPE);
-inline uint qHash(const QFileSystemModelNodePathKey &key) { return qHash(key.toCaseFolded()); }
+inline size_t qHash(const QFileSystemModelNodePathKey &key) { return qHash(key.toCaseFolded()); }
#else // Q_OS_WIN
typedef QString QFileSystemModelNodePathKey;
#endif
diff --git a/src/widgets/kernel/qsizepolicy.cpp b/src/widgets/kernel/qsizepolicy.cpp
index c4372a9fbc..bf3eb34d23 100644
--- a/src/widgets/kernel/qsizepolicy.cpp
+++ b/src/widgets/kernel/qsizepolicy.cpp
@@ -317,7 +317,7 @@ void QSizePolicy::setControlType(ControlType type) noexcept
*/
/*!
- \fn uint qHash(QSizePolicy key, uint seed = 0)
+ \fn size_t qHash(QSizePolicy key, size_t seed = 0)
\since 5.6
\relates QSizePolicy
diff --git a/src/widgets/kernel/qsizepolicy.h b/src/widgets/kernel/qsizepolicy.h
index f26923eeb0..f4d0b2faa9 100644
--- a/src/widgets/kernel/qsizepolicy.h
+++ b/src/widgets/kernel/qsizepolicy.h
@@ -65,7 +65,7 @@ QT_BEGIN_NAMESPACE
class QVariant;
class QSizePolicy;
-Q_DECL_CONST_FUNCTION inline uint qHash(QSizePolicy key, uint seed = 0) noexcept;
+Q_DECL_CONST_FUNCTION inline size_t qHash(QSizePolicy key, size_t seed = 0) noexcept;
class Q_WIDGETS_EXPORT QSizePolicy
{
@@ -146,7 +146,7 @@ public:
QT_SIZEPOLICY_CONSTEXPR bool operator==(const QSizePolicy& s) const noexcept { return data == s.data; }
QT_SIZEPOLICY_CONSTEXPR bool operator!=(const QSizePolicy& s) const noexcept { return data != s.data; }
- friend Q_DECL_CONST_FUNCTION uint qHash(QSizePolicy key, uint seed) noexcept { return qHash(key.data, seed); }
+ friend Q_DECL_CONST_FUNCTION size_t qHash(QSizePolicy key, size_t seed) noexcept { return qHash(key.data, seed); }
operator QVariant() const;
diff --git a/tests/auto/corelib/plugin/quuid/tst_quuid.cpp b/tests/auto/corelib/plugin/quuid/tst_quuid.cpp
index 16552059dd..7abe7ebdc6 100644
--- a/tests/auto/corelib/plugin/quuid/tst_quuid.cpp
+++ b/tests/auto/corelib/plugin/quuid/tst_quuid.cpp
@@ -441,7 +441,7 @@ void tst_QUuid::processUniqueness()
void tst_QUuid::hash()
{
- uint h = qHash(uuidA);
+ size_t h = qHash(uuidA);
QCOMPARE(qHash(uuidA), h);
QCOMPARE(qHash(QUuid(uuidA.toString())), h);
}
diff --git a/tests/auto/corelib/tools/collections/tst_collections.cpp b/tests/auto/corelib/tools/collections/tst_collections.cpp
index 456c3e6cf9..2059cf74cf 100644
--- a/tests/auto/corelib/tools/collections/tst_collections.cpp
+++ b/tests/auto/corelib/tools/collections/tst_collections.cpp
@@ -2604,7 +2604,7 @@ public:
bool operator==(const EqualsComparable &) const { return true; }
};
-uint qHash(const EqualsComparable &)
+size_t qHash(const EqualsComparable &)
{
return 0;
}
@@ -2917,7 +2917,7 @@ public:
inline bool operator==(const Aligned4 &other) const { return i == other.i; }
inline bool operator<(const Aligned4 &other) const { return i < other.i; }
- friend inline int qHash(const Aligned4 &a) { return qHash(a.i); }
+ friend inline size_t qHash(const Aligned4 &a) { return qHash(a.i); }
};
Q_STATIC_ASSERT(alignof(Aligned4) % 4 == 0);
@@ -3069,7 +3069,7 @@ template<template<class, class> class C> void QTBUG13079_collectionInsideCollect
}
-quint32 qHash(const QTBUG13079_Node<QSet> &)
+size_t qHash(const QTBUG13079_Node<QSet> &)
{
return 0;
}
diff --git a/tests/auto/corelib/tools/containerapisymmetry/tst_containerapisymmetry.cpp b/tests/auto/corelib/tools/containerapisymmetry/tst_containerapisymmetry.cpp
index fe6e82e19c..8c90822ec8 100644
--- a/tests/auto/corelib/tools/containerapisymmetry/tst_containerapisymmetry.cpp
+++ b/tests/auto/corelib/tools/containerapisymmetry/tst_containerapisymmetry.cpp
@@ -91,7 +91,7 @@ bool operator==(Movable lhs, Movable rhs) Q_DECL_NOTHROW { return lhs.i == rhs.i
bool operator!=(Movable lhs, Movable rhs) Q_DECL_NOTHROW { return lhs.i != rhs.i; }
bool operator<(Movable lhs, Movable rhs) Q_DECL_NOTHROW { return lhs.i < rhs.i; }
-uint qHash(Movable m, uint seed = 0) Q_DECL_NOTHROW { return qHash(m.i, seed); }
+size_t qHash(Movable m, size_t seed = 0) Q_DECL_NOTHROW { return qHash(m.i, seed); }
QDebug &operator<<(QDebug &d, Movable m)
{
const QDebugStateSaver saver(d);
@@ -130,7 +130,7 @@ bool operator==(Complex lhs, Complex rhs) Q_DECL_NOTHROW { return lhs.i == rhs.i
bool operator!=(Complex lhs, Complex rhs) Q_DECL_NOTHROW { return lhs.i != rhs.i; }
bool operator<(Complex lhs, Complex rhs) Q_DECL_NOTHROW { return lhs.i < rhs.i; }
-uint qHash(Complex c, uint seed = 0) Q_DECL_NOTHROW { return qHash(c.i, seed); }
+size_t qHash(Complex c, size_t seed = 0) Q_DECL_NOTHROW { return qHash(c.i, seed); }
QDebug &operator<<(QDebug &d, Complex c)
{
const QDebugStateSaver saver(d);
@@ -171,7 +171,7 @@ bool operator<(DuplicateStrategyTestType lhs, DuplicateStrategyTestType rhs) Q_D
return lhs.i < rhs.i;
}
-uint qHash(DuplicateStrategyTestType c, uint seed = 0) Q_DECL_NOTHROW
+size_t qHash(DuplicateStrategyTestType c, size_t seed = 0) Q_DECL_NOTHROW
{
return qHash(c.i, seed);
}
diff --git a/tests/auto/corelib/tools/qcache/tst_qcache.cpp b/tests/auto/corelib/tools/qcache/tst_qcache.cpp
index af74553ab4..f122e45e87 100644
--- a/tests/auto/corelib/tools/qcache/tst_qcache.cpp
+++ b/tests/auto/corelib/tools/qcache/tst_qcache.cpp
@@ -378,7 +378,7 @@ bool operator==(const KeyType &key1, const KeyType &key2)
return key1.foo == key2.foo;
}
-uint qHash(const KeyType &key)
+size_t qHash(const KeyType &key)
{
return qHash(key.foo);
}
diff --git a/tests/auto/corelib/tools/qhash/tst_qhash.cpp b/tests/auto/corelib/tools/qhash/tst_qhash.cpp
index b987adaa3f..da1cb15cd8 100644
--- a/tests/auto/corelib/tools/qhash/tst_qhash.cpp
+++ b/tests/auto/corelib/tools/qhash/tst_qhash.cpp
@@ -77,7 +77,7 @@ struct IdentityTracker {
int value, id;
};
-inline uint qHash(IdentityTracker key) { return qHash(key.value); }
+inline size_t qHash(IdentityTracker key) { return qHash(key.value); }
inline bool operator==(IdentityTracker lhs, IdentityTracker rhs) { return lhs.value == rhs.value; }
@@ -1337,52 +1337,52 @@ static int wrongqHashOverload = 0;
struct OneArgumentQHashStruct1 {};
bool operator==(const OneArgumentQHashStruct1 &, const OneArgumentQHashStruct1 &) { return false; }
-uint qHash(OneArgumentQHashStruct1) { return 0; }
+size_t qHash(OneArgumentQHashStruct1) { return 0; }
struct OneArgumentQHashStruct2 {};
bool operator==(const OneArgumentQHashStruct2 &, const OneArgumentQHashStruct2 &) { return false; }
-uint qHash(const OneArgumentQHashStruct2 &) { return 0; }
+size_t qHash(const OneArgumentQHashStruct2 &) { return 0; }
struct OneArgumentQHashStruct3 {};
bool operator==(const OneArgumentQHashStruct3 &, const OneArgumentQHashStruct3 &) { return false; }
-uint qHash(OneArgumentQHashStruct3) { return 0; }
-uint qHash(OneArgumentQHashStruct3 &, uint) { wrongqHashOverload = 1; return 0; }
+size_t qHash(OneArgumentQHashStruct3) { return 0; }
+size_t qHash(OneArgumentQHashStruct3 &, size_t) { wrongqHashOverload = 1; return 0; }
struct OneArgumentQHashStruct4 {};
bool operator==(const OneArgumentQHashStruct4 &, const OneArgumentQHashStruct4 &) { return false; }
-uint qHash(const OneArgumentQHashStruct4 &) { return 0; }
-uint qHash(OneArgumentQHashStruct4 &, uint) { wrongqHashOverload = 1; return 0; }
+size_t qHash(const OneArgumentQHashStruct4 &) { return 0; }
+size_t qHash(OneArgumentQHashStruct4 &, size_t) { wrongqHashOverload = 1; return 0; }
struct TwoArgumentsQHashStruct1 {};
bool operator==(const TwoArgumentsQHashStruct1 &, const TwoArgumentsQHashStruct1 &) { return false; }
-uint qHash(const TwoArgumentsQHashStruct1 &) { wrongqHashOverload = 1; return 0; }
-uint qHash(const TwoArgumentsQHashStruct1 &, uint) { return 0; }
+size_t qHash(const TwoArgumentsQHashStruct1 &) { wrongqHashOverload = 1; return 0; }
+size_t qHash(const TwoArgumentsQHashStruct1 &, size_t) { return 0; }
struct TwoArgumentsQHashStruct2 {};
bool operator==(const TwoArgumentsQHashStruct2 &, const TwoArgumentsQHashStruct2 &) { return false; }
-uint qHash(TwoArgumentsQHashStruct2) { wrongqHashOverload = 1; return 0; }
-uint qHash(const TwoArgumentsQHashStruct2 &, uint) { return 0; }
+size_t qHash(TwoArgumentsQHashStruct2) { wrongqHashOverload = 1; return 0; }
+size_t qHash(const TwoArgumentsQHashStruct2 &, size_t) { return 0; }
struct TwoArgumentsQHashStruct3 {};
bool operator==(const TwoArgumentsQHashStruct3 &, const TwoArgumentsQHashStruct3 &) { return false; }
-uint qHash(const TwoArgumentsQHashStruct3 &) { wrongqHashOverload = 1; return 0; }
-uint qHash(TwoArgumentsQHashStruct3, uint) { return 0; }
+size_t qHash(const TwoArgumentsQHashStruct3 &) { wrongqHashOverload = 1; return 0; }
+size_t qHash(TwoArgumentsQHashStruct3, size_t) { return 0; }
struct TwoArgumentsQHashStruct4 {};
bool operator==(const TwoArgumentsQHashStruct4 &, const TwoArgumentsQHashStruct4 &) { return false; }
-uint qHash(TwoArgumentsQHashStruct4) { wrongqHashOverload = 1; return 0; }
-uint qHash(TwoArgumentsQHashStruct4, uint) { return 0; }
+size_t qHash(TwoArgumentsQHashStruct4) { wrongqHashOverload = 1; return 0; }
+size_t qHash(TwoArgumentsQHashStruct4, size_t) { return 0; }
/*!
\internal
Check that QHash picks up the right overload.
The best one, for a type T, is the two-args version of qHash:
- either uint qHash(T, uint) or uint qHash(const T &, uint).
+ either size_t qHash(T, size_t) or size_t qHash(const T &, size_t).
If neither of these exists, then one between
- uint qHash(T) or uint qHash(const T &) must exist
+ size_t qHash(T) or size_t qHash(const T &) must exist
(and it gets selected instead).
*/
void tst_QHash::twoArguments_qHash()
diff --git a/tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp b/tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp
index f76f3aa0c6..c23c08bd7c 100644
--- a/tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp
+++ b/tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp
@@ -105,8 +105,8 @@ void tst_QHashFunctions::qhash()
a2.resize(1);
a2.setBit(0, false);
- uint h1 = qHash(a1, seed);
- uint h2 = qHash(a2, seed);
+ size_t h1 = qHash(a1, seed);
+ size_t h2 = qHash(a2, seed);
QVERIFY(h1 != h2); // not guaranteed
@@ -124,14 +124,14 @@ void tst_QHashFunctions::qhash()
QVERIFY(h1 == h2);
a2.setBit(0, false);
- uint h3 = qHash(a2, seed);
+ size_t h3 = qHash(a2, seed);
QVERIFY(h2 != h3); // not guaranteed
a2.setBit(0, true);
QVERIFY(h2 == qHash(a2, seed));
a2.setBit(6, false);
- uint h4 = qHash(a2, seed);
+ size_t h4 = qHash(a2, seed);
QVERIFY(h2 != h4); // not guaranteed
a2.setBit(6, true);
@@ -228,7 +228,7 @@ void tst_QHashFunctions::qthash()
namespace SomeNamespace {
struct Hashable { int i; };
- inline uint qHash(Hashable h, uint seed = 0)
+ inline size_t qHash(Hashable h, size_t seed = 0)
{ return QT_PREPEND_NAMESPACE(qHash)(h.i, seed); }
}
diff --git a/tests/auto/corelib/tools/qset/tst_qset.cpp b/tests/auto/corelib/tools/qset/tst_qset.cpp
index 21ceee87c0..ee6cf7f533 100644
--- a/tests/auto/corelib/tools/qset/tst_qset.cpp
+++ b/tests/auto/corelib/tools/qset/tst_qset.cpp
@@ -74,7 +74,7 @@ struct IdentityTracker {
int value, id;
};
-inline uint qHash(IdentityTracker key) { return qHash(key.value); }
+inline size_t qHash(IdentityTracker key) { return qHash(key.value); }
inline bool operator==(IdentityTracker lhs, IdentityTracker rhs) { return lhs.value == rhs.value; }
void tst_QSet::operator_eq()
diff --git a/tests/auto/corelib/tools/qvector/tst_qvector.cpp b/tests/auto/corelib/tools/qvector/tst_qvector.cpp
index 6ae312fb8d..739c841ae1 100644
--- a/tests/auto/corelib/tools/qvector/tst_qvector.cpp
+++ b/tests/auto/corelib/tools/qvector/tst_qvector.cpp
@@ -108,7 +108,7 @@ private:
}
};
-inline uint qHash(const Movable &key, uint seed = 0) { return qHash(key.i, seed); }
+inline size_t qHash(const Movable &key, size_t seed = 0) { return qHash(key.i, seed); }
QAtomicInt Movable::counter = 0;
QT_BEGIN_NAMESPACE
@@ -179,7 +179,7 @@ private:
};
QAtomicInt Custom::counter = 0;
-inline uint qHash(const Custom &key, uint seed = 0) { return qHash(key.i, seed); }
+inline size_t qHash(const Custom &key, size_t seed = 0) { return qHash(key.i, seed); }
Q_DECLARE_METATYPE(Custom);
diff --git a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
index ce88c6a7a4..75ab0810ca 100644
--- a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
+++ b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
@@ -3289,7 +3289,7 @@ void tst_QPainter::imageScaling_task206785()
#define FOR_EACH_NEIGHBOR_8 for (int dx = -1; dx <= 1; ++dx) for (int dy = -1; dy <= 1; ++dy) if (dx != 0 || dy != 0)
#define FOR_EACH_NEIGHBOR_4 for (int dx = -1; dx <= 1; ++dx) for (int dy = -1; dy <= 1; ++dy) if ((dx == 0) != (dy == 0))
-uint qHash(const QPoint &point)
+size_t qHash(const QPoint &point)
{
return qHash(qMakePair(point.x(), point.y()));
}
diff --git a/util/glgen/qopenglversionfunctions.h.header b/util/glgen/qopenglversionfunctions.h.header
index 3e57bf0277..951d09c1d1 100644
--- a/util/glgen/qopenglversionfunctions.h.header
+++ b/util/glgen/qopenglversionfunctions.h.header
@@ -78,7 +78,7 @@ struct QOpenGLVersionStatus
OpenGLStatus status;
};
-inline uint qHash(const QOpenGLVersionStatus &v, uint seed)
+inline size_t qHash(const QOpenGLVersionStatus &v, size_t seed)
{
return qHash(static_cast<int>(v.status * 1000)
+ v.version.first * 100 + v.version.second * 10, seed);
diff --git a/util/glgen/specparser.h b/util/glgen/specparser.h
index 7fee5c4df9..38051f9f43 100644
--- a/util/glgen/specparser.h
+++ b/util/glgen/specparser.h
@@ -77,7 +77,7 @@ inline bool operator <= (const Version &lhs, const Version &rhs)
return !(lhs > rhs);
}
-inline uint qHash(const Version &v)
+inline size_t qHash(const Version &v)
{
return qHash(v.major * 100 + v.minor * 10);
}
@@ -118,7 +118,7 @@ inline bool operator < (const VersionProfile &lhs, const VersionProfile &rhs)
return (lhs.version < rhs.version);
}
-inline uint qHash(const VersionProfile &v)
+inline size_t Hash(const VersionProfile &v)
{
return qHash(static_cast<int>(v.profile * 1000) + v.version.major * 100 + v.version.minor * 10);
}
diff --git a/util/lexgen/nfa.cpp b/util/lexgen/nfa.cpp
index f6e3a5c355..b5c91c5cff 100644
--- a/util/lexgen/nfa.cpp
+++ b/util/lexgen/nfa.cpp
@@ -236,11 +236,11 @@ typedef QSet<int> DFAState;
// that's a bad hash, but it's good enough for us
// and it allows us to use the nice QHash API :)
-inline uint qHash(const DFAState &state)
+inline size_t qHash(const DFAState &state)
{
- uint val = 0;
+ size_t val = 0;
foreach (int s, state)
- val |= qHash(s);
+ val ^= qHash(s);
return val;
}