Changeset 2075


Ignore:
Timestamp:
Jun 14, 2007, 10:52:11 AM (15 years ago)
Author:
charles
Message:

fix r2019 off-by-one that caused some complete files to incorrectly show up as 99% in tr_torrentFileCompletion()

Location:
branches/file_selection/libtransmission
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/file_selection/libtransmission/completion.c

    r2073 r2075  
    349349    for( i=0; i<info->pieceCount; ++i )
    350350        if( !tr_cpPieceIsComplete( cp, i ) )
    351             b += tor->blockSize * (tr_cpCountBlocks( cp, i ) - cp->completeBlocks[ i ] );
    352 
    353     return b;
     351            b += ( tr_cpCountBlocks( cp, i ) - cp->completeBlocks[ i ] );
     352
     353    return b * tor->blockSize;;
    354354}
    355355
  • branches/file_selection/libtransmission/torrent.c

    r2073 r2075  
    626626    {
    627627        if( tr_cpBlockIsComplete( tor->completion, firstBlock ) )
    628             haveBytes += lastBlockOffset - firstBlockOffset;
     628            haveBytes += lastBlockOffset + 1 - firstBlockOffset;
    629629    }
    630630    else
     
    640640
    641641        if( tr_cpBlockIsComplete( tor->completion, lastBlock ) )
    642             haveBytes += lastBlockOffset;
     642            haveBytes += lastBlockOffset + 1;
    643643    }
    644644
Note: See TracChangeset for help on using the changeset viewer.