Torrent: simplify QBitArray usage
There is specific API for counting number of 0-bits Task-number: QTBUG-110622 Change-Id: Ifa33862ff7b98a59f362bc52c492e8a037799835 Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit d3c14454198d126a8d92c51a917fff556bdd596c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
c86ea25b60
commit
a1383e57d1
@ -1024,13 +1024,7 @@ void TorrentClient::peerWireBytesReceived(qint64 size)
|
||||
|
||||
int TorrentClient::blocksLeftForPiece(const TorrentPiece *piece) const
|
||||
{
|
||||
int blocksLeft = 0;
|
||||
int completedBlocksSize = piece->completedBlocks.size();
|
||||
for (int i = 0; i < completedBlocksSize; ++i) {
|
||||
if (!piece->completedBlocks.testBit(i))
|
||||
++blocksLeft;
|
||||
}
|
||||
return blocksLeft;
|
||||
return piece->completedBlocks.count(false);
|
||||
}
|
||||
|
||||
void TorrentClient::scheduleUploads()
|
||||
|
Loading…
x
Reference in New Issue
Block a user