forked from premiere/premiere-libtorrent
fixed assert when using odd piece size
This commit is contained in:
parent
aa5fc72fbf
commit
f223708b0b
|
@ -4940,11 +4940,8 @@ namespace libtorrent
|
||||||
bool in_download_queue = false;
|
bool in_download_queue = false;
|
||||||
int block_size = t->block_size();
|
int block_size = t->block_size();
|
||||||
piece_block last_block(ti.num_pieces()-1
|
piece_block last_block(ti.num_pieces()-1
|
||||||
, (ti.total_size() & (ti.piece_length()-1)) / block_size);
|
, (ti.piece_size(ti.num_pieces()-1) + block_size - 1) / block_size);
|
||||||
if ((ti.total_size() & (ti.piece_length()-1)) == 0)
|
int last_block_size = t->torrent_file().piece_size(ti.num_pieces()-1) - last_block.block_index * block_size;
|
||||||
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;
|
|
||||||
for (std::vector<pending_block>::const_iterator i = m_download_queue.begin()
|
for (std::vector<pending_block>::const_iterator i = m_download_queue.begin()
|
||||||
, end(m_download_queue.end()); i != end; ++i)
|
, end(m_download_queue.end()); i != end; ++i)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue