Ignore:
Timestamp:
Mar 30, 2011, 4:14:57 AM (11 years ago)
Author:
jordan
Message:

(trunk libT) handle situations where we don't know the bitfield's upper bound in advance. This comes up sometimes with magnet links.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/resume.c

    r12254 r12262  
    415415    else if( tr_bitfieldHasNone( b ) )
    416416        tr_bencInitStr( benc, "none", 4 );
    417     else
    418         tr_bencInitRaw( benc, b->bits, b->byte_count );
     417    else {
     418        size_t byte_count = 0;
     419        uint8_t * raw = tr_bitfieldGetRaw( b, &byte_count );
     420        tr_bencInitRaw( benc, raw, byte_count );
     421        tr_free( raw );
     422    }
    419423}
    420424
     
    608612        else err = "Couldn't find 'pieces' or 'have' or 'bitfield'";
    609613
    610         if( !err && !tr_cpBlockInit( &tor->completion, &blocks ) )
    611             err = "Error loading bitfield";
    612614        if( err != NULL )
    613615            tr_tordbg( tor, "Torrent needs to be verified - %s", err );
     616        else
     617            tr_cpBlockInit( &tor->completion, &blocks );
    614618
    615619        tr_bitfieldDestruct( &blocks );
Note: See TracChangeset for help on using the changeset viewer.