Browse Source

Use hashing helpers provided by Qt6

adaptive-webui-19844
Chocobo1 3 years ago
parent
commit
154ee1a73e
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 5
      src/base/bittorrent/peeraddress.cpp
  2. 5
      src/base/bittorrent/trackerentry.cpp
  3. 5
      src/base/net/downloadmanager.cpp
  4. 5
      src/gui/properties/peerlistwidget.cpp

5
src/base/bittorrent/peeraddress.cpp

@ -79,9 +79,12 @@ bool BitTorrent::operator==(const BitTorrent::PeerAddress &left, const BitTorren @@ -79,9 +79,12 @@ bool BitTorrent::operator==(const BitTorrent::PeerAddress &left, const BitTorren
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
std::size_t BitTorrent::qHash(const BitTorrent::PeerAddress &addr, const std::size_t seed)
{
return qHashMulti(seed, addr.ip, addr.port);
}
#else
uint BitTorrent::qHash(const BitTorrent::PeerAddress &addr, const uint seed)
#endif
{
return (::qHash(addr.ip, seed) ^ ::qHash(addr.port));
}
#endif

5
src/base/bittorrent/trackerentry.cpp

@ -38,9 +38,12 @@ bool BitTorrent::operator==(const TrackerEntry &left, const TrackerEntry &right) @@ -38,9 +38,12 @@ bool BitTorrent::operator==(const TrackerEntry &left, const TrackerEntry &right)
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
std::size_t BitTorrent::qHash(const TrackerEntry &key, const std::size_t seed)
{
return qHashMulti(seed, key.url, key.tier);
}
#else
uint BitTorrent::qHash(const TrackerEntry &key, const uint seed)
#endif
{
return (::qHash(key.url, seed) ^ ::qHash(key.tier));
}
#endif

5
src/base/net/downloadmanager.cpp

@ -366,12 +366,15 @@ Net::ServiceID Net::ServiceID::fromURL(const QUrl &url) @@ -366,12 +366,15 @@ Net::ServiceID Net::ServiceID::fromURL(const QUrl &url)
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
std::size_t Net::qHash(const ServiceID &serviceID, const std::size_t seed)
{
return qHashMulti(seed, serviceID.hostName, serviceID.port);
}
#else
uint Net::qHash(const ServiceID &serviceID, const uint seed)
#endif
{
return ::qHash(serviceID.hostName, seed) ^ ::qHash(serviceID.port);
}
#endif
bool Net::operator==(const ServiceID &lhs, const ServiceID &rhs)
{

5
src/gui/properties/peerlistwidget.cpp

@ -73,12 +73,15 @@ bool operator==(const PeerEndpoint &left, const PeerEndpoint &right) @@ -73,12 +73,15 @@ bool operator==(const PeerEndpoint &left, const PeerEndpoint &right)
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
std::size_t qHash(const PeerEndpoint &peerEndpoint, const std::size_t seed = 0)
{
return qHashMulti(seed, peerEndpoint.address, peerEndpoint.connectionType);
}
#else
uint qHash(const PeerEndpoint &peerEndpoint, const uint seed = 0)
#endif
{
return (qHash(peerEndpoint.address, seed) ^ ::qHash(peerEndpoint.connectionType));
}
#endif
PeerListWidget::PeerListWidget(PropertiesWidget *parent)
: QTreeView(parent)

Loading…
Cancel
Save