mirror of
https://github.com/transmission/transmission
synced 2024-12-25 01:03:01 +00:00
fix bug in tr_cpDownloadedValid() that caused download sizes of > 4 GiB to be misreported locally
This commit is contained in:
parent
46dd20b050
commit
3b6b9d3852
1 changed files with 8 additions and 1 deletions
|
@ -318,9 +318,16 @@ tr_cpPercentDone( const tr_completion_t * cp )
|
|||
uint64_t
|
||||
tr_cpDownloadedValid( const tr_completion_t * cp )
|
||||
{
|
||||
uint64_t b = 0;
|
||||
const tr_torrent_t * tor = cp->tor;
|
||||
const tr_info_t * info = &tor->info;
|
||||
int i;
|
||||
|
||||
uint64_t b = tr_bitfieldCountTrueBits( cp->blockBitfield ) * tor->blockSize;
|
||||
for( i=0; i<info->pieceCount; ++i )
|
||||
if( tr_cpPieceIsComplete( cp, i ) )
|
||||
++b;
|
||||
|
||||
b *= tor->blockSize;
|
||||
|
||||
if( tor->blockCount && tr_bitfieldHas( cp->blockBitfield, tor->blockCount - 1 ) )
|
||||
b -= (tor->blockSize - (tor->info.totalSize % tor->blockSize));
|
||||
|
|
Loading…
Reference in a new issue