Improve qHash functions
@ -89,5 +89,9 @@ bool BitTorrent::operator!=(const InfoHash &left, const InfoHash &right)
uint BitTorrent::qHash(const InfoHash &key, const uint seed)
{
#if (LIBTORRENT_VERSION_NUM < 10200)
return ::qHash(static_cast<QString>(key), seed);
#else
return ::qHash((std::hash<lt::sha1_hash> {})(key), seed);
#endif
}
@ -82,7 +82,7 @@ namespace libtorrent
template <typename T, typename Tag>
uint qHash(const strong_typedef<T, Tag> &key, const uint seed)
return static_cast<uint>((std::hash<strong_typedef<T, Tag>> {})(key) ^ seed);
return ::qHash((std::hash<strong_typedef<T, Tag>> {})(key), seed);
@ -162,5 +162,5 @@ bool BitTorrent::operator==(const TrackerEntry &left, const TrackerEntry &right)
uint BitTorrent::qHash(const TrackerEntry &key, const uint seed)
return (::qHash(key.url(), seed) ^ key.tier());
return (::qHash(key.url(), seed) ^ ::qHash(key.tier()));
@ -348,7 +348,7 @@ Net::ServiceID Net::ServiceID::fromURL(const QUrl &url)
uint Net::qHash(const ServiceID &serviceID, const uint seed)
return ::qHash(serviceID.hostName, seed) ^ serviceID.port;
return ::qHash(serviceID.hostName, seed) ^ ::qHash(serviceID.port);
bool Net::operator==(const ServiceID &lhs, const ServiceID &rhs)