diff options
author | Lars Knoll <lars.knoll@qt.io> | 2020-01-31 12:11:54 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2020-04-09 20:03:25 +0200 |
commit | c6cdf38e752c22babdbe645366bdfb7ce51d01ff (patch) | |
tree | 450b02523cb5a16791674ad1d06fb68c72eac971 /src/plugins | |
parent | 775945137b6ef62de9a7d416b1fe59d79006ba82 (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/plugins')
-rw-r--r-- | src/plugins/platforms/windows/qwindowscursor.h | 4 | ||||
-rw-r--r-- | src/plugins/platforms/winrt/qwinrtintegration.cpp | 2 | ||||
-rw-r--r-- | src/plugins/platforms/winrt/qwinrtscreen.cpp | 8 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbcursor.h | 4 | ||||
-rw-r--r-- | src/plugins/styles/mac/qmacstyle_mac.mm | 2 | ||||
-rw-r--r-- | src/plugins/styles/windowsvista/qwindowsxpstyle_p_p.h | 2 |
6 files changed, 11 insertions, 11 deletions
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) |