Ignore:
Timestamp:
Apr 24, 2008, 3:25:01 PM (14 years ago)
Author:
charles
Message:

#894: wont start - cp->doneHave <= cp->completeHave

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/torrent.c

    r5658 r5682  
    726726    tr_file_stat * walk = files;
    727727
    728     for( i=0; i<n; ++i, ++walk )
    729     {
    730         const tr_file * file = tor->info.files + i;
    731 
    732         walk->bytesCompleted = fileBytesCompleted( tor, i );
    733 
    734         walk->progress = file->length
    735             ? walk->bytesCompleted / (float)file->length
    736             : 1.0;
     728    for( i=0; i<n; ++i, ++walk ) {
     729        const uint64_t b = fileBytesCompleted( tor, i );
     730        walk->bytesCompleted = b;
     731        walk->progress = tr_getRatio( b, tor->info.files[i].length );
    737732    }
    738733
     
    778773}
    779774
    780 void tr_torrentAmountFinished( const tr_torrent * tor, float * tab, int size )
    781 {
    782     int i;
    783     float interval;
     775void
     776tr_torrentAmountFinished( const tr_torrent * tor, float * tab, int size )
     777{
    784778    tr_torrentLock( tor );
    785 
    786     interval = (float)tor->info.pieceCount / (float)size;
    787     for( i = 0; i < size; i++ )
    788     {
    789         int piece = i * interval;
    790         tab[i] = tr_cpPercentBlocksInPiece( tor->completion, piece );
    791     }
    792 
     779    tr_cpGetAmountDone( tor->completion, tab, size );
    793780    tr_torrentUnlock( tor );
    794781}
Note: See TracChangeset for help on using the changeset viewer.