Skip to content

Commit

Permalink
Less warnings with Qt6
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitozz committed Mar 27, 2024
1 parent 6f17799 commit 3d7c2b4
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/irisnet/noncore/icetransport.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<IceTransport> &p) { return qHash(p.toStrongRef().data()); }
#else
inline size_t qHash(const QWeakPointer<IceTransport> &p) { return qHash(p.toStrongRef().data()); }
#endif

} // namespace XMPP

Expand Down
5 changes: 5 additions & 0 deletions src/irisnet/noncore/transportaddress.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/xmpp/jid/jid.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
8 changes: 8 additions & 0 deletions src/xmpp/xmpp-im/jingle.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions src/xmpp/xmpp-im/xmpp_externalservicediscovery.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
4 changes: 4 additions & 0 deletions src/xmpp/xmpp-im/xmpp_hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,11 @@ class StreamHash {
std::unique_ptr<StreamHashPrivate> 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);
}
Expand Down

0 comments on commit 3d7c2b4

Please sign in to comment.