Changeset 5963


Ignore:
Timestamp:
May 29, 2008, 12:38:31 AM (14 years ago)
Author:
charles
Message:
  • When loading a torrent, warn if no announce URLs are found.
  • When possible, use the torrent name in metainfo warning messages.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/metainfo.c

    r5852 r5963  
    261261        /* did we use any of the tiers? */
    262262        if( !trackerCount ) {
    263             tr_inf( _( "Invalid metadata entry \"%s\"" ), "announce-list" );
     263            tr_nerr( inf->name, _( "Invalid metadata entry \"%s\"" ), "announce-list" );
    264264            tr_free( trackers );
    265265            trackers = NULL;
     
    281281    inf->trackers = trackers;
    282282    inf->trackerCount = trackerCount;
     283
     284    if( !inf->trackerCount )
     285        tr_nerr( inf->name, _( "Invalid metadata entry \"%s\"" ), "announce" );
    283286
    284287    return inf->trackerCount ? TR_OK : TR_ERROR;
     
    349352    {
    350353        if( val )
    351             tr_err( _( "Invalid metadata entry \"%s\"" ), "piece length" );
     354            tr_nerr( inf->name, _( "Invalid metadata entry \"%s\"" ), "piece length" );
    352355        else
    353             tr_err( _( "Missing metadata entry \"%s\"" ), "piece length" );
     356            tr_nerr( inf->name, _( "Missing metadata entry \"%s\"" ), "piece length" );
    354357        goto fail;
    355358    }
     
    361364    {
    362365        if( val )
    363             tr_err( _( "Invalid metadata entry \"%s\"" ), "pieces" );
     366            tr_nerr( inf->name, _( "Invalid metadata entry \"%s\"" ), "pieces" );
    364367        else
    365             tr_err( _( "Missing metadata entry \"%s\"" ), "pieces" );
     368            tr_nerr( inf->name, _( "Missing metadata entry \"%s\"" ), "pieces" );
    366369        goto fail;
    367370    }
    368371    if( val->val.s.i % SHA_DIGEST_LENGTH )
    369372    {
    370         tr_err( _( "Invalid metadata entry \"%s\"" ), "pieces" );
     373        tr_nerr( inf->name, _( "Invalid metadata entry \"%s\"" ), "pieces" );
    371374        goto fail;
    372375    }
     
    392395    if( !inf->fileCount || !inf->totalSize )
    393396    {
    394         tr_err( _( "Torrent is corrupt" ) ); /* the content is missing! */
     397        tr_nerr( inf->name, _( "Torrent is corrupt" ) ); /* the content is missing! */
    395398        goto fail;
    396399    }
     
    401404        ( inf->totalSize + inf->pieceSize - 1 ) / inf->pieceSize )
    402405    {
    403         tr_err( _( "Torrent is corrupt" ) ); /* size of hashes and files don't match */
     406        tr_nerr( inf->name, _( "Torrent is corrupt" ) ); /* size of hashes and files don't match */
    404407        goto fail;
    405408    }
     
    559562            {
    560563                if( path )
    561                     tr_err( _( "Invalid metadata entry \"%s\"" ), "path" );
     564                    tr_nerr( inf->name, _( "Invalid metadata entry \"%s\"" ), "path" );
    562565                else
    563                     tr_err( _( "Missing metadata entry \"%s\"" ), "path" );
     566                    tr_nerr( inf->name, _( "Missing metadata entry \"%s\"" ), "path" );
    564567                return TR_EINVALID;
    565568            }
     
    568571            {
    569572                if( length )
    570                     tr_err( _( "Invalid metadata entry \"%s\"" ), "length" );
     573                    tr_nerr( inf->name, _( "Invalid metadata entry \"%s\"" ), "length" );
    571574                else
    572                     tr_err( _( "Missing metadata entry \"%s\"" ), "length" );
     575                    tr_nerr( inf->name, _( "Missing metadata entry \"%s\"" ), "length" );
    573576                return TR_EINVALID;
    574577            }
     
    599602    else
    600603    {
    601         tr_err( _( "Invalid or missing metadata entries \"length\" and \"files\"" ) );
     604        tr_nerr( inf->name, _( "Invalid or missing metadata entries \"length\" and \"files\"" ) );
    602605    }
    603606
Note: See TracChangeset for help on using the changeset viewer.