Avoid size_t to (u)int warnings with auto, where it is possible

Change-Id: I1ec7454ebce59d99bc828bfd5086907eb0905632
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Tim Jenssen
2021-07-07 17:32:53 +02:00
parent cd84331848
commit 40d03d1896
15 changed files with 20 additions and 20 deletions

View File

@@ -92,7 +92,7 @@ struct ResponseHandler
using ResponseHandlers = std::function<void(const MessageId &, const QByteArray &, QTextCodec *)>; using ResponseHandlers = std::function<void(const MessageId &, const QByteArray &, QTextCodec *)>;
using MethodHandler = std::function<void(const QString &, const MessageId &, const IContent *)>; using MethodHandler = std::function<void(const QString &, const MessageId &, const IContent *)>;
inline uint qHash(const LanguageServerProtocol::MessageId &id) inline auto qHash(const LanguageServerProtocol::MessageId &id)
{ {
if (Utils::holds_alternative<int>(id)) if (Utils::holds_alternative<int>(id))
return QT_PREPEND_NAMESPACE(qHash(Utils::get<int>(id))); return QT_PREPEND_NAMESPACE(qHash(Utils::get<int>(id)));

View File

@@ -55,7 +55,7 @@ private:
QUuid m_uuid; QUuid m_uuid;
}; };
inline uint qHash(const Uid &uid) inline auto qHash(const Uid &uid)
{ {
return qHash(uid.get()); return qHash(uid.get());
} }

View File

@@ -151,15 +151,15 @@ private:
QColor m_color; QColor m_color;
}; };
inline uint qHash(CustomRelation::Relationship relationship) { inline auto qHash(CustomRelation::Relationship relationship) {
return ::qHash(static_cast<int>(relationship)); return ::qHash(static_cast<int>(relationship));
} }
inline uint qHash(CustomRelation::ShaftPattern pattern) { inline auto qHash(CustomRelation::ShaftPattern pattern) {
return ::qHash(static_cast<int>(pattern)); return ::qHash(static_cast<int>(pattern));
} }
inline uint qHash(CustomRelation::Head head) { inline auto qHash(CustomRelation::Head head) {
return ::qHash(static_cast<int>(head)); return ::qHash(static_cast<int>(head));
} }

View File

@@ -77,7 +77,7 @@ bool operator==(const IconKey &lhs, const IconKey &rhs) {
&& lhs.m_lineWidth == rhs.m_lineWidth; && lhs.m_lineWidth == rhs.m_lineWidth;
} }
uint qHash(const IconKey &key) { auto qHash(const IconKey &key) {
return ::qHash(key.m_element) + qHash(key.m_stereotypes) + qHash(key.m_defaultIconPath) return ::qHash(key.m_element) + qHash(key.m_stereotypes) + qHash(key.m_defaultIconPath)
+ qHash(key.m_styleUid) + ::qHash(key.m_size.width()) + ::qHash(key.m_size.height()); + qHash(key.m_styleUid) + ::qHash(key.m_size.width()) + ::qHash(key.m_size.height());
} }

View File

@@ -302,7 +302,7 @@ public:
return datastream; return datastream;
} }
friend uint qHash(const Utf8String &utf8String) friend auto qHash(const Utf8String &utf8String)
{ {
return qHash(utf8String.byteArray); return qHash(utf8String.byteArray);
} }

View File

@@ -120,7 +120,7 @@ protected:
QExplicitlySharedDataPointer<Internal::MimeTypePrivate> d; QExplicitlySharedDataPointer<Internal::MimeTypePrivate> d;
}; };
inline uint qHash(const MimeType &mime) { return qHash(mime.name()); } inline auto qHash(const MimeType &mime) { return qHash(mime.name()); }
} // Utils } // Utils

View File

@@ -75,7 +75,7 @@ enum class ResultType {
LAST_TYPE = Invalid LAST_TYPE = Invalid
}; };
inline uint qHash(const ResultType &result) inline auto qHash(const ResultType &result)
{ {
return QT_PREPEND_NAMESPACE(qHash(int(result))); return QT_PREPEND_NAMESPACE(qHash(int(result)));
} }

View File

