From 3d7c2b4b1c23370c83459fa37d7852cdd7bb8ec9 Mon Sep 17 00:00:00 2001 From: Vitozz Date: Wed, 27 Mar 2024 15:55:00 +0200 Subject: [PATCH] Less warnings with Qt6 --- src/irisnet/noncore/icetransport.h | 4 ++++ src/irisnet/noncore/transportaddress.h | 5 +++++ src/xmpp/jid/jid.h | 2 +- src/xmpp/xmpp-im/jingle.h | 8 ++++++++ src/xmpp/xmpp-im/xmpp_externalservicediscovery.h | 4 ++++ src/xmpp/xmpp-im/xmpp_hash.h | 4 ++++ 6 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/irisnet/noncore/icetransport.h b/src/irisnet/noncore/icetransport.h index 6dc3f939..5bf6ecef 100644 --- a/src/irisnet/noncore/icetransport.h +++ b/src/irisnet/noncore/icetransport.h @@ -60,7 +60,11 @@ class IceTransport : public QObject { void debugLine(const QString &str); }; +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) inline uint qHash(const QWeakPointer &p) { return qHash(p.toStrongRef().data()); } +#else +inline size_t qHash(const QWeakPointer &p) { return qHash(p.toStrongRef().data()); } +#endif } // namespace XMPP diff --git a/src/irisnet/noncore/transportaddress.h b/src/irisnet/noncore/transportaddress.h index ea450801..fec62a3c 100644 --- a/src/irisnet/noncore/transportaddress.h +++ b/src/irisnet/noncore/transportaddress.h @@ -23,7 +23,12 @@ class TransportAddress { } }; +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) + inline uint qHash(const TransportAddress &key, uint seed = 0) +#else +inline size_t qHash(const TransportAddress &key, size_t seed = 0) +#endif { return ::qHash(key.addr, seed) ^ ::qHash(key.port, seed); } diff --git a/src/xmpp/jid/jid.h b/src/xmpp/jid/jid.h index 4c4ff08f..08966774 100644 --- a/src/xmpp/jid/jid.h +++ b/src/xmpp/jid/jid.h @@ -97,7 +97,7 @@ Q_DECL_PURE_FUNCTION inline uint qHash(const XMPP::Jid &key, uint seed = 0) Q_DE return qHash(key.full(), seed); } #else -Q_DECL_PURE_FUNCTION inline uint qHash(const XMPP::Jid &key, size_t seed = 0) Q_DECL_NOTHROW +Q_DECL_PURE_FUNCTION inline size_t qHash(const XMPP::Jid &key, size_t seed = 0) Q_DECL_NOTHROW { return qHash(key.full(), seed); } diff --git a/src/xmpp/xmpp-im/jingle.h b/src/xmpp/xmpp-im/jingle.h index 845977b8..6ea71c1b 100644 --- a/src/xmpp/xmpp-im/jingle.h +++ b/src/xmpp/xmpp-im/jingle.h @@ -43,7 +43,11 @@ namespace Jingle { enum class Origin { None, Both, Initiator, Responder }; +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) inline uint qHash(const XMPP::Jingle::Origin &o, uint seed = 0) { return ::qHash(int(o), seed); } +#else + inline size_t qHash(const XMPP::Jingle::Origin &o, size_t seed = 0) { return ::qHash(int(o), seed); } +#endif /* Session states: @@ -121,7 +125,11 @@ namespace Jingle { SessionTerminate }; +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) inline uint qHash(const XMPP::Jingle::Action &o, uint seed = 0) { return ::qHash(int(o), seed); } +#else + inline size_t qHash(const XMPP::Jingle::Action &o, size_t seed = 0) { return ::qHash(int(o), seed); } +#endif /* Categorization by speed, reliability and connectivity diff --git a/src/xmpp/xmpp-im/xmpp_externalservicediscovery.h b/src/xmpp/xmpp-im/xmpp_externalservicediscovery.h index ec6f0d14..563603c2 100644 --- a/src/xmpp/xmpp-im/xmpp_externalservicediscovery.h +++ b/src/xmpp/xmpp-im/xmpp_externalservicediscovery.h @@ -66,7 +66,11 @@ struct ExternalServiceId { } }; +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) inline uint qHash(const ExternalServiceId &id, uint seed = 0) +#else +inline size_t qHash(const ExternalServiceId &id, size_t seed = 0) +#endif { return ::qHash(id.host, seed) ^ ::qHash(id.type, seed) ^ ::qHash(id.port, seed); } diff --git a/src/xmpp/xmpp-im/xmpp_hash.h b/src/xmpp/xmpp-im/xmpp_hash.h index 2c7d5de1..67400493 100644 --- a/src/xmpp/xmpp-im/xmpp_hash.h +++ b/src/xmpp/xmpp-im/xmpp_hash.h @@ -99,7 +99,11 @@ class StreamHash { std::unique_ptr d; }; +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) Q_DECL_PURE_FUNCTION inline uint qHash(const Hash &hash, uint seed = 0) Q_DECL_NOTHROW +#else +Q_DECL_PURE_FUNCTION inline size_t qHash(const Hash &hash, size_t seed = 0) Q_DECL_NOTHROW +#endif { return qHash(hash.data(), seed); }