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>
This commit is contained in:
parent
4c4693cf96
commit
c0873b7832
@ -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.
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user