@@ -46,7 +46,7 @@ public:
inline const QString &name() const { return m_name; } inline const QString &name() const { return m_name; }
inline const QString &type() const { return m_type; } inline const QString &type() const { return m_type; }
inline int iconType() const { return m_iconType; } inline int iconType() const { return m_iconType; }
inline uint hash() const { return m_hash; } inline auto hash() const { return m_hash; }
inline bool operator==(const SymbolInformation &other) const inline bool operator==(const SymbolInformation &other) const
{ {
return hash() == other.hash() && iconType() == other.iconType() && name() == other.name() return hash() == other.hash() && iconType() == other.iconType() && name() == other.name()
@@ -64,7 +64,7 @@ private:
}; };
//! qHash overload for QHash/QSet //! qHash overload for QHash/QSet
inline uint qHash(const SymbolInformation &information) inline auto qHash(const SymbolInformation &information)
{ {
return information.hash(); return information.hash();
} }

View File

@@ -55,7 +55,7 @@ public:
}; };
inline uint qHash(SearchResultColor::Style style) inline auto qHash(SearchResultColor::Style style)
{ {
return QT_PREPEND_NAMESPACE(qHash(int(style))); return QT_PREPEND_NAMESPACE(qHash(int(style)));
} }

View File

@@ -223,9 +223,9 @@ using SubBreakpoints = const QList<SubBreakpoint>;
using BreakHandlerModel = Utils::TreeModel<Utils::TypedTreeItem<BreakpointItem>, BreakpointItem, SubBreakpointItem>; using BreakHandlerModel = Utils::TreeModel<Utils::TypedTreeItem<BreakpointItem>, BreakpointItem, SubBreakpointItem>;
using BreakpointManagerModel = Utils::TreeModel<Utils::TypedTreeItem<GlobalBreakpointItem>, GlobalBreakpointItem>; using BreakpointManagerModel = Utils::TreeModel<Utils::TypedTreeItem<GlobalBreakpointItem>, GlobalBreakpointItem>;
inline uint qHash(const Debugger::Internal::SubBreakpoint &b) { return qHash(b.data()); } inline auto qHash(const Debugger::Internal::SubBreakpoint &b) { return qHash(b.data()); }
inline uint qHash(const Debugger::Internal::Breakpoint &b) { return qHash(b.data()); } inline auto qHash(const Debugger::Internal::Breakpoint &b) { return qHash(b.data()); }
inline uint qHash(const Debugger::Internal::GlobalBreakpoint &b) { return qHash(b.data()); } inline auto qHash(const Debugger::Internal::GlobalBreakpoint &b) { return qHash(b.data()); }
class BreakHandler : public BreakHandlerModel class BreakHandler : public BreakHandlerModel
{ {

View File

@@ -193,7 +193,7 @@ private:
QString m_param; QString m_param;
}; };
inline int qHash(const ProjectExplorer::Abi &abi) inline auto qHash(const ProjectExplorer::Abi &abi)
{ {
int h = abi.architecture() int h = abi.architecture()
+ (abi.os() << 3) + (abi.os() << 3)

View File

@@ -70,7 +70,7 @@ inline bool operator!=(const BuildTargetInfo &ti1, const BuildTargetInfo &ti2)
return !(ti1 == ti2); return !(ti1 == ti2);
} }
inline uint qHash(const BuildTargetInfo &ti) inline auto qHash(const BuildTargetInfo &ti)
{ {
return qHash(ti.displayName) ^ qHash(ti.buildKey); return qHash(ti.displayName) ^ qHash(ti.buildKey);
} }

View File

@@ -59,7 +59,7 @@ public:
HeaderPathType type = HeaderPathType::User; HeaderPathType type = HeaderPathType::User;
}; };
inline uint qHash(const HeaderPath &key, uint seed = 0) inline auto qHash(const HeaderPath &key, uint seed = 0)
{ {
return ((qHash(key.path) << 2) | uint(key.type)) ^ seed; return ((qHash(key.path) << 2) | uint(key.type)) ^ seed;
} }

View File

@@ -85,7 +85,7 @@ private:
}; };
inline inline
uint qHash(const Macro &macro) auto qHash(const Macro &macro)
{ {
using QT_PREPEND_NAMESPACE(qHash); using QT_PREPEND_NAMESPACE(qHash);
return qHash(macro.key) ^ qHash(macro.value) ^ qHash(int(macro.type)); return qHash(macro.key) ^ qHash(macro.value) ^ qHash(int(macro.type));

View File

@@ -76,7 +76,7 @@ inline bool operator!=(const QmlEventLocation &location1, const QmlEventLocation
return !(location1 == location2); return !(location1 == location2);
} }
inline uint qHash(const QmlEventLocation &location) inline auto qHash(const QmlEventLocation &location)
{ {
return qHash(location.filename()) return qHash(location.filename())
^ ((location.line() & 0xfff) // 12 bits of line number ^ ((location.line() & 0xfff) // 12 bits of line number