roll back the completion changes in r6072; it caused a crash

This commit is contained in:
Charles Kerr 2008-06-09 00:59:33 +00:00
parent a7778f63fa
commit ef3203a765
2 changed files with 4 additions and 14 deletions

View File

@ -179,14 +179,6 @@ tr_cpPieceRem( tr_completion * cp, tr_piece_index_t piece )
tr_bitfieldRem( cp->pieceBitfield, piece );
}
int
tr_cpBlockFindComplete( const tr_completion * cp,
size_t startPos,
size_t * foundPos )
{
return tr_bitfieldFindTrue( cp->blockBitfield, startPos, foundPos );
}
int
tr_cpBlockIsComplete( const tr_completion * cp, tr_block_index_t block )
{
@ -236,13 +228,13 @@ tr_cpBlockBitfieldSet( tr_completion * cp, tr_bitfield * bitfield )
assert( bitfield );
assert( cp->blockBitfield );
if( !cp || !bitfield || ( bitfield->byteCount != cp->blockBitfield->byteCount ) )
if( !cp || !tr_bitfieldTestFast( bitfield, cp->tor->blockCount ) )
return TR_ERROR_ASSERT;
tr_cpReset( cp );
i = 0;
while( tr_bitfieldFindTrue( bitfield, i, &i ) )
tr_cpBlockAdd( cp, i++ );
for( i=0; i<cp->tor->blockCount; ++i )
if( tr_bitfieldHasFast( bitfield, i ) )
tr_cpBlockAdd( cp, i );
return 0;
}

View File

@ -53,8 +53,6 @@ void tr_cpPieceRem( tr_completion *, tr_piece_index_t piece );
/* Blocks */
int tr_cpBlockIsComplete( const tr_completion *, tr_block_index_t block );
int tr_cpBlockFindComplete( const tr_completion * cp,
size_t startPos, size_t* foundPos );
void tr_cpBlockAdd( tr_completion *, tr_block_index_t block );
tr_errno tr_cpBlockBitfieldSet( tr_completion *, struct tr_bitfield * );
int tr_cpMissingBlocksInPiece( const tr_completion * cp,