Browse Source

Merge pull request #12121 from Chocobo1/idx_type

Use proper type for piece index
adaptive-webui-19844
Mike Tzou 5 years ago committed by GitHub
parent
commit
cc314ae85a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      src/base/bittorrent/peerinfo.cpp

8
src/base/bittorrent/peerinfo.cpp

@ -207,9 +207,15 @@ qlonglong PeerInfo::totalDownload() const
QBitArray PeerInfo::pieces() const QBitArray PeerInfo::pieces() const
{ {
#if (LIBTORRENT_VERSION_NUM < 10200)
using PieceIndex = int;
#else
using PieceIndex = lt::piece_index_t;
#endif
QBitArray result(m_nativeInfo.pieces.size()); QBitArray result(m_nativeInfo.pieces.size());
for (int i = 0; i < result.size(); ++i) { for (int i = 0; i < result.size(); ++i) {
if (m_nativeInfo.pieces[i]) if (m_nativeInfo.pieces[PieceIndex {i}])
result.setBit(i, true); result.setBit(i, true);
} }
return result; return result;

Loading…
Cancel
Save