summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2020-04-10 08:12:55 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2020-04-10 11:30:17 +0200
commitc0873b7832d8aaf79dda0c5c5820f97c84b399ed (patch)
tree90cbc48a5c5bdfe08773f96d4e680676d1cdeb80
parent4c4693cf964e9d7370c27a26e1d263a262aee568 (diff)
Fix a few size_t / int conversion warnings
Change the hash function of QTypeRevision and QtFontFallbacksCacheKey to use size_t and add a few casts. Change-Id: I89a8fc617abbe8b0c67529ec41795691c99b0574 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
-rw-r--r--src/corelib/kernel/qmetaobjectbuilder.cpp4
-rw-r--r--src/corelib/tools/qversionnumber.cpp2
-rw-r--r--src/corelib/tools/qversionnumber.h2
-rw-r--r--src/gui/rhi/qshader.cpp2
-rw-r--r--src/gui/text/qfontdatabase_p.h2
5 files changed, 6 insertions, 6 deletions
diff --git a/src/corelib/kernel/qmetaobjectbuilder.cpp b/src/corelib/kernel/qmetaobjectbuilder.cpp
index d96018506c..6447e4ec5e 100644
--- a/src/corelib/kernel/qmetaobjectbuilder.cpp
+++ b/src/corelib/kernel/qmetaobjectbuilder.cpp
@@ -1109,7 +1109,7 @@ int QMetaStringTable::preferredAlignment()
// Returns the size (in bytes) required for serializing this string table.
int QMetaStringTable::blobSize() const
{
- int size = m_entries.size() * 2*sizeof(uint);
+ int size = int(m_entries.size() * 2 * sizeof(uint));
Entries::const_iterator it;
for (it = m_entries.constBegin(); it != m_entries.constEnd(); ++it)
size += it.key().size() + 1;
@@ -1139,7 +1139,7 @@ void QMetaStringTable::writeBlob(char *out) const
{
Q_ASSERT(!(reinterpret_cast<quintptr>(out) & (preferredAlignment()-1)));
- int offsetOfStringdataMember = m_entries.size() * 2*sizeof(uint);
+ int offsetOfStringdataMember = int(m_entries.size() * 2 * sizeof(uint));
int stringdataOffset = 0;
// qt_metacast expects the first string in the string table to be the class name.
diff --git a/src/corelib/tools/qversionnumber.cpp b/src/corelib/tools/qversionnumber.cpp
index 267f618020..4d80bf4f86 100644
--- a/src/corelib/tools/qversionnumber.cpp
+++ b/src/corelib/tools/qversionnumber.cpp
@@ -746,7 +746,7 @@ QDebug operator<<(QDebug debug, const QTypeRevision &revision)
Returns the hash value for the \a key, using \a seed to seed the
calculation.
*/
-uint qHash(const QTypeRevision &key, uint seed)
+size_t qHash(const QTypeRevision &key, size_t seed)
{
return qHash(key.toEncodedVersion<quint16>(), seed);
}
diff --git a/src/corelib/tools/qversionnumber.h b/src/corelib/tools/qversionnumber.h
index c5756bdfb0..184aeac692 100644
--- a/src/corelib/tools/qversionnumber.h
+++ b/src/corelib/tools/qversionnumber.h
@@ -311,7 +311,7 @@ Q_REQUIRED_RESULT inline bool operator!=(const QVersionNumber &lhs, const QVersi
{ return QVersionNumber::compare(lhs, rhs) != 0; }
class QTypeRevision;
-Q_CORE_EXPORT uint qHash(const QTypeRevision &key, uint seed = 0);
+Q_CORE_EXPORT size_t qHash(const QTypeRevision &key, size_t seed = 0);
#ifndef QT_NO_DATASTREAM
Q_CORE_EXPORT QDataStream& operator<<(QDataStream &out, const QTypeRevision &revision);
diff --git a/src/gui/rhi/qshader.cpp b/src/gui/rhi/qshader.cpp
index 83d62fc4eb..b5c1aca8be 100644
--- a/src/gui/rhi/qshader.cpp
+++ b/src/gui/rhi/qshader.cpp
@@ -545,7 +545,7 @@ bool operator==(const QShader &lhs, const QShader &rhs) Q_DECL_NOTHROW
*/
size_t qHash(const QShader &s, size_t seed) Q_DECL_NOTHROW
{
- uint h = s.stage();
+ size_t h = s.stage();
for (auto it = s.d->shaders.constBegin(), itEnd = s.d->shaders.constEnd(); it != itEnd; ++it)
h += qHash(it.key(), seed) + qHash(it.value().shader(), seed);
return h;
diff --git a/src/gui/text/qfontdatabase_p.h b/src/gui/text/qfontdatabase_p.h
index f13dd66aa8..48b4fe8603 100644
--- a/src/gui/text/qfontdatabase_p.h
+++ b/src/gui/text/qfontdatabase_p.h
@@ -78,7 +78,7 @@ inline bool operator!=(const QtFontFallbacksCacheKey &lhs, const QtFontFallbacks
return !operator==(lhs, rhs);
}
-inline uint qHash(const QtFontFallbacksCacheKey &key, uint seed = 0) noexcept
+inline size_t qHash(const QtFontFallbacksCacheKey &key, size_t seed = 0) noexcept
{
QtPrivate::QHashCombine hash;
seed = hash(seed, key.family);