Changeset 2348 for trunk/libtransmission/completion.c
- Timestamp:
- Jul 15, 2007, 3:52:51 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/completion.c
r2316 r2348 116 116 117 117 cp->completeBlocks[piece] = n_blocks; 118 tr_bitfieldAddRange( cp->blockBitfield, startBlock, endBlock -1);118 tr_bitfieldAddRange( cp->blockBitfield, startBlock, endBlock ); 119 119 tr_bitfieldAdd( cp->pieceBitfield, piece ); 120 120 } … … 128 128 129 129 cp->completeBlocks[piece] = 0; 130 tr_bitfieldRemRange ( cp->blockBitfield, startBlock, endBlock -1);130 tr_bitfieldRemRange ( cp->blockBitfield, startBlock, endBlock ); 131 131 tr_bitfieldRem( cp->pieceBitfield, piece ); 132 132 } … … 323 323 b *= tor->blockSize; 324 324 325 if( !tr_cpBlockIsComplete( cp, tor->blockCount - 1 ) )326 b -= (tor->blockSize - (tor->info.totalSize % tor->blockSize));325 if( tor->blockCount && !tr_cpBlockIsComplete( cp, tor->blockCount - 1 ) ) 326 b -= (tor->blockSize - (tor->info.totalSize % tor->blockSize)); 327 327 328 328 return b; … … 349 349 b *= tor->blockSize; 350 350 351 i = tor->blockCount - 1;352 if( !tr_cpBlockIsComplete( cp, tor->blockCount-1 )&& !info->pieces[info->pieceCount-1].dnd )353 b -= (tor->blockSize - (tor->info.totalSize % tor->blockSize));351 if( tor->blockCount && !tr_cpBlockIsComplete( cp, tor->blockCount-1 ) 352 && !info->pieces[info->pieceCount-1].dnd ) 353 b -= (tor->blockSize - (tor->info.totalSize % tor->blockSize)); 354 354 355 355 return b; … … 381 381 uint64_t b = tr_bitfieldCountTrueBits( cp->blockBitfield ) * tor->blockSize; 382 382 383 if( t r_bitfieldHas( cp->blockBitfield, tor->blockCount - 1 ) )383 if( tor->blockCount && tr_bitfieldHas( cp->blockBitfield, tor->blockCount - 1 ) ) 384 384 b -= (tor->blockSize - (tor->info.totalSize % tor->blockSize)); 385 385
Note: See TracChangeset
for help on using the changeset viewer.