1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-24 16:52:39 +00:00

(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

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 );