Changeset 2359


Ignore:
Timestamp:
Jul 15, 2007, 6:47:43 PM (15 years ago)
Author:
charles
Message:

make tr_torrentGetFileStatus() more accurate

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/torrent.c

    r2358 r2359  
    12851285tr_torrentGetFileStatus( const tr_torrent_t * tor, int fileIndex )
    12861286{
    1287     int i;
    1288     int isComplete;
    1289     const tr_file_t * file;
    1290 
    1291     assert( tor != NULL );
    1292     assert( 0<=fileIndex );
    1293     assert( fileIndex<tor->info.fileCount );
    1294 
    1295     file = &tor->info.files[fileIndex];
    1296 
    1297     isComplete = TRUE;
    1298     for( i=file->firstPiece; isComplete && i<=file->lastPiece; ++i )
    1299         if( !tr_cpPieceIsComplete( tor->completion, i ) )
    1300             isComplete = FALSE;
    1301 
    1302     if( isComplete )
     1287    const uint64_t bytes = tr_torrentFileBytesCompleted( tor, fileIndex );
     1288    const tr_file_t * file = &tor->info.files[fileIndex];
     1289
     1290    if( bytes >= file->length )
    13031291        return TR_CP_COMPLETE;
    13041292
Note: See TracChangeset for help on using the changeset viewer.