summaryrefslogtreecommitdiffstats
path: root/src/corelib/text
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 /src/corelib/text
parent775945137b6ef62de9a7d416b1fe59d79006ba82 (diff)
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>
Diffstat (limited to 'src/corelib/text')
-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
8 files changed, 12 insertions, 12 deletions
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;