From 7f02abd301b3a62f2e3d36fc5b2802c304eb506b Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 29 Apr 2020 11:33:19 +0200 Subject: 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 --- src/corelib/tools/qcache.h | 6 +++--- 1 file 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 keys() const { QVector k; if (d.size) { - k.reserve(d.size); + k.reserve(typename QVector::size_type(d.size)); for (auto it = d.begin(); it != d.end(); ++it) k << it.node()->key; } -- cgit v1.2.3