file_progress fix

This commit is contained in:
Arvid Norberg 2008-07-13 07:58:32 +00:00
parent 4ee16ef247
commit 8fd33d65f1
1 changed files with 3 additions and 2 deletions

View File

@ -4154,10 +4154,11 @@ namespace libtorrent
{
int left_over = m_block_size - block_size;
// split the block on multiple files
while (offset + block_size > file->offset + file->size)
while (offset + block_size >= file->offset + file->size)
{
TORRENT_ASSERT(offset <= file->offset + file->size);
size_type slice = file->offset + file->size - offset;
size_type slice = (std::min)(file->offset + file->size - offset
, block_size);
fp[file_index] += slice;
offset += slice;
block_size -= slice;