Changeset 5184


Ignore:
Timestamp:
Mar 2, 2008, 7:55:04 PM (14 years ago)
Author:
charles
Message:

remove scaffolding that was accidentally committed in r5183 a few minutes ago

Location:
trunk/libtransmission
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/bencode.c

    r5183 r5184  
    9696    begin = buf + 1;
    9797    end = memchr( begin, 'e', (bufend-buf)-1 );
    98     if( end == NULL ) {
    99         fprintf( stderr, "%s:%d\n", __FILE__, __LINE__ );
     98    if( end == NULL )
    10099        return TR_ERROR;
    101     }
    102100
    103101    errno = 0;
    104102    val = strtoll( begin, &endptr, 10 );
    105     if( errno || ( endptr != end ) ) { /* incomplete parse */
    106         fprintf( stderr, "Unable to parse int [%*.*s]\n", (int)(end-begin), (int)(end-begin), (const char*)begin );
    107         if( errno )
    108             fprintf( stderr, "errno is %d (%s)\n", errno, strerror(errno) );
    109         fprintf( stderr, "%s:%d\n", __FILE__, __LINE__ );
     103    if( errno || ( endptr != end ) ) /* incomplete parse */
    110104        err = TR_ERROR;
    111     }
    112     else if( val && *(const char*)begin=='0' ) { /* no leading zeroes! */
    113         fprintf( stderr, "%s:%d\n", __FILE__, __LINE__ );
     105    else if( val && *(const char*)begin=='0' ) /* no leading zeroes! */
    114106        err = TR_ERROR;
    115     }
    116107    else {
    117108        *setme_end = end + 1;
     
    147138
    148139    end = memchr( buf, ':', bufend-buf );
    149     if( end == NULL ) {
    150         fprintf( stderr, "%s:%d\n", __FILE__, __LINE__ );
     140    if( end == NULL )
    151141        return TR_ERROR;
    152     }
    153142
    154143    errno = 0;
    155144    len = strtoul( (const char*)buf, &endptr, 10 );
    156     if( errno || endptr!=end ) {
    157         fprintf( stderr, "%s:%d\n", __FILE__, __LINE__ );
     145    if( errno || endptr!=end )
    158146        return TR_ERROR;
    159     }
    160 
    161     if( (const uint8_t*)end + 1 + len > bufend ) {
    162         fprintf( stderr, "%s:%d\n", __FILE__, __LINE__ );
     147
     148    if( (const uint8_t*)end + 1 + len > bufend )
    163149        return TR_ERROR;
    164     }
    165150
    166151    *setme_end = end + 1 + len;
     
    333318tr_bencLoad( const void  * buf_in,
    334319             int           buflen,
    335              tr_benc     * setme_benc,
     320             tr_benc  * setme_benc,
    336321             char       ** setme_end )
    337322{
     
    339324    const uint8_t * end;
    340325    const int ret = tr_bencParse( buf, buf+buflen, setme_benc, &end );
    341 fprintf( stderr, "tried to parse len %d\n", buflen );
    342326    if( !ret && setme_end )
    343327        *setme_end = (char*) end;
    344 fprintf( stderr, "tr_bencLoad returning %d\n", ret );
    345328    return ret;
    346329}
  • trunk/libtransmission/metainfo.c

    r5183 r5184  
    5555
    5656    success = parseURL( url, host, &port, &path );
    57     if( !success )
    58         tr_err( "Can't parse URL \"%s\"", url );
    59     else {
     57
     58    if( success ) {
    6059        *setme_host = tr_strdup( host );
    6160        *setme_port = port;
     
    178177    char buf[4096];
    179178
    180 fprintf( stderr, "%s:%d\n", __FILE__, __LINE__ );
    181179    /* info_hash: urlencoded 20-byte SHA1 hash of the value of the info key
    182180     * from the Metainfo file. Note that the value will be a bencoded
     
    188186        tr_sha1( inf->hash, str, len, NULL );
    189187        tr_free( str );
    190 fprintf( stderr, "%s:%d\n", __FILE__, __LINE__ );
    191188    }
    192189    else
    193190    {
    194191        tr_err( "info dictionary not found!" );
    195 fprintf( stderr, "%s:%d\n", __FILE__, __LINE__ );
    196         return TR_EINVALID;
    197     }
    198 
    199 fprintf( stderr, "%s:%d\n", __FILE__, __LINE__ );
     192        return TR_EINVALID;
     193    }
     194
    200195    tr_sha1_to_hex( inf->hashString, inf->hash );
    201196    savedname( inf->torrent, sizeof( inf->torrent ), inf->hashString, tag );
    202 fprintf( stderr, "%s:%d\n", __FILE__, __LINE__ );
    203197
    204198    /* comment */
     
    207201    if( val && val->type == TYPE_STR )
    208202        strlcat_utf8( buf, val->val.s.s, sizeof( buf ), 0 );
    209 fprintf( stderr, "%s:%d\n", __FILE__, __LINE__ );
    210203    tr_free( inf->comment );
    211204    inf->comment = tr_strdup( buf );
    212205   
    213 fprintf( stderr, "%s:%d\n", __FILE__, __LINE__ );
    214206    /* creator */
    215207    memset( buf, '\0', sizeof( buf ) );
     
    217209    if( val && val->type == TYPE_STR )
    218210        strlcat_utf8( buf, val->val.s.s, sizeof( buf ), 0 );
    219 fprintf( stderr, "%s:%d\n", __FILE__, __LINE__ );
    220211    tr_free( inf->creator );
    221212    inf->creator = tr_strdup( buf );
     
    224215    inf->dateCreated = 0;
    225216    val = tr_bencDictFind( meta, "creation date" );
    226 fprintf( stderr, "%s:%d\n", __FILE__, __LINE__ );
    227217    if( NULL != val && TYPE_INT == val->type )
    228218    {
    229 fprintf( stderr, "%s:%d\n", __FILE__, __LINE__ );
    230219        inf->dateCreated = val->val.i;
    231220    }
     
    234223    val  = tr_bencDictFind( beInfo, "private" );
    235224    val2 = tr_bencDictFind( meta,  "private" );
    236 fprintf( stderr, "%s:%d\n", __FILE__, __LINE__ );
    237225    if( ( NULL != val  && ( TYPE_INT != val->type  || 0 != val->val.i ) ) ||
    238226        ( NULL != val2 && ( TYPE_INT != val2->type || 0 != val2->val.i ) ) )
    239227    {
    240 fprintf( stderr, "%s:%d\n", __FILE__, __LINE__ );
    241228        inf->isPrivate = 1;
    242229    }
     
    244231    /* Piece length */
    245232    val = tr_bencDictFind( beInfo, "piece length" );
    246 fprintf( stderr, "%s:%d\n", __FILE__, __LINE__ );
    247233    if( NULL == val || TYPE_INT != val->type )
    248234    {
    249 fprintf( stderr, "%s:%d\n", __FILE__, __LINE__ );
    250235        tr_err( "%s \"piece length\" entry", ( val ? "Invalid" : "Missing" ) );
    251236        goto fail;
    252237    }
    253 fprintf( stderr, "%s:%d\n", __FILE__, __LINE__ );
    254238    inf->pieceSize = val->val.i;
    255239
    256240    /* Hashes */
    257241    val = tr_bencDictFind( beInfo, "pieces" );
    258 fprintf( stderr, "%s:%d\n", __FILE__, __LINE__ );
    259242    if( NULL == val || TYPE_STR != val->type )
    260243    {
    261 fprintf( stderr, "%s:%d\n", __FILE__, __LINE__ );
    262244        tr_err( "%s \"pieces\" entry", ( val ? "Invalid" : "Missing" ) );
    263245        goto fail;
    264246    }
    265 fprintf( stderr, "%s:%d\n", __FILE__, __LINE__ );
    266247    if( val->val.s.i % SHA_DIGEST_LENGTH )
    267248    {
    268 fprintf( stderr, "%s:%d\n", __FILE__, __LINE__ );
    269249        tr_err( "Invalid \"piece\" string (size is %d)", val->val.s.i );
    270250        goto fail;
    271251    }
    272 fprintf( stderr, "%s:%d\n", __FILE__, __LINE__ );
    273252    inf->pieceCount = val->val.s.i / SHA_DIGEST_LENGTH;
    274253
     
    282261    /* get file or top directory name */
    283262    val = tr_bencDictFindFirst( beInfo, "name.utf-8", "name", NULL );
    284 fprintf( stderr, "%s:%d\n", __FILE__, __LINE__ );
    285263    if( parseFiles( inf, tr_bencDictFindFirst( beInfo,
    286264                                               "name.utf-8", "name", NULL ),
     
    288266                    tr_bencDictFind( beInfo, "length" ) ) )
    289267    {
    290 fprintf( stderr, "%s:%d\n", __FILE__, __LINE__ );
    291268        goto fail;
    292269    }
    293 fprintf( stderr, "%s:%d\n", __FILE__, __LINE__ );
    294270
    295271    if( !inf->fileCount )
    296272    {
    297 fprintf( stderr, "%s:%d\n", __FILE__, __LINE__ );
    298273        tr_err( "Torrent has no files." );
    299274        goto fail;
    300275    }
    301 fprintf( stderr, "%s:%d\n", __FILE__, __LINE__ );
    302276
    303277    if( !inf->totalSize )
    304278    {
    305 fprintf( stderr, "%s:%d\n", __FILE__, __LINE__ );
    306279        tr_err( "Torrent is zero bytes long." );
    307280        goto fail;
    308281    }
    309 fprintf( stderr, "%s:%d\n", __FILE__, __LINE__ );
    310282
    311283    /* TODO add more tests so we don't crash on weird files */
    312284
    313 fprintf( stderr, "%s:%d\n", __FILE__, __LINE__ );
    314285    if( (uint64_t) inf->pieceCount !=
    315286        ( inf->totalSize + inf->pieceSize - 1 ) / inf->pieceSize )
    316287    {
    317 fprintf( stderr, "%s:%d\n", __FILE__, __LINE__ );
    318288        tr_err( "Size of hashes and files don't match" );
    319289        goto fail;
    320290    }
    321291
    322 fprintf( stderr, "%s:%d\n", __FILE__, __LINE__ );
    323292    /* get announce or announce-list */
    324293    if( getannounce( inf, meta ) )
    325294    {
    326 fprintf( stderr, "%s:%d\n", __FILE__, __LINE__ );
    327295        goto fail;
    328296    }
    329297
    330 fprintf( stderr, "%s:%d\n", __FILE__, __LINE__ );
    331298    return TR_OK;
    332299
    333 fprintf( stderr, "%s:%d\n", __FILE__, __LINE__ );
    334300  fail:
    335301    tr_metainfoFree( inf );
     
    534500
    535501        if( tr_httpParseUrl( pch, -1, &address, &port, &announce ) )
     502        {
     503            tr_err( "Invalid announce URL (%s)", val->val.s.s );
    536504            return TR_EINVALID;
    537 
     505        }
    538506        sublist                   = calloc( 1, sizeof( sublist[0] ) );
    539507        sublist[0].address        = address;
  • trunk/libtransmission/torrent.c

    r5183 r5184  
    419419    memset( setmeInfo, 0, sizeof( tr_info ) );
    420420
    421     if( !err && tr_ctorGetMetainfo( ctor, &metainfo ) ) {
    422 fprintf( stderr, "%s:%d can't get metainfo\n", __FILE__, __LINE__ );
     421    if( !err && tr_ctorGetMetainfo( ctor, &metainfo ) )
    423422        return TR_EINVALID;
    424     }
    425423
    426424    err = tr_metainfoParse( setmeInfo, metainfo, handle->tag );
    427 fprintf( stderr, "%s:%d err %d\n", __FILE__, __LINE__, err );
    428425    doFree = !err && ( setmeInfo == &tmp );
    429426
    430427    if( !err && hashExists( handle, setmeInfo->hash ) ) {
    431428        err = TR_EDUPLICATE;
    432 fprintf( stderr, "%s:%d err %d\n", __FILE__, __LINE__, err );
    433429        doFree = 1;
    434430    }
     
    437433        tr_metainfoFree( setmeInfo );
    438434
    439 fprintf( stderr, "%s:%d err %d\n", __FILE__, __LINE__, err );
    440435    return err;
    441436}
     
    451446
    452447    err = tr_torrentParse( handle, ctor, &tmpInfo );
    453 fprintf( stderr, "%s:%d, err %d\n", __FILE__, __LINE__, err );
    454448    if( !err ) {
    455449        tor = tr_new0( tr_torrent, 1 );
    456450        tor->info = tmpInfo;
    457451        torrentRealInit( handle, tor, ctor );
    458 fprintf( stderr, "%s:%d, tor %p\n", __FILE__, __LINE__, tor );
    459452    } else if( setmeError ) {
    460 fprintf( stderr, "err is %d\n", err );
    461453        *setmeError = err;
    462454    }
    463455
    464 fprintf( stderr, "returning torrent %p\n", tor );
    465456    return tor;
    466457}
Note: See TracChangeset for help on using the changeset viewer.