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>
This commit is contained in:
Lars Knoll 2020-04-29 11:33:19 +02:00
parent da3cb1deb6
commit 7f02abd301

View File

@ -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;
}