1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-24 16:52:39 +00:00

fix bug in tr_cpDownloadedValid() that caused download sizes of > 4 GiB to be misreported locally

This commit is contained in:
Charles Kerr 2007-07-26 19:15:36 +00:00
parent 46dd20b050
commit 3b6b9d3852

View file

@ -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));