Bump requirement to libtorrent 1.2

Closes #12258.
This commit is contained in:
Chocobo1
2020-06-26 08:05:09 +08:00
parent 06e1b07274
commit 40e432b127
25 changed files with 92 additions and 756 deletions

View File

@@ -28,8 +28,6 @@
#include "peerinfo.h"
#include <libtorrent/version.hpp>
#include <QBitArray>
#include "base/bittorrent/torrenthandle.h"
@@ -211,15 +209,9 @@ qlonglong PeerInfo::totalDownload() 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());
for (int i = 0; i < result.size(); ++i) {
if (m_nativeInfo.pieces[PieceIndex {i}])
if (m_nativeInfo.pieces[lt::piece_index_t {i}])
result.setBit(i, true);
}
return result;