diff --git a/include/libtorrent/fingerprint.hpp b/include/libtorrent/fingerprint.hpp index 587601e71..8b23160aa 100755 --- a/include/libtorrent/fingerprint.hpp +++ b/include/libtorrent/fingerprint.hpp @@ -90,6 +90,7 @@ namespace libtorrent if (v >= 0 && v < 10) return '0' + v; else if (v >= 10) return 'A' + (v - 10); assert(false); + return '0'; } }; diff --git a/src/piece_picker.cpp b/src/piece_picker.cpp index 6dfec3244..5bed89819 100755 --- a/src/piece_picker.cpp +++ b/src/piece_picker.cpp @@ -133,7 +133,7 @@ namespace libtorrent } } #ifndef NDEBUG - integrity_check(); +// integrity_check(); #endif } @@ -368,7 +368,7 @@ namespace libtorrent move(true, m_piece_map[index].peer_count, m_piece_map[index].index); #ifndef NDEBUG - integrity_check(); +// integrity_check(); #endif } @@ -389,7 +389,7 @@ namespace libtorrent move(m_piece_map[i].downloading, peer_count, index); #ifndef NDEBUG - integrity_check(); +// integrity_check(); #endif return; } @@ -423,7 +423,7 @@ namespace libtorrent assert(info_index != 0xffffff); remove(m_piece_map[index].downloading, peer_count, info_index); #ifndef NDEBUG - integrity_check(); +// integrity_check(); #endif } @@ -435,7 +435,7 @@ namespace libtorrent assert(pieces.size() == m_piece_map.size()); #ifndef NDEBUG - integrity_check(); +// integrity_check(); #endif // free refers to pieces that are free to download, noone else @@ -582,7 +582,7 @@ namespace libtorrent void piece_picker::mark_as_downloading(piece_block block, const address& peer) { #ifndef NDEBUG - integrity_check(); +// integrity_check(); #endif assert(block.piece_index >= 0); assert(block.block_index >= 0); @@ -611,14 +611,14 @@ namespace libtorrent i->requested_blocks[block.block_index] = 1; } #ifndef NDEBUG - integrity_check(); +// integrity_check(); #endif } void piece_picker::mark_as_finished(piece_block block, const address& peer) { #ifndef NDEBUG - integrity_check(); +// integrity_check(); #endif assert(block.piece_index >= 0); assert(block.block_index >= 0); @@ -648,7 +648,7 @@ namespace libtorrent i->finished_blocks[block.block_index] = 1; } #ifndef NDEBUG - integrity_check(); +// integrity_check(); #endif } /* @@ -717,7 +717,7 @@ namespace libtorrent void piece_picker::abort_download(piece_block block) { #ifndef NDEBUG - integrity_check(); +// integrity_check(); #endif assert(block.piece_index >= 0); @@ -752,7 +752,7 @@ namespace libtorrent move(true, m_piece_map[block.piece_index].peer_count, m_piece_map[block.piece_index].index); } #ifndef NDEBUG - integrity_check(); +// integrity_check(); #endif } diff --git a/src/session.cpp b/src/session.cpp index 6faa2fb87..b28118b6d 100755 --- a/src/session.cpp +++ b/src/session.cpp @@ -905,7 +905,6 @@ namespace libtorrent return ret; } - // TODO: add a check to see if filenames are accepted on the // current platform. // if the torrent already exists, this will throw duplicate_torrent @@ -947,7 +946,7 @@ namespace libtorrent d.save_path = save_path; d.info_hash = ti.info_hash(); d.resume_data = resume_data; - + // add the torrent to the queue to be checked m_checker_impl.m_torrents.push_back(d); // and notify the thread that it got another @@ -1301,11 +1300,11 @@ namespace libtorrent , boost::bind((mem_fun_type)&entry::integer, _1)); #endif - if (tmp_pieces.size() == info.num_pieces() + if ((int)tmp_pieces.size() == info.num_pieces() && std::find_if(tmp_pieces.begin(), tmp_pieces.end() , boost::bind(std::less(), _1, 0)) == tmp_pieces.end()) { - if (info.num_files() != file_sizes.size()) + if (info.num_files() != (int)file_sizes.size()) return; std::vector::iterator fs = file_sizes.begin(); diff --git a/src/torrent_info.cpp b/src/torrent_info.cpp index dba9287c2..4524854f5 100755 --- a/src/torrent_info.cpp +++ b/src/torrent_info.cpp @@ -158,11 +158,9 @@ namespace libtorrent int old_num_pieces = static_cast(m_piece_hash.size()); m_piece_hash.resize(num_pieces); - for (std::vector::iterator i = m_piece_hash.begin() + old_num_pieces; - i != m_piece_hash.end(); - ++i) + for (int i = old_num_pieces; i < num_pieces; ++i) { - i->clear(); + m_piece_hash[i].clear(); } }