diff --git a/ChangeLog b/ChangeLog index 6e3e366aa..6a61cc1dc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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 diff --git a/include/libtorrent/file_storage.hpp b/include/libtorrent/file_storage.hpp index ac9ccbe73..8c626866c 100644 --- a/include/libtorrent/file_storage.hpp +++ b/include/libtorrent/file_storage.hpp @@ -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) diff --git a/src/file_storage.cpp b/src/file_storage.cpp index 9fd79a560..49e7be21c 100644 --- a/src/file_storage.cpp +++ b/src/file_storage.cpp @@ -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); diff --git a/src/torrent.cpp b/src/torrent.cpp index 42abb1fd5..b8b88f1d9 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -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]