Ignore:
Timestamp:
Jul 10, 2008, 8:59:15 PM (14 years ago)
Author:
charles
Message:

(daemon) let file download flags and priorities be set by transmission-remote. Add examples to the man page and --help.
(libT) minor tweaks to tr-getopt
(gtk) tweak the preference dialog's "port forwarding" text for clarity as suggested in the forums

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/rpc.c

    r6311 r6316  
    339339    int fileCount = 0;
    340340    const int n = tr_bencListSize( list );
    341     tr_file_index_t * files = tr_new0( tr_file_index_t, n );
    342 
    343     for( i=0; i<n; ++i )
    344         if( tr_bencGetInt( tr_bencListChild( list, i ), &tmp ) )
    345             files[fileCount++] = tmp;
     341    tr_file_index_t * files = tr_new0( tr_file_index_t, tor->info.fileCount );
     342
     343    if( n )
     344    {
     345        for( i=0; i<n; ++i )
     346            if( tr_bencGetInt( tr_bencListChild( list, i ), &tmp ) )
     347                if( 0<=tmp && tmp<tor->info.fileCount )
     348                    files[fileCount++] = tmp;
     349    }
     350    else // if empty set, apply to all
     351    {
     352        tr_file_index_t t;
     353        for( t=0; t<tor->info.fileCount; ++t )
     354            files[fileCount++] = t;
     355    }
    346356
    347357    if( fileCount )
     
    358368    int fileCount = 0;
    359369    const int n = tr_bencListSize( list );
    360     tr_file_index_t * files = tr_new0( tr_file_index_t, n );
    361 
    362     for( i=0; i<n; ++i )
    363         if( tr_bencGetInt( tr_bencListChild( list, i ), &tmp ) )
    364             files[fileCount++] = tmp;
     370    tr_file_index_t * files = tr_new0( tr_file_index_t, tor->info.fileCount );
     371
     372    if( n ) // if argument list, process them
     373    {
     374        for( i=0; i<n; ++i )
     375            if( tr_bencGetInt( tr_bencListChild( list, i ), &tmp ) )
     376                if( 0<=tmp && tmp<tor->info.fileCount )
     377                    files[fileCount++] = tmp;
     378    }
     379    else // if empty set, apply to all
     380    {
     381        tr_file_index_t t;
     382        for( t=0; t<tor->info.fileCount; ++t )
     383            files[fileCount++] = t;
     384    }
    365385
    366386    if( fileCount )
Note: See TracChangeset for help on using the changeset viewer.