fixed assert when using odd piece size

This commit is contained in:
Arvid Norberg 2010-02-23 23:47:40 +00:00
parent aa5fc72fbf
commit f223708b0b
1 changed files with 2 additions and 5 deletions

View File

@ -4940,11 +4940,8 @@ namespace libtorrent
bool in_download_queue = false;
int block_size = t->block_size();
piece_block last_block(ti.num_pieces()-1
, (ti.total_size() & (ti.piece_length()-1)) / block_size);
if ((ti.total_size() & (ti.piece_length()-1)) == 0)
last_block.block_index = (ti.piece_length()-1) / block_size;
int last_block_size = t->torrent_file().total_size() & (block_size-1);
if (last_block_size == 0) last_block_size = block_size;
, (ti.piece_size(ti.num_pieces()-1) + block_size - 1) / block_size);
int last_block_size = t->torrent_file().piece_size(ti.num_pieces()-1) - last_block.block_index * block_size;
for (std::vector<pending_block>::const_iterator i = m_download_queue.begin()
, end(m_download_queue.end()); i != end; ++i)
{