From c6cdf38e752c22babdbe645366bdfb7ce51d01ff Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Fri, 31 Jan 2020 12:11:54 +0100 Subject: Change qHash() to work with size_t instead of uint MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- qmake/cachekeys.h | 4 ++-- qmake/generators/makefile.h | 6 +++--- qmake/library/proitems.cpp | 2 +- qmake/library/proitems.h | 4 ++-- qmake/library/qmakeevaluator.cpp | 2 +- qmake/library/qmakeglobals.h | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) (limited to 'qmake') 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 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 -- cgit v1.2.3