(trunk libT) #1794: possible fix -- better handling of zero-size files

This commit is contained in:
Charles Kerr 2009-01-25 04:22:11 +00:00
parent 73265333c8
commit f47cc0cf4d
1 changed files with 1 additions and 1 deletions

View File

@ -324,7 +324,7 @@ tr_cpFileIsComplete( const tr_completion * cp, tr_file_index_t fileIndex )
const tr_torrent * tor = cp->tor;
const tr_file * file = &tor->info.files[fileIndex];
const tr_block_index_t firstBlock = file->offset / tor->blockSize;
const tr_block_index_t lastBlock = ( file->offset + file->length - 1 ) / tor->blockSize;
const tr_block_index_t lastBlock = file->length ? ( ( file->offset + file->length - 1 ) / tor->blockSize ) : firstBlock;
assert( tr_torBlockPiece( tor, firstBlock ) == file->firstPiece );
assert( tr_torBlockPiece( tor, lastBlock ) == file->lastPiece );