mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-15 09:43:07 -07:00
Merge pull request #12121 from Chocobo1/idx_type
Use proper type for piece index
This commit is contained in:
commit
cc314ae85a
1 changed files with 7 additions and 1 deletions
|
@ -207,9 +207,15 @@ 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[i])
|
||||
if (m_nativeInfo.pieces[PieceIndex {i}])
|
||||
result.setBit(i, true);
|
||||
}
|
||||
return result;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue