minor cleanup and fix no-deprecated build

This commit is contained in:
Arvid Norberg 2015-05-06 01:11:54 +00:00
parent db4a9962e9
commit 4b585dcc0e
9 changed files with 15 additions and 44 deletions

View File

@ -63,8 +63,6 @@ namespace libtorrent
TORRENT_EXTRA_EXPORT int common_bits(unsigned char const* b1 TORRENT_EXTRA_EXPORT int common_bits(unsigned char const* b1
, unsigned char const* b2, int n); , unsigned char const* b2, int n);
TORRENT_EXTRA_EXPORT address guess_local_address(io_service&);
typedef boost::function<void(udp::endpoint const& from typedef boost::function<void(udp::endpoint const& from
, char* buffer, int size)> receive_handler_t; , char* buffer, int size)> receive_handler_t;

View File

@ -30,6 +30,7 @@ POSSIBILITY OF SUCH DAMAGE.
*/ */
#include "libtorrent/config.hpp"
#include "libtorrent/block_cache.hpp" #include "libtorrent/block_cache.hpp"
#include "libtorrent/disk_buffer_pool.hpp" #include "libtorrent/disk_buffer_pool.hpp"
#include "libtorrent/assert.hpp" #include "libtorrent/assert.hpp"
@ -193,7 +194,9 @@ const char* const job_action_name[] =
"rename_file", "rename_file",
"stop_torrent", "stop_torrent",
"cache_piece", "cache_piece",
#ifndef TORRENT_NO_DEPRECATE
"finalize_file", "finalize_file",
#endif
"flush_piece", "flush_piece",
"flush_hashed", "flush_hashed",
"flush_storage", "flush_storage",

View File

@ -158,30 +158,6 @@ namespace libtorrent
#endif #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<ip_interface> const& interfaces = enum_net_interfaces(ios, ec);
address ret = address_v4::any();
for (std::vector<ip_interface>::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 // count the length of the common bit prefix
int common_bits(unsigned char const* b1 int common_bits(unsigned char const* b1
, unsigned char const* b2, int n) , unsigned char const* b2, int n)

View File

@ -31,8 +31,6 @@ POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <libtorrent/kademlia/find_data.hpp> #include <libtorrent/kademlia/find_data.hpp>
#include <libtorrent/kademlia/routing_table.hpp>
#include <libtorrent/kademlia/rpc_manager.hpp>
#include <libtorrent/kademlia/node.hpp> #include <libtorrent/kademlia/node.hpp>
#include <libtorrent/io.hpp> #include <libtorrent/io.hpp>
#include <libtorrent/socket.hpp> #include <libtorrent/socket.hpp>

View File

@ -49,7 +49,7 @@ void get_item::got_data(bdecode_node const& v,
{ {
// we received data! // we received data!
std::pair<char const*, int> salt(m_salt.c_str(), m_salt.size()); std::pair<char const*, int> salt(m_salt.c_str(), int(m_salt.size()));
sha1_hash incoming_target; sha1_hash incoming_target;
if (pk) if (pk)

View File

@ -203,8 +203,8 @@ bool obfuscated_get_peers::invoke(observer_ptr o)
{ {
if (!m_obfuscated) return get_peers::invoke(o); if (!m_obfuscated) return get_peers::invoke(o);
node_id id = o->id(); const node_id id = o->id();
int shared_prefix = 160 - distance_exp(id, m_target); const int shared_prefix = 160 - distance_exp(id, m_target);
// when we get close to the target zone in the DHT // when we get close to the target zone in the DHT
// start using the correct info-hash, in order to // start using the correct info-hash, in order to
@ -219,12 +219,12 @@ bool obfuscated_get_peers::invoke(observer_ptr o)
for (std::vector<observer_ptr>::iterator i = m_results.begin() for (std::vector<observer_ptr>::iterator i = m_results.begin()
, end(m_results.end()); i != end; ++i) , 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 // 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 // don't interrupt with queries that are already in-flight
if ((o->flags & observer::flag_alive) == 0) continue; if ((node->flags & observer::flag_alive) == 0) continue;
o->flags &= ~(observer::flag_queried | observer::flag_alive); node->flags &= ~(observer::flag_queried | observer::flag_alive);
} }
return get_peers::invoke(o); return get_peers::invoke(o);
} }

View File

@ -31,7 +31,6 @@ POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <algorithm> #include <algorithm>
#include <ctime>
#include "libtorrent/kademlia/node_id.hpp" #include "libtorrent/kademlia/node_id.hpp"
#include "libtorrent/kademlia/node_entry.hpp" #include "libtorrent/kademlia/node_entry.hpp"

View File

@ -45,7 +45,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/aux_/disable_warnings_push.hpp" #include "libtorrent/aux_/disable_warnings_push.hpp"
#include <boost/bind.hpp> #include <boost/bind.hpp>
#include <boost/ref.hpp>
#if BOOST_VERSION < 103500 #if BOOST_VERSION < 103500
#include <asio/ip/host_name.hpp> #include <asio/ip/host_name.hpp>
#include <asio/ip/multicast.hpp> #include <asio/ip/multicast.hpp>
@ -61,14 +60,12 @@ POSSIBILITY OF SUCH DAMAGE.
namespace libtorrent namespace libtorrent
{ {
// defined in broadcast_socket.cpp
address guess_local_address(io_service&);
namespace { namespace {
int render_lsd_packet(char* dst, int len, int listen_port int render_lsd_packet(char* dst, int len, int listen_port
, char const* info_hash_hex, int m_cookie, char const* host) , char const* info_hash_hex, int m_cookie, char const* host)
{ {
TORRENT_ASSERT(len > 0);
return snprintf(dst, len, return snprintf(dst, len,
"BT-SEARCH * HTTP/1.1\r\n" "BT-SEARCH * HTTP/1.1\r\n"
"Host: %s:6771\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); 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) , std::size_t bytes_transferred)
{ {
using namespace libtorrent::detail; using namespace libtorrent::detail;
@ -224,7 +221,7 @@ void lsd::on_announce(udp::endpoint const& from, char* buffer
http_parser p; http_parser p;
bool error = false; bool error = false;
p.incoming(buffer::const_interval(buffer, buffer + bytes_transferred) p.incoming(buffer::const_interval(buf, buf + bytes_transferred)
, error); , error);
if (!p.header_finished() || error) if (!p.header_finished() || error)

View File

@ -2423,10 +2423,10 @@ namespace libtorrent
need_picker(); need_picker();
const int num_bitmask_bytes = (std::max)(num_blocks_per_piece / 8, 1); 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) 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); int num_bits = (std::min)(num_blocks_per_piece - k*8, 8);
for (int b = 0; b < num_bits; ++b) for (int b = 0; b < num_bits; ++b)
{ {