merge bitfield issue fix from RC_0_16

This commit is contained in:
Arvid Norberg 2014-06-11 08:32:24 +00:00
parent 3e5ab73127
commit 6d07af3b57
4 changed files with 6 additions and 4 deletions

View File

@ -54,6 +54,7 @@
* fix uTP edge case where udp socket buffer fills up
* fix nagle implementation in uTP
* fix bitfield issue in file_storage
* added work-around for MingW issue in file I/O
* fixed sparse file detection on windows
* fixed bug in gunzip

View File

@ -119,6 +119,7 @@ namespace libtorrent
// for torrent_info::invariant_check
friend class torrent_info;
#endif
internal_file_entry()
: offset(0)
, symlink_index(not_a_symlink)

View File

@ -329,7 +329,7 @@ namespace libtorrent
file_slice f;
f.file_index = file_iter - m_files.begin();
f.offset = file_offset + file_base(f.file_index);
f.size = (std::min)(size_type(file_iter->size) - file_offset, (size_type)size);
f.size = (std::min)(boost::uint64_t(file_iter->size) - file_offset, boost::uint64_t(size));
TORRENT_ASSERT(f.size <= size);
size -= int(f.size);
file_offset += f.size;
@ -426,7 +426,7 @@ namespace libtorrent
e.hidden_attribute = (flags & attribute_hidden) != 0;
e.executable_attribute = (flags & attribute_executable) != 0;
e.symlink_attribute = (flags & attribute_symlink) != 0;
if (e.symlink_attribute)
if (e.symlink_attribute && m_symlinks.size() < internal_file_entry::not_a_symlink - 1)
{
e.symlink_index = m_symlinks.size();
m_symlinks.push_back(symlink_path);
@ -469,7 +469,7 @@ namespace libtorrent
if (m_file_hashes.size() < m_files.size()) m_file_hashes.resize(m_files.size());
m_file_hashes[m_files.size() - 1] = filehash;
}
if (!ent.symlink_path.empty())
if (!ent.symlink_path.empty() && m_symlinks.size() < internal_file_entry::not_a_symlink - 1)
{
e.symlink_index = m_symlinks.size();
m_symlinks.push_back(ent.symlink_path);

View File

@ -3142,7 +3142,7 @@ namespace libtorrent
size_type file_offset = off - fs.file_offset(file_index);
TORRENT_ASSERT(file_index != fs.num_files());
TORRENT_ASSERT(file_offset <= fs.file_size(file_index));
int add = (std::min)(fs.file_size(file_index) - file_offset, (size_type)size);
int add = (std::min)(fs.file_size(file_index) - file_offset, size_type(size));
m_file_progress[file_index] += add;
TORRENT_ASSERT(m_file_progress[file_index]