Ignore:
Timestamp:
Jul 15, 2007, 8:05:32 PM (15 years ago)
Author:
charles
Message:

replace tr_torrentGetFileStatus() with tr_torrentFiles() for BMW

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/torrent.c

    r2360 r2361  
    630630    return s;
    631631}
     632
     633/***
     634****
     635***/
     636
     637tr_file_stat_t *
     638tr_torrentFiles( const tr_torrent_t * tor, int * fileCount )
     639{
     640    int i;
     641    const int n = tor->info.fileCount;
     642    tr_file_stat_t * files = tr_new0( tr_file_stat_t, n );
     643    tr_file_stat_t * walk = files;
     644
     645    for( i=0; i<n; ++i, ++walk )
     646    {
     647        const uint64_t length = tor->info.files[i].length;
     648        cp_status_t cp;
     649
     650        walk->bytesCompleted = tr_torrentFileBytesCompleted( tor, i );
     651
     652        walk->progress = walk->bytesCompleted / (float)length;
     653
     654        if( walk->bytesCompleted >= length )
     655            cp = TR_CP_COMPLETE;
     656        else if( tor->info.files[i].dnd )
     657            cp = TR_CP_DONE;
     658        else
     659            cp = TR_CP_INCOMPLETE;
     660
     661        walk->completionStatus = cp;
     662    }
     663
     664    *fileCount = n;
     665
     666    return files;
     667}
     668
     669void
     670tr_torrentFilesFree( tr_file_stat_t * files, int fileCount UNUSED )
     671{
     672    tr_free( files );
     673}
     674
     675/***
     676****
     677***/
    632678
    633679tr_peer_stat_t *
     
    12821328    tr_torrentWriterUnlock( tor );
    12831329}
    1284 
    1285 cp_status_t
    1286 tr_torrentGetFileStatus( const tr_torrent_t * tor, int fileIndex )
    1287 {
    1288     const uint64_t bytes = tr_torrentFileBytesCompleted( tor, fileIndex );
    1289     const tr_file_t * file = &tor->info.files[fileIndex];
    1290 
    1291     if( bytes >= file->length )
    1292         return TR_CP_COMPLETE;
    1293 
    1294     if( file->dnd )
    1295         return TR_CP_DONE;
    1296 
    1297     return TR_CP_INCOMPLETE;
    1298 }
Note: See TracChangeset for help on using the changeset viewer.