Changeset 6840
- Timestamp:
- Oct 2, 2008, 11:37:58 PM (13 years ago)
- Location:
- trunk/libtransmission
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/completion.c
r6795 r6840 234 234 } 235 235 236 tr_errno 236 int 237 237 tr_cpBlockBitfieldSet( tr_completion * cp, 238 238 tr_bitfield * bitfield ) 239 239 { 240 tr_block_index_t i;240 int success = FALSE; 241 241 242 242 assert( cp ); … … 244 244 assert( cp->blockBitfield ); 245 245 246 if( !tr_bitfieldTestFast( bitfield, cp->tor->blockCount - 1 ) ) 247 return TR_ERROR_ASSERT; 248 249 tr_cpReset( cp ); 250 for( i = 0; i < cp->tor->blockCount; ++i ) 251 if( tr_bitfieldHasFast( bitfield, i ) ) 252 tr_cpBlockAdd( cp, i ); 253 254 return 0; 246 if( tr_bitfieldTestFast( bitfield, cp->tor->blockCount - 1 ) ) 247 { 248 tr_block_index_t i; 249 tr_cpReset( cp ); 250 for( i = 0; i < cp->tor->blockCount; ++i ) 251 if( tr_bitfieldHasFast( bitfield, i ) ) 252 tr_cpBlockAdd( cp, i ); 253 success = TRUE; 254 } 255 256 return success; 255 257 } 256 258 -
trunk/libtransmission/completion.h
r6795 r6840 55 55 void tr_cpInvalidateDND( tr_completion * ); 56 56 57 void tr_cpGetAmountDone( const tr_completion * ,58 float * tab,59 int tabCount );57 void tr_cpGetAmountDone( const tr_completion * completion, 58 float * tab, 59 int tabCount ); 60 60 61 61 /* Pieces */ 62 int tr_cpPieceIsComplete( 63 const tr_completion *, 64 tr_piece_index_t piece ); 62 int tr_cpPieceIsComplete( const tr_completion * completion, 63 tr_piece_index_t piece ); 65 64 66 void tr_cpPieceAdd( 67 tr_completion *, 68 tr_piece_index_t piece ); 65 void tr_cpPieceAdd( tr_completion * completion, 66 tr_piece_index_t piece ); 69 67 70 void tr_cpPieceRem( 71 tr_completion *, 72 tr_piece_index_t piece ); 68 void tr_cpPieceRem( tr_completion * completion, 69 tr_piece_index_t piece ); 73 70 74 71 /* Blocks */ 75 int tr_cpBlockIsComplete( 76 const tr_completion *, 77 tr_block_index_t block ); 72 int tr_cpBlockIsComplete( const tr_completion * completion, 73 tr_block_index_t block ); 78 74 79 void tr_cpBlockAdd( 80 tr_completion *, 81 tr_block_index_t block ); 75 void tr_cpBlockAdd( tr_completion * completion, 76 tr_block_index_t block ); 82 77 83 tr_errno tr_cpBlockBitfieldSet( 84 tr_completion *, 85 struct tr_bitfield 86 * ); 78 int tr_cpBlockBitfieldSet( tr_completion * completion, 79 struct tr_bitfield * blocks ); 87 80 88 int tr_cpMissingBlocksInPiece( 89 const tr_completion * cp, 90 tr_piece_index_t 91 piece ); 81 int tr_cpMissingBlocksInPiece( const tr_completion * completion, 82 tr_piece_index_t piece ); 92 83 93 84 -
trunk/libtransmission/fastresume.c
r6832 r6840 483 483 bitfield.bitCount = bitfield.byteCount * 8; 484 484 bitfield.bits = (uint8_t*) walk; 485 if( !tr_cpBlockBitfieldSet( tor->completion, &bitfield ) )485 if( tr_cpBlockBitfieldSet( tor->completion, &bitfield ) ) 486 486 ret = TR_FR_PROGRESS; 487 else 488 { 487 else { 489 488 tr_torrentUncheck( tor ); 490 489 tr_tordbg( tor, "Torrent needs to be verified" ); -
trunk/libtransmission/resume.c
r6832 r6840 354 354 tmp.bitCount = tmp.byteCount * 8; 355 355 tmp.bits = (uint8_t*) raw; 356 if( tr_cpBlockBitfieldSet( tor->completion, &tmp ) )356 if( !tr_cpBlockBitfieldSet( tor->completion, &tmp ) ) 357 357 { 358 358 tr_torrentUncheck( tor );
Note: See TracChangeset
for help on using the changeset viewer.