summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2020-04-29 11:33:19 +0200
committerLars Knoll <lars.knoll@qt.io>2020-05-04 08:31:05 +0200
commit7f02abd301b3a62f2e3d36fc5b2802c304eb506b (patch)
tree1576ba7a0288c79e84a5ae234200418a9cda4568
parentda3cb1deb6c752f8e4c05434e3451432e5d787ba (diff)
Fix 64bit size issues in QCache
size() and count() should return a qsizetype in Qt 6 in line with QHash and other containers. Add a cast in keys(), as QVector still needs to get converted to use qsizetype for it's length. Change-Id: I64a9d16ec4279d3dbb35c718b16a741665b9769e Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
-rw-r--r--src/corelib/tools/qcache.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/corelib/tools/qcache.h b/src/corelib/tools/qcache.h
index 3582a44e32..8cf6598f10 100644
--- a/src/corelib/tools/qcache.h
+++ b/src/corelib/tools/qcache.h
@@ -202,14 +202,14 @@ public:
}
inline int totalCost() const noexcept { return total; }
- inline int size() const noexcept { return d.size; }
- inline int count() const noexcept { return d.size; }
+ inline qsizetype size() const noexcept { return d.size; }
+ inline qsizetype count() const noexcept { return d.size; }
inline bool isEmpty() const noexcept { return !d.size; }
inline QVector<Key> keys() const
{
QVector<Key> k;
if (d.size) {
- k.reserve(d.size);
+ k.reserve(typename QVector<Key>::size_type(d.size));
for (auto it = d.begin(); it != d.end(); ++it)
k << it.node()->key;
}