diff --git a/include/libtorrent/broadcast_socket.hpp b/include/libtorrent/broadcast_socket.hpp index f2f3623c4..7d611e386 100644 --- a/include/libtorrent/broadcast_socket.hpp +++ b/include/libtorrent/broadcast_socket.hpp @@ -63,8 +63,6 @@ namespace libtorrent TORRENT_EXTRA_EXPORT int common_bits(unsigned char const* b1 , unsigned char const* b2, int n); - TORRENT_EXTRA_EXPORT address guess_local_address(io_service&); - typedef boost::function receive_handler_t; diff --git a/src/block_cache.cpp b/src/block_cache.cpp index 7c4eefe2f..486df5b3a 100644 --- a/src/block_cache.cpp +++ b/src/block_cache.cpp @@ -30,6 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. */ +#include "libtorrent/config.hpp" #include "libtorrent/block_cache.hpp" #include "libtorrent/disk_buffer_pool.hpp" #include "libtorrent/assert.hpp" @@ -193,7 +194,9 @@ const char* const job_action_name[] = "rename_file", "stop_torrent", "cache_piece", +#ifndef TORRENT_NO_DEPRECATE "finalize_file", +#endif "flush_piece", "flush_hashed", "flush_storage", diff --git a/src/broadcast_socket.cpp b/src/broadcast_socket.cpp index 5ef4d5428..5e034fa17 100644 --- a/src/broadcast_socket.cpp +++ b/src/broadcast_socket.cpp @@ -158,30 +158,6 @@ namespace libtorrent #endif } - address guess_local_address(io_service& ios) - { - // make a best guess of the interface we're using and its IP - error_code ec; - std::vector const& interfaces = enum_net_interfaces(ios, ec); - address ret = address_v4::any(); - for (std::vector::const_iterator i = interfaces.begin() - , end(interfaces.end()); i != end; ++i) - { - address const& a = i->interface_address; - if (is_loopback(a) - || is_multicast(a) - || is_any(a)) continue; - - // prefer a v4 address, but return a v6 if - // there are no v4 - if (a.is_v4()) return a; - - if (ret != address_v4::any()) - ret = a; - } - return ret; - } - // count the length of the common bit prefix int common_bits(unsigned char const* b1 , unsigned char const* b2, int n) diff --git a/src/kademlia/find_data.cpp b/src/kademlia/find_data.cpp index 6f517eaea..bb99c5aac 100644 --- a/src/kademlia/find_data.cpp +++ b/src/kademlia/find_data.cpp @@ -31,8 +31,6 @@ POSSIBILITY OF SUCH DAMAGE. */ #include -#include -#include #include #include #include diff --git a/src/kademlia/get_item.cpp b/src/kademlia/get_item.cpp index 24b05a075..0c1db42c3 100644 --- a/src/kademlia/get_item.cpp +++ b/src/kademlia/get_item.cpp @@ -49,7 +49,7 @@ void get_item::got_data(bdecode_node const& v, { // we received data! - std::pair salt(m_salt.c_str(), m_salt.size()); + std::pair salt(m_salt.c_str(), int(m_salt.size())); sha1_hash incoming_target; if (pk) diff --git a/src/kademlia/get_peers.cpp b/src/kademlia/get_peers.cpp index b8672e374..1efd1fbac 100644 --- a/src/kademlia/get_peers.cpp +++ b/src/kademlia/get_peers.cpp @@ -203,8 +203,8 @@ bool obfuscated_get_peers::invoke(observer_ptr o) { if (!m_obfuscated) return get_peers::invoke(o); - node_id id = o->id(); - int shared_prefix = 160 - distance_exp(id, m_target); + const node_id id = o->id(); + const int shared_prefix = 160 - distance_exp(id, m_target); // when we get close to the target zone in the DHT // start using the correct info-hash, in order to @@ -219,12 +219,12 @@ bool obfuscated_get_peers::invoke(observer_ptr o) for (std::vector::iterator i = m_results.begin() , end(m_results.end()); i != end; ++i) { - observer* o = i->get(); + observer* const node = i->get(); // don't re-request from nodes that didn't respond - if (o->flags & observer::flag_failed) continue; + if (node->flags & observer::flag_failed) continue; // don't interrupt with queries that are already in-flight - if ((o->flags & observer::flag_alive) == 0) continue; - o->flags &= ~(observer::flag_queried | observer::flag_alive); + if ((node->flags & observer::flag_alive) == 0) continue; + node->flags &= ~(observer::flag_queried | observer::flag_alive); } return get_peers::invoke(o); } diff --git a/src/kademlia/node_id.cpp b/src/kademlia/node_id.cpp index 5a6d301b7..513bc2bd5 100644 --- a/src/kademlia/node_id.cpp +++ b/src/kademlia/node_id.cpp @@ -31,7 +31,6 @@ POSSIBILITY OF SUCH DAMAGE. */ #include -#include #include "libtorrent/kademlia/node_id.hpp" #include "libtorrent/kademlia/node_entry.hpp" diff --git a/src/lsd.cpp b/src/lsd.cpp index 2cef814b2..c2666335b 100644 --- a/src/lsd.cpp +++ b/src/lsd.cpp @@ -45,7 +45,6 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/aux_/disable_warnings_push.hpp" #include -#include #if BOOST_VERSION < 103500 #include #include @@ -61,14 +60,12 @@ POSSIBILITY OF SUCH DAMAGE. namespace libtorrent { - // defined in broadcast_socket.cpp - address guess_local_address(io_service&); - namespace { int render_lsd_packet(char* dst, int len, int listen_port , char const* info_hash_hex, int m_cookie, char const* host) { + TORRENT_ASSERT(len > 0); return snprintf(dst, len, "BT-SEARCH * HTTP/1.1\r\n" "Host: %s:6771\r\n" @@ -216,7 +213,7 @@ void lsd::resend_announce(error_code const& e, sha1_hash const& info_hash announce_impl(info_hash, listen_port, false, retry_count); } -void lsd::on_announce(udp::endpoint const& from, char* buffer +void lsd::on_announce(udp::endpoint const& from, char* buf , std::size_t bytes_transferred) { using namespace libtorrent::detail; @@ -224,7 +221,7 @@ void lsd::on_announce(udp::endpoint const& from, char* buffer http_parser p; bool error = false; - p.incoming(buffer::const_interval(buffer, buffer + bytes_transferred) + p.incoming(buffer::const_interval(buf, buf + bytes_transferred) , error); if (!p.header_finished() || error) diff --git a/src/torrent.cpp b/src/torrent.cpp index 126316160..72d31dc71 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -2423,10 +2423,10 @@ namespace libtorrent need_picker(); const int num_bitmask_bytes = (std::max)(num_blocks_per_piece / 8, 1); - if ((int)bitmask.size() != num_bitmask_bytes) continue; + if (int(bitmask.size()) != num_bitmask_bytes) continue; for (int k = 0; k < num_bitmask_bytes; ++k) { - unsigned char bits = bitmask[k]; + const unsigned char bits = (unsigned char)bitmask[k]; int num_bits = (std::min)(num_blocks_per_piece - k*8, 8); for (int b = 0; b < num_bits; ++b) {