Ignore:
Timestamp:
Jan 31, 2008, 3:20:42 PM (14 years ago)
Author:
charles
Message:

more graceful handling of bad inputs to tr_bencFree(), tr_bencSave(), and tr_bencPrint().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/bencode-test.c

    r4878 r4882  
    152152    err = tr_bencParse( buf, buf + sizeof( buf ), &val, &end );
    153153    check( !err );
    154     check( tr_bencIsInt( &val ) );
    155154    check( tr_bencGetInt( &val ) == 64 );
    156155    check( end == buf + 4 );
     
    160159    err = tr_bencParse( buf, buf + sizeof( buf ), &val, &end );
    161160    check( !err );
    162     check( tr_bencIsList( &val ) );
    163161    check( end == buf + strlen( (char*)buf ) );
    164162    check( val.val.l.count == 3 );
     
    205203    check( !err );
    206204    check( end == buf + strlen( (const char*)buf ) );
    207     check( tr_bencIsList( &val ) );
    208205    check(( child = tr_bencListGetNthChild( &val, 0 )));
    209     check( tr_bencIsList( child ) );
    210206    check(( child2 = tr_bencListGetNthChild( child, 0 )));
    211     check( tr_bencIsDict( child2 ) );
    212207    saved = tr_bencSave( &val, &len );
    213208    check( !strcmp( saved, "lld1:ai64e1:bi32eeee" ) );
     
    217212    end = NULL;
    218213    snprintf( (char*)buf, sizeof( buf ), "d8:completei1e8:intervali1800e12:min intervali1800e5:peers0:e" );
    219     err = tr_bencLoad( buf, sizeof( buf ), &val, (char**)&end );
     214    err = tr_bencParse( buf, buf+sizeof( buf ), &val, &end );
    220215    check( !err );
    221216    check( end == buf + strlen( (const char*)buf ) );
     
    246241    err = tr_bencParse( in, in+(depth*2), &val, &end );
    247242    check( !err );
    248     check( tr_bencIsList( &val ) );
    249243    check( end == in+(depth*2) );
    250244    saved = tr_bencSave( &val, &len );
Note: See TracChangeset for help on using the changeset viewer.