merged fixes from RC_0_16

This commit is contained in:
Arvid Norberg 2014-03-06 10:06:41 +00:00
parent cff82fa319
commit b643962bfe
2 changed files with 6 additions and 6 deletions

View File

@ -605,17 +605,17 @@ namespace libtorrent
int default_storage::sparse_end(int slot) const int default_storage::sparse_end(int slot) const
{ {
TORRENT_ASSERT(slot >= 0); TORRENT_ASSERT(slot >= 0);
TORRENT_ASSERT(slot < m_files.num_pieces()); TORRENT_ASSERT(slot < files().num_pieces());
size_type file_offset = (size_type)slot * m_files.piece_length(); size_type file_offset = (size_type)slot * files().piece_length();
int file_index = 0; int file_index = 0;
for (;;) for (;;)
{ {
if (file_offset < m_files.file_size(file_index)) if (file_offset < files().file_size(file_index))
break; break;
file_offset -= m_files.file_size(file_index); file_offset -= files().file_size(file_index);
++file_index; ++file_index;
TORRENT_ASSERT(file_index != files().num_files()); TORRENT_ASSERT(file_index != files().num_files());
} }
@ -625,7 +625,7 @@ namespace libtorrent
if (!file_handle || ec) return slot; if (!file_handle || ec) return slot;
size_type data_start = file_handle->sparse_end(file_offset); size_type data_start = file_handle->sparse_end(file_offset);
return int((data_start + m_files.piece_length() - 1) / m_files.piece_length()); return int((data_start + files().piece_length() - 1) / files().piece_length());
} }
bool default_storage::verify_resume_data(lazy_entry const& rd, error_code& error) bool default_storage::verify_resume_data(lazy_entry const& rd, error_code& error)

View File

@ -42,7 +42,7 @@ test_programs = \
test_utp \ test_utp \
test_session \ test_session \
test_ssl \ test_ssl \
test_web_seed test_web_seed \
test_remap_files test_remap_files
if ENABLE_TESTS if ENABLE_TESTS