Changeset 6092


Ignore:
Timestamp:
Jun 9, 2008, 12:59:33 AM (13 years ago)
Author:
charles
Message:

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

Location:
trunk/libtransmission
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/completion.c

    r6072 r6092  
    181181
    182182int
    183 tr_cpBlockFindComplete( const tr_completion * cp,
    184                         size_t                startPos,
    185                         size_t              * foundPos )
    186 {
    187     return tr_bitfieldFindTrue( cp->blockBitfield, startPos, foundPos );
    188 }
    189 
    190 int
    191183tr_cpBlockIsComplete( const tr_completion * cp, tr_block_index_t block )
    192184{
     
    237229    assert( cp->blockBitfield );
    238230
    239     if( !cp || !bitfield || ( bitfield->byteCount != cp->blockBitfield->byteCount ) )
     231    if( !cp || !tr_bitfieldTestFast( bitfield, cp->tor->blockCount ) )
    240232        return TR_ERROR_ASSERT;
    241233
    242234    tr_cpReset( cp );
    243     i = 0;
    244     while( tr_bitfieldFindTrue( bitfield, i, &i ) )
    245         tr_cpBlockAdd( cp, i++ );
     235    for( i=0; i<cp->tor->blockCount; ++i )
     236        if( tr_bitfieldHasFast( bitfield, i ) )
     237            tr_cpBlockAdd( cp, i );
    246238
    247239    return 0;
  • trunk/libtransmission/completion.h

    r6072 r6092  
    5454/* Blocks */
    5555int              tr_cpBlockIsComplete( const tr_completion *, tr_block_index_t block );
    56 int              tr_cpBlockFindComplete( const tr_completion * cp,
    57                                          size_t startPos, size_t* foundPos );
    5856void             tr_cpBlockAdd( tr_completion *, tr_block_index_t block );
    5957tr_errno         tr_cpBlockBitfieldSet( tr_completion *, struct tr_bitfield * );
Note: See TracChangeset for help on using the changeset viewer.