diff --git a/Jamfile b/Jamfile index e08ee3529..430682115 100755 --- a/Jamfile +++ b/Jamfile @@ -661,8 +661,6 @@ local usage-requirements = gcc:-fno-strict-aliasing gcc:-Wno-missing-braces # assert on integer overflow - clang:-Wno-invalid-offsetof - clang-darwin:-Wno-invalid-offsetof system:$(CXXFLAGS) system:$(LDFLAGS) # this works around a bug in asio in boost-1.39 diff --git a/ed25519/src/ed25519.h b/ed25519/src/ed25519.h index 83d12ed61..08af9de93 100644 --- a/ed25519/src/ed25519.h +++ b/ed25519/src/ed25519.h @@ -12,7 +12,7 @@ enum ed25519_public_key_size = 32, ed25519_signature_size = 64, ed25519_scalar_size = 32, - ed25519_shared_secret_size = 32, + ed25519_shared_secret_size = 32 }; #ifdef __cplusplus diff --git a/ed25519/src/fe.c b/ed25519/src/fe.c index b00f60177..b5889daef 100644 --- a/ed25519/src/fe.c +++ b/ed25519/src/fe.c @@ -1497,4 +1497,5 @@ void fe_tobytes(unsigned char *s, const fe h) { #ifdef _MSC_VER #pragma warning(pop) -#endif // _MSC_VER \ No newline at end of file +#endif // _MSC_VER + diff --git a/ed25519/src/precomp_data.h b/ed25519/src/precomp_data.h index 776b84f4c..ea00e4cc6 100644 --- a/ed25519/src/precomp_data.h +++ b/ed25519/src/precomp_data.h @@ -1388,4 +1388,5 @@ static ge_precomp base[32][8] = { { -20430234, 14955537, -24126347, 8124619, -5369288, -5990470, 30468147, -13900640, 18423289, 4177476 }, }, }, -}; \ No newline at end of file +}; + diff --git a/ed25519/src/sc.h b/ed25519/src/sc.h index 8fa727ef1..0c058e532 100644 --- a/ed25519/src/sc.h +++ b/ed25519/src/sc.h @@ -9,4 +9,5 @@ where l = 2^252 + 27742317777372353535851937790883648493. void sc_reduce(unsigned char *s); void sc_muladd(unsigned char *s, const unsigned char *a, const unsigned char *b, const unsigned char *c); -#endif \ No newline at end of file +#endif + diff --git a/ed25519/src/seed.c b/ed25519/src/seed.c index 25e518220..d2ccb0800 100644 --- a/ed25519/src/seed.c +++ b/ed25519/src/seed.c @@ -37,4 +37,5 @@ int ed25519_create_seed(unsigned char *seed) { return 0; } -#endif \ No newline at end of file +#endif + diff --git a/ed25519/src/sha512.h b/ed25519/src/sha512.h index e56b00e84..0cdd0a3d5 100644 --- a/ed25519/src/sha512.h +++ b/ed25519/src/sha512.h @@ -18,4 +18,5 @@ int sha512_final(sha512_context * md, unsigned char *out); int sha512_update(sha512_context * md, const unsigned char *in, size_t inlen); int sha512(const unsigned char *message, size_t message_len, unsigned char *out); -#endif \ No newline at end of file +#endif + diff --git a/include/libtorrent/alert_types.hpp b/include/libtorrent/alert_types.hpp index 28f13bfca..5262d349a 100644 --- a/include/libtorrent/alert_types.hpp +++ b/include/libtorrent/alert_types.hpp @@ -692,7 +692,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(peer_connect_alert); const static int static_category = alert::debug_notification; - virtual std::string message() const;; + virtual std::string message() const; int socket_type; }; diff --git a/include/libtorrent/bt_peer_connection.hpp b/include/libtorrent/bt_peer_connection.hpp index d4cfe2dcb..e8b7b618e 100644 --- a/include/libtorrent/bt_peer_connection.hpp +++ b/include/libtorrent/bt_peer_connection.hpp @@ -105,7 +105,7 @@ namespace libtorrent // recommend_msg = 5, // comment_msg = 6, dont_have_msg = 7, - share_mode_msg = 8, + share_mode_msg = 8 }; ~bt_peer_connection(); diff --git a/include/libtorrent/config.hpp b/include/libtorrent/config.hpp index 0b042be88..00cd32b22 100644 --- a/include/libtorrent/config.hpp +++ b/include/libtorrent/config.hpp @@ -59,12 +59,8 @@ POSSIBILITY OF SUCH DAMAGE. build, to automatically apply these defines #endif -#if !defined _MSC_VER || _MSC_VER >= 1600 - -#include // for INT64_MAX et.al. - -#else - +// some parts pulled out of stdint.h +// to avoid C99 or C++11 dependency #if !defined INT64_MAX #define INT64_MAX 0x7fffffffffffffffLL #endif @@ -75,8 +71,6 @@ POSSIBILITY OF SUCH DAMAGE. #define INT16_MIN -32768 #endif -#endif - #ifndef _MSC_VER #ifndef __STDC_FORMAT_MACROS #define __STDC_FORMAT_MACROS 1 diff --git a/include/libtorrent/connection_queue.hpp b/include/libtorrent/connection_queue.hpp index ace9e04ff..73be10d7a 100644 --- a/include/libtorrent/connection_queue.hpp +++ b/include/libtorrent/connection_queue.hpp @@ -116,7 +116,7 @@ private: boost::function on_timeout; ptime expires; time_duration timeout; - boost::uint32_t ticket; + boost::int32_t ticket; bool connecting; boost::uint8_t priority; }; diff --git a/include/libtorrent/file_storage.hpp b/include/libtorrent/file_storage.hpp index a91b44027..ebef7d16b 100644 --- a/include/libtorrent/file_storage.hpp +++ b/include/libtorrent/file_storage.hpp @@ -465,7 +465,7 @@ namespace libtorrent // this file is a symlink. The symlink target is // specified in a separate field - flag_symlink = 8, + flag_symlink = 8 }; // returns a bitmask of flags from file_flags_t that apply diff --git a/include/libtorrent/peer_info.hpp b/include/libtorrent/peer_info.hpp index 0d6b85213..508c600dc 100644 --- a/include/libtorrent/peer_info.hpp +++ b/include/libtorrent/peer_info.hpp @@ -364,7 +364,7 @@ namespace libtorrent web_seed = 1, // HTTP connection using the `BEP 17`_ protocol - http_seed = 2, + http_seed = 2 }; // the kind of connection this peer uses. See connection_type_t. diff --git a/include/libtorrent/policy.hpp b/include/libtorrent/policy.hpp index 7fafc3215..c25236456 100644 --- a/include/libtorrent/policy.hpp +++ b/include/libtorrent/policy.hpp @@ -95,7 +95,7 @@ namespace libtorrent enum { // the limits of the download queue size - min_request_queue = 2, + min_request_queue = 2 }; // calculate the priority of a peer based on its address. One of the diff --git a/include/libtorrent/rss.hpp b/include/libtorrent/rss.hpp index 9dbfb9316..5a32b352b 100644 --- a/include/libtorrent/rss.hpp +++ b/include/libtorrent/rss.hpp @@ -271,7 +271,7 @@ namespace libtorrent aux::session_impl& m_ses; }; -}; +} #endif diff --git a/include/libtorrent/storage.hpp b/include/libtorrent/storage.hpp index d7d7a4d8c..cce7d0022 100644 --- a/include/libtorrent/storage.hpp +++ b/include/libtorrent/storage.hpp @@ -522,7 +522,7 @@ namespace libtorrent { public: disabled_storage(int piece_size) : m_piece_size(piece_size) {} - void set_file_priority(std::vector const& prio) {} + void set_file_priority(std::vector const&) {} bool has_any_file() { return false; } bool rename_file(int, std::string const&) { return false; } bool release_files() { return false; } @@ -561,7 +561,7 @@ namespace libtorrent // if any file exist in the target, take those files instead // of the ones we may have in the source. - dont_replace, + dont_replace }; struct disk_io_thread; @@ -651,7 +651,7 @@ namespace libtorrent need_full_check = -1, fatal_disk_error = -2, disk_check_aborted = -3, - file_exist = -4, + file_exist = -4 }; storage_interface* get_storage_impl() { return m_storage.get(); } diff --git a/include/libtorrent/torrent_handle.hpp b/include/libtorrent/torrent_handle.hpp index d95c0878b..94fd8070d 100644 --- a/include/libtorrent/torrent_handle.hpp +++ b/include/libtorrent/torrent_handle.hpp @@ -315,7 +315,7 @@ namespace libtorrent query_name = 64, // includes ``save_path``, the path to the directory the files of the // torrent are saved to. - query_save_path = 128, + query_save_path = 128 }; // ``status()`` will return a structure with information about the status diff --git a/include/libtorrent/utp_socket_manager.hpp b/include/libtorrent/utp_socket_manager.hpp index e7ae2ab90..0c0f06a76 100644 --- a/include/libtorrent/utp_socket_manager.hpp +++ b/include/libtorrent/utp_socket_manager.hpp @@ -110,7 +110,7 @@ namespace libtorrent invalid_pkts_in, redundant_pkts_in, - num_counters, + num_counters }; // used to keep stats of uTP events diff --git a/src/Makefile.am b/src/Makefile.am index f9d298e8f..f323fc382 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -132,8 +132,7 @@ libtorrent_rasterbar_la_LDFLAGS = -version-info $(INTERFACE_VERSION_INFO) libtorrent_rasterbar_la_LIBADD = @BOOST_SYSTEM_LIB@ @OPENSSL_LIBS@ #AM_CXXFLAGS= -ftemplate-depth-100 -I$(top_srcdir)/include @DEBUGFLAGS@ @OPENSSL_INCLUDES@ -#AM_CPPFLAGS = -ftemplate-depth-100 -I$(top_srcdir)/include @DEBUGFLAGS@ @OPENSSL_INCLUDES@ -AM_CPPFLAGS = -ftemplate-depth-100 -I$(top_srcdir)/include -I$(top_srcdir)/ed25519/src @DEBUGFLAGS@ @OPENSSL_INCLUDES@ +AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/ed25519/src @DEBUGFLAGS@ @OPENSSL_INCLUDES@ AM_CFLAGS = -I$(top_srcdir)/ed25519/src -std=c99 #AM_CFLAGS= -I$(top_srcdir)/include @DEBUGFLAGS@ diff --git a/src/alert.cpp b/src/alert.cpp index c315cc95d..e414e9439 100644 --- a/src/alert.cpp +++ b/src/alert.cpp @@ -566,7 +566,7 @@ namespace libtorrent { }; int op = operation; - if (op < 0 || op > sizeof(operation_names)/sizeof(operation_names[0])) + if (op < 0 || op > int(sizeof(operation_names)/sizeof(operation_names[0]))) op = 0; char msg[600]; diff --git a/src/allocator.cpp b/src/allocator.cpp index 9e8f43c58..4697293b7 100644 --- a/src/allocator.cpp +++ b/src/allocator.cpp @@ -102,7 +102,7 @@ namespace libtorrent // for cases where the cache size is several gigabytes) TORRENT_ASSERT(bytes < 0x30000000); - TORRENT_ASSERT(bytes >= page_size()); + TORRENT_ASSERT(int(bytes) >= page_size()); #ifdef TORRENT_DEBUG_BUFFERS int page = page_size(); int num_pages = (bytes + (page-1)) / page + 2; diff --git a/src/chained_buffer.cpp b/src/chained_buffer.cpp index a3c859771..5fb8eb33d 100644 --- a/src/chained_buffer.cpp +++ b/src/chained_buffer.cpp @@ -155,5 +155,5 @@ namespace libtorrent #endif } -}; +} diff --git a/src/connection_queue.cpp b/src/connection_queue.cpp index f21bfe376..e34d72551 100644 --- a/src/connection_queue.cpp +++ b/src/connection_queue.cpp @@ -209,7 +209,7 @@ namespace libtorrent } // all entries are connecting, no need to look for new ones - if (m_queue.size() == m_num_connecting) + if (int(m_queue.size()) == m_num_connecting) return; std::list::iterator i = std::find_if(m_queue.begin() @@ -245,7 +245,7 @@ namespace libtorrent if (m_num_connecting >= m_half_open_limit && m_half_open_limit > 0) break; - if (m_num_connecting == m_queue.size()) break; + if (m_num_connecting == int(m_queue.size())) break; i = std::find_if(i, m_queue.end(), boost::bind(&entry::connecting, _1) == false); } diff --git a/src/disk_io_thread.cpp b/src/disk_io_thread.cpp index 459bf1d13..6b1846ffa 100644 --- a/src/disk_io_thread.cpp +++ b/src/disk_io_thread.cpp @@ -2237,7 +2237,7 @@ namespace libtorrent if (i != idx.end()) { TORRENT_ASSERT(i->storage); - int ret = flush_range(const_cast(*i), 0, INT_MAX, l); + ret = flush_range(const_cast(*i), 0, INT_MAX, l); idx.erase(i); if (test_error(j)) { diff --git a/src/file_storage.cpp b/src/file_storage.cpp index d9c03dd9f..357766598 100644 --- a/src/file_storage.cpp +++ b/src/file_storage.cpp @@ -309,7 +309,7 @@ namespace libtorrent // find the file iterator and file offset internal_file_entry target; target.offset = piece * (size_type)m_piece_length + offset; - TORRENT_ASSERT_PRECOND(target.offset + size <= m_total_size); + TORRENT_ASSERT_PRECOND(size_type(target.offset + size) <= m_total_size); TORRENT_ASSERT(!compare_file_offset(target, m_files.front())); std::vector::const_iterator file_iter = std::upper_bound( @@ -644,7 +644,7 @@ namespace libtorrent } file_entry file_storage::at(file_storage::iterator i) const - { return at(i - begin()); } + { return at(i - m_files.begin()); } #endif // TORRENT_NO_DEPRECATE bool compare_file_entry_size(internal_file_entry const& fe1, internal_file_entry const& fe2) @@ -704,7 +704,7 @@ namespace libtorrent } } else if (pad_file_limit >= 0 - && i->size > pad_file_limit + && i->size > boost::uint32_t(pad_file_limit) && i->pad_file == false) { // if we have pad files enabled, and this file is @@ -722,7 +722,7 @@ namespace libtorrent { for (std::vector::iterator j = i+1; j < m_files.end(); ++j) { - if (j->size > pad_size) continue; + if (j->size > boost::uint32_t(pad_size)) continue; if (best_match == m_files.end() || j->size > best_match->size) best_match = j; } diff --git a/src/gzip.cpp b/src/gzip.cpp index fb819c278..ad54735db 100644 --- a/src/gzip.cpp +++ b/src/gzip.cpp @@ -170,7 +170,7 @@ namespace libtorrent // case we fail if (ret == 1) // 1: output space exhausted before completing inflate { - if (destlen == maximum_size) + if (destlen == boost::uint32_t(maximum_size)) { error = "inflated data too big"; return true; diff --git a/src/http_tracker_connection.cpp b/src/http_tracker_connection.cpp index 8f49b65fd..40dc34c57 100644 --- a/src/http_tracker_connection.cpp +++ b/src/http_tracker_connection.cpp @@ -511,10 +511,10 @@ namespace libtorrent if (ip_ent) { char const* p = ip_ent->string_ptr(); - if (ip_ent->string_length() == address_v4::bytes_type().size()) + if (ip_ent->string_length() == int(address_v4::bytes_type().size())) external_ip = detail::read_v4_address(p); #if TORRENT_USE_IPV6 - else if (ip_ent->string_length() == address_v6::bytes_type().size()) + else if (ip_ent->string_length() == int(address_v6::bytes_type().size())) external_ip = detail::read_v6_address(p); #endif } diff --git a/src/kademlia/routing_table.cpp b/src/kademlia/routing_table.cpp index 55f3e10ab..eb633d033 100644 --- a/src/kademlia/routing_table.cpp +++ b/src/kademlia/routing_table.cpp @@ -262,7 +262,7 @@ void routing_table::print_state(std::ostream& os) const node_id id = j->id; id <<= bucket_index + 1; int b = (id[0] & top_mask) >> mask_shift; - TORRENT_ASSERT(b >= 0 && b < sizeof(sub_buckets)); + TORRENT_ASSERT(b >= 0 && b < int(sizeof(sub_buckets)/sizeof(sub_buckets[0]))); sub_buckets[b] = true; } diff --git a/src/kademlia/traversal_algorithm.cpp b/src/kademlia/traversal_algorithm.cpp index e7942d006..cc284dc9c 100644 --- a/src/kademlia/traversal_algorithm.cpp +++ b/src/kademlia/traversal_algorithm.cpp @@ -223,7 +223,7 @@ void traversal_algorithm::add_entry(node_id const& id, udp::endpoint addr, unsig if (m_results.size() > 100) { #if TORRENT_USE_ASSERTS - for (int i = 100; i < m_results.size(); ++i) + for (int i = 100; i < int(m_results.size()); ++i) m_results[i]->m_was_abandoned = true; #endif m_results.resize(100); diff --git a/src/lsd.cpp b/src/lsd.cpp index b7e4a7759..f4b2ff8e3 100644 --- a/src/lsd.cpp +++ b/src/lsd.cpp @@ -217,7 +217,7 @@ void lsd::on_announce(udp::endpoint const& from, char* buffer { // we expect it to be hexadecimal // if it isn't, it's not our cookie anyway - boost::uint32_t cookie = strtol(cookie_iter->second.c_str(), NULL, 16); + boost::int32_t cookie = strtol(cookie_iter->second.c_str(), NULL, 16); if (cookie == m_cookie) { #if defined(TORRENT_LOGGING) || defined(TORRENT_VERBOSE_LOGGING) diff --git a/src/peer_connection.cpp b/src/peer_connection.cpp index d28577d3c..98ea89c2e 100644 --- a/src/peer_connection.cpp +++ b/src/peer_connection.cpp @@ -4784,7 +4784,6 @@ namespace libtorrent shared_ptr t = m_torrent.lock(); // we may want to request more quota at this point - int ret = 0; bool utp = m_socket->get() != 0; bool ignore_limits = m_ignore_bandwidth_limits || (!m_ses.m_settings.rate_limit_utp && utp); @@ -4793,7 +4792,7 @@ namespace libtorrent // in this case, we have data to send, but no // bandwidth. So, we simply request bandwidth // from the bandwidth manager - ret = request_upload_bandwidth( + request_upload_bandwidth( &m_ses.m_upload_channel , t ? &t->m_bandwidth_channel[upload_channel] : 0 , &m_bandwidth_channel[upload_channel] @@ -4806,12 +4805,12 @@ namespace libtorrent // instead we rate limit ourself against the special // global bandwidth channel for local peers, which defaults // to unthrottled - ret = request_upload_bandwidth(&m_ses.m_local_upload_channel + request_upload_bandwidth(&m_ses.m_local_upload_channel , &m_bandwidth_channel[upload_channel]); } if (m_channel_state[upload_channel] & peer_info::bw_network) return; - + if (m_quota[upload_channel] == 0 && !m_send_buffer.empty() && !m_connecting) @@ -4929,7 +4928,6 @@ namespace libtorrent shared_ptr t = m_torrent.lock(); // we may want to request more quota at this point - int ret = 0; bool utp = m_socket->get() != 0; bool ignore_limits = m_ignore_bandwidth_limits || (!m_ses.m_settings.rate_limit_utp && utp); @@ -4938,7 +4936,7 @@ namespace libtorrent // in this case, we have outstanding data to // receive, but no bandwidth quota. So, we simply // request bandwidth from the bandwidth manager - ret = request_download_bandwidth( + request_download_bandwidth( &m_ses.m_download_channel , t ? &t->m_bandwidth_channel[download_channel] : 0 , &m_bandwidth_channel[download_channel] @@ -4951,7 +4949,7 @@ namespace libtorrent // instead we rate limit ourself against the special // global bandwidth channel for local peers, which defaults // to unthrottled - ret = request_download_bandwidth(&m_ses.m_local_download_channel + request_download_bandwidth(&m_ses.m_local_download_channel , &m_bandwidth_channel[download_channel]); } @@ -5755,7 +5753,7 @@ namespace libtorrent // if the piece is fully downloaded, we might have popped it from the // download queue already int outstanding_bytes = 0; - bool in_download_queue = false; +// bool in_download_queue = false; int block_size = t->block_size(); piece_block last_block(ti.num_pieces()-1 , (ti.piece_size(ti.num_pieces()-1) + block_size - 1) / block_size); @@ -5767,7 +5765,7 @@ namespace libtorrent || i->block.block_index <= last_block.block_index); if (m_received_in_piece && i == m_download_queue.begin()) { - in_download_queue = true; +// in_download_queue = true; // this assert is not correct since block may have different sizes // and may not be returned in the order they were requested // TORRENT_ASSERT(t->to_req(i->block).length >= m_received_in_piece); @@ -5911,6 +5909,7 @@ namespace libtorrent TORRENT_ASSERT(i != end); } #endif +/* if (t->has_picker() && !t->is_aborted()) { // make sure that pieces that have completed the download @@ -5931,9 +5930,10 @@ namespace libtorrent complete = false; break; } + TORRENT_ASSERT(complete); } } - +*/ // extremely expensive invariant check /* if (!t->is_seed()) diff --git a/src/rss.cpp b/src/rss.cpp index 74ad0a556..700cacd6d 100644 --- a/src/rss.cpp +++ b/src/rss.cpp @@ -398,6 +398,11 @@ void feed::on_feed(error_code const& ec m_ses.update_rss_feeds(); } +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Winvalid-offsetof" +#endif + #define TORRENT_SETTING(t, x) {#x, offsetof(feed_settings,x), t}, bencode_map_entry feed_settings_map[] = { @@ -439,6 +444,10 @@ void feed::on_feed(error_code const& ec }; #undef TORRENT_SETTING +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif + void feed::load_state(lazy_entry const& rd) { load_struct(rd, this, feed_map, sizeof(feed_map)/sizeof(feed_map[0])); @@ -670,5 +679,5 @@ feed_settings feed_handle::settings() const return ret; } -}; +} diff --git a/src/session_impl.cpp b/src/session_impl.cpp index 9b1896253..693f3cb06 100644 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -281,6 +281,11 @@ namespace aux { } }; +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Winvalid-offsetof" +#endif + #define TORRENT_SETTING(t, x) {#x, offsetof(session_settings,x), t}, bencode_map_entry session_settings_map[] = @@ -554,6 +559,10 @@ namespace aux { } #undef lenof +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif + #ifdef TORRENT_STATS int session_impl::logging_allocator::allocations = 0; int session_impl::logging_allocator::allocated_bytes = 0; @@ -4480,9 +4489,9 @@ retry: { // this is the maximum number of connections we will // attempt this tick - int average_peers = 0; - if (num_downloads > 0) - average_peers = num_downloads_peers / num_downloads; +// int average_peers = 0; +// if (num_downloads > 0) +// average_peers = num_downloads_peers / num_downloads; if (m_next_connect_torrent == m_torrents.end()) m_next_connect_torrent = m_torrents.begin(); diff --git a/src/storage.cpp b/src/storage.cpp index 2f62c8260..574a6527b 100644 --- a/src/storage.cpp +++ b/src/storage.cpp @@ -1239,9 +1239,9 @@ ret: // if the file has priority 0, don't allocate it if (m_allocate_files && (op.mode & file::rw_mask) != file::read_only - && (m_file_priority.size() <= file_index || m_file_priority[file_index] > 0)) + && (int(m_file_priority.size()) <= file_index || m_file_priority[file_index] > 0)) { - TORRENT_ASSERT(m_file_created.size() == files().num_files()); + TORRENT_ASSERT(int(m_file_created.size()) == files().num_files()); if (m_file_created[file_index] == false) { file_handle->set_size(files().file_size(file_index), ec); diff --git a/src/torrent.cpp b/src/torrent.cpp index ebcff30c3..49ebaa339 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -3802,7 +3802,6 @@ namespace libtorrent --i; } // just in case this piece had priority 0 - int prev_prio = m_picker->piece_priority(piece); m_picker->set_piece_priority(piece, 7); return; } @@ -3819,7 +3818,6 @@ namespace libtorrent m_time_critical_pieces.insert(i, p); // just in case this piece had priority 0 - int prev_prio = m_picker->piece_priority(piece); m_picker->set_piece_priority(piece, 7); piece_picker::downloading_piece pi; @@ -6886,7 +6884,7 @@ namespace libtorrent { TORRENT_ASSERT(total_done == 0); } - +/* if (m_picker && !m_abort) { // make sure that pieces that have completed the download @@ -6907,9 +6905,10 @@ namespace libtorrent complete = false; break; } + TORRENT_ASSERT(complete); } } - +*/ if (m_files_checked && valid_metadata()) { TORRENT_ASSERT(block_size() > 0); @@ -7389,7 +7388,7 @@ namespace libtorrent boost::bind(&torrent::on_cache_flushed, shared_from_this(), _1, _2)); } - void torrent::on_cache_flushed(int ret, disk_io_job const& j) + void torrent::on_cache_flushed(int /* ret */, disk_io_job const& j) { TORRENT_ASSERT(m_ses.is_network_thread()); @@ -8694,7 +8693,7 @@ namespace libtorrent // remove the bottom 10% of peers from the candidate set. // this is just to remove outliers that might stall downloads int new_size = (peers.size() * 9 + 9) / 10; - TORRENT_ASSERT(new_size <= peers.size()); + TORRENT_ASSERT(new_size <= int(peers.size())); peers.resize(new_size); // remember all the peers we issued requests to, so we can commit them diff --git a/src/ut_metadata.cpp b/src/ut_metadata.cpp index 12ea01685..270459a7b 100644 --- a/src/ut_metadata.cpp +++ b/src/ut_metadata.cpp @@ -78,7 +78,7 @@ namespace libtorrent { namespace // metadata. If the torrent is greater than 16 MiB, // we may hit this case (and the client requesting // doesn't throttle its requests) - max_incoming_requests = 1024, + max_incoming_requests = 1024 }; int div_round_up(int numerator, int denominator) diff --git a/src/utp_stream.cpp b/src/utp_stream.cpp index 8e464c8e1..031085dce 100644 --- a/src/utp_stream.cpp +++ b/src/utp_stream.cpp @@ -115,7 +115,7 @@ enum // less likely to loose the re-sent packet. Because // when that happens, we must time-out in order // to continue, which takes a long time. - sack_resend_limit = 1, + sack_resend_limit = 1 }; // compare if lhs is less than rhs, taking wrapping diff --git a/src/web_peer_connection.cpp b/src/web_peer_connection.cpp index 96af5a2df..6544e3e53 100644 --- a/src/web_peer_connection.cpp +++ b/src/web_peer_connection.cpp @@ -251,7 +251,7 @@ namespace libtorrent m_piece.swap(m_web.restart_piece); m_block_pos += m_piece.size(); peer_request& front = m_requests.front(); - TORRENT_ASSERT(front.length > m_piece.size()); + TORRENT_ASSERT(front.length > int(m_piece.size())); #if 0 std::cerr << this << " RESTART-DATA: data: " << m_piece.size() @@ -387,7 +387,7 @@ namespace libtorrent peer_request const& front_request = m_requests.front(); if (int(m_piece.size()) < front_request.length) return false; - TORRENT_ASSERT(int(m_piece.size() == front_request.length)); + TORRENT_ASSERT(int(m_piece.size()) == front_request.length); // each call to incoming_piece() may result in us becoming // a seed. If we become a seed, all seeds we're connected to @@ -868,7 +868,7 @@ namespace libtorrent if (copy_size > m_chunk_pos && m_chunk_pos > 0) copy_size = m_chunk_pos; if (copy_size > 0) { - TORRENT_ASSERT(m_piece.size() == m_received_in_piece); + TORRENT_ASSERT(int(m_piece.size()) == m_received_in_piece); m_piece.resize(piece_size + copy_size); std::memcpy(&m_piece[0] + piece_size, recv_buffer.begin, copy_size); TORRENT_ASSERT(int(m_piece.size()) <= front_request.length); @@ -881,9 +881,9 @@ namespace libtorrent m_chunk_pos -= copy_size; } TORRENT_ASSERT(m_received_body <= range_end - range_start); - TORRENT_ASSERT(m_piece.size() <= front_request.length); + TORRENT_ASSERT(int(m_piece.size()) <= front_request.length); incoming_piece_fragment(copy_size); - TORRENT_ASSERT(m_piece.size() == m_received_in_piece); + TORRENT_ASSERT(int(m_piece.size()) == m_received_in_piece); } if (maybe_harvest_block()) @@ -930,14 +930,14 @@ namespace libtorrent TORRENT_ASSERT(copy_size >= 0); if (copy_size > 0) { - TORRENT_ASSERT(m_piece.size() == m_received_in_piece); + TORRENT_ASSERT(int(m_piece.size()) == m_received_in_piece); m_piece.resize(piece_size + copy_size); std::memcpy(&m_piece[0] + piece_size, recv_buffer.begin, copy_size); recv_buffer.begin += copy_size; m_received_body += copy_size; m_body_start += copy_size; incoming_piece_fragment(copy_size); - TORRENT_ASSERT(m_piece.size() == m_received_in_piece); + TORRENT_ASSERT(int(m_piece.size()) == m_received_in_piece); } TORRENT_ASSERT(m_received_body == range_end - range_start); }