Ignore:
Timestamp:
Jun 18, 2007, 5:05:16 AM (15 years ago)
Author:
charles
Message:

Fix very large file error reported by Gimp_

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/torrent.c

    r2149 r2152  
    617617}
    618618
    619 size_t
     619uint64_t
    620620tr_torrentFileBytesCompleted ( const tr_torrent_t * tor, int fileIndex )
    621621{
    622     const tr_file_t * file     = &tor->info.files[fileIndex];
    623     const int firstBlock       =  file->offset / tor->blockSize;
    624     const int firstBlockOffset =  file->offset % tor->blockSize;
    625     const int lastOffset       =  file->length ? file->length-1 : 0;
    626     const int lastBlock        = (file->offset + lastOffset) / tor->blockSize;
    627     const int lastBlockOffset  = (file->offset + lastOffset) % tor->blockSize;
    628     size_t haveBytes = 0;
     622    const tr_file_t * file     =  &tor->info.files[fileIndex];
     623    const uint64_t firstBlock       =  file->offset / tor->blockSize;
     624    const uint64_t firstBlockOffset =  file->offset % tor->blockSize;
     625    const uint64_t lastOffset       =  file->length ? (file->length-1) : 0;
     626    const uint64_t lastBlock        = (file->offset + lastOffset) / tor->blockSize;
     627    const uint64_t lastBlockOffset  = (file->offset + lastOffset) % tor->blockSize;
     628    uint64_t haveBytes = 0;
    629629
    630630    assert( tor != NULL );
    631631    assert( 0<=fileIndex && fileIndex<tor->info.fileCount );
    632632    assert( file->offset + file->length <= tor->info.totalSize );
    633     assert( 0<=firstBlock && firstBlock<tor->blockCount );
    634     assert( 0<=lastBlock && lastBlock<tor->blockCount );
     633    assert( (int)firstBlock < tor->blockCount );
     634    assert( (int)lastBlock < tor->blockCount );
    635635    assert( firstBlock <= lastBlock );
    636636    assert( tr_blockPiece( firstBlock ) == file->firstPiece );
     
    644644    else
    645645    {
    646         int i;
     646        uint64_t i;
    647647
    648648        if( tr_cpBlockIsComplete( tor->completion, firstBlock ) )
     
    663663tr_torrentFileCompletion ( const tr_torrent_t * tor, int fileIndex )
    664664{
    665     const size_t c = tr_torrentFileBytesCompleted ( tor, fileIndex );
    666     return (float)c / tor->info.files[fileIndex].length;
     665    const uint64_t c = tr_torrentFileBytesCompleted ( tor, fileIndex );
     666    return (double)c / tor->info.files[fileIndex].length;
    667667}
    668668
Note: See TracChangeset for help on using the changeset viewer.