fix build warnings

This commit is contained in:
Arvid Norberg 2015-05-18 05:04:55 +00:00
parent e7d369646d
commit 9ee98b3ed1
12 changed files with 57 additions and 60 deletions

View File

@ -77,7 +77,7 @@ namespace libtorrent
TORRENT_EXTRA_EXPORT std::vector<ip_interface> enum_net_interfaces(io_service& ios
, error_code& ec);
TORRENT_EXTRA_EXPORT std::vector<ip_route> enum_routes(io_service& ios, error_code& ec);
TORRENT_EXTRA_EXPORT std::vector<ip_route> enum_routes(error_code& ec);
// return (a1 & mask) == (a2 & mask)
TORRENT_EXTRA_EXPORT bool match_addr_mask(address const& a1
@ -90,8 +90,7 @@ namespace libtorrent
TORRENT_EXTRA_EXPORT bool in_local_network(std::vector<ip_interface> const& net
, address const& addr);
TORRENT_EXTRA_EXPORT address get_default_gateway(io_service& ios
, error_code& ec);
TORRENT_EXTRA_EXPORT address get_default_gateway(error_code& ec);
#ifdef SO_BINDTODEVICE
struct bind_to_device_opt

View File

@ -756,8 +756,6 @@ namespace libtorrent
void recalc_share_mode();
void update_sparse_piece_prio(int piece, int cursor, int reverse_cursor);
struct suggest_piece_t
{
int piece_index;
@ -870,7 +868,7 @@ namespace libtorrent
void on_name_lookup(error_code const& e
, std::vector<address> const& addrs
, int port
, std::list<web_seed_t>::iterator web, tcp::endpoint proxy);
, std::list<web_seed_t>::iterator web);
void connect_web_seed(std::list<web_seed_t>::iterator web, tcp::endpoint a);
@ -1149,6 +1147,8 @@ namespace libtorrent
private:
void update_sparse_piece_prio(int piece, int start, int end);
void ip_filter_updated();
void inc_stats_counter(int c, int value = 1);

View File

@ -185,7 +185,7 @@ namespace libtorrent
void setup_read(udp::socket* s);
void on_read(error_code const& ec, udp::socket* s);
void on_read_impl(udp::socket* sock, udp::endpoint const& ep
void on_read_impl(udp::endpoint const& ep
, error_code const& e, std::size_t bytes_transferred);
void on_name_lookup(error_code const& e, tcp::resolver::iterator i);
void on_connect_timeout(error_code const& ec);

View File

@ -280,7 +280,7 @@ int _System __libsocket_sysctl(int* mib, u_int namelen, void *oldp, size_t *oldl
#endif
#if TORRENT_USE_IFADDRS
bool iface_from_ifaddrs(ifaddrs *ifa, ip_interface &rv, error_code& ec)
bool iface_from_ifaddrs(ifaddrs *ifa, ip_interface &rv)
{
int family = ifa->ifa_addr->sa_family;
@ -406,6 +406,7 @@ namespace libtorrent
std::vector<ip_interface> enum_net_interfaces(io_service& ios, error_code& ec)
{
TORRENT_UNUSED(ios); // this may be unused depending on configuration
std::vector<ip_interface> ret;
#if TORRENT_USE_IFADDRS
int s = socket(AF_INET, SOCK_DGRAM, 0);
@ -436,7 +437,7 @@ namespace libtorrent
)
{
ip_interface iface;
if (iface_from_ifaddrs(ifa, iface, ec))
if (iface_from_ifaddrs(ifa, iface))
{
ifreq req;
memset(&req, 0, sizeof(req));
@ -667,9 +668,9 @@ namespace libtorrent
return ret;
}
address get_default_gateway(io_service& ios, error_code& ec)
address get_default_gateway(error_code& ec)
{
std::vector<ip_route> ret = enum_routes(ios, ec);
std::vector<ip_route> ret = enum_routes(ec);
#if defined TORRENT_WINDOWS || defined TORRENT_MINGW
std::vector<ip_route>::iterator i = std::find_if(ret.begin(), ret.end()
, boost::bind(&is_loopback, boost::bind(&ip_route::destination, _1)));
@ -681,7 +682,7 @@ namespace libtorrent
return i->gateway;
}
std::vector<ip_route> enum_routes(io_service& ios, error_code& ec)
std::vector<ip_route> enum_routes(error_code& ec)
{
std::vector<ip_route> ret;

View File

@ -88,7 +88,7 @@ void natpmp::start()
mutex::scoped_lock l(m_mutex);
error_code ec;
address gateway = get_default_gateway(m_socket.get_io_service(), ec);
address gateway = get_default_gateway(ec);
if (ec)
{
char msg[200];

View File

@ -4027,8 +4027,8 @@ namespace libtorrent
TORRENT_ASSERT(m_picker);
if (m_picker->have_piece(i) || m_picker->piece_priority(i) == 0)
return;
bool have_before = i == 0 || m_picker->have_piece(i - 1);
bool have_after = i == end - 1 || m_picker->have_piece(i + 1);
bool have_before = i < start || m_picker->have_piece(i - 1);
bool have_after = i >= end || m_picker->have_piece(i + 1);
if (have_after && have_before)
m_picker->set_piece_priority(i, 7);
else if (have_after || have_before)
@ -6145,7 +6145,7 @@ namespace libtorrent
web->resolving = true;
m_ses.async_resolve(hostname, resolver_interface::abort_on_shutdown
, boost::bind(&torrent::on_name_lookup, shared_from_this(), _1, _2
, port, web, tcp::endpoint()));
, port, web));
}
}
@ -6228,14 +6228,13 @@ namespace libtorrent
web->resolving = true;
m_ses.async_resolve(hostname, resolver_interface::abort_on_shutdown
, boost::bind(&torrent::on_name_lookup, shared_from_this(), _1, _2
, port, web, a));
, port, web));
}
void torrent::on_name_lookup(error_code const& e
, std::vector<address> const& addrs
, int port
, std::list<web_seed_t>::iterator web
, tcp::endpoint proxy)
, std::list<web_seed_t>::iterator web)
{
TORRENT_ASSERT(is_single_thread());
@ -9962,7 +9961,6 @@ namespace libtorrent
int num_pieces = m_torrent_file->num_pieces();
int rarest_rarity = INT_MAX;
bool prio_updated = false;
for (int i = 0; i < num_pieces; ++i)
{
piece_picker::piece_stats_t ps = m_picker->piece_stats(i);
@ -9970,7 +9968,6 @@ namespace libtorrent
if (ps.priority == 0 && (ps.have || ps.downloading))
{
m_picker->set_piece_priority(i, 1);
prio_updated = true;
continue;
}
// don't count pieces we already have or are trying to download
@ -10859,7 +10856,7 @@ namespace libtorrent
need_policy();
torrent_state st = get_policy_state();
torrent_peer* p = m_peer_list->add_peer(adr, source, 0, &st);
torrent_peer* p = m_peer_list->add_peer(adr, source, flags, &st);
peers_erased(st.erased);
if (p)
{

View File

@ -302,7 +302,7 @@ void udp_socket::on_read(error_code const& ec, udp::socket* s)
#endif
if (ec == asio::error::would_block || ec == asio::error::try_again) break;
on_read_impl(s, ep, ec, bytes_transferred);
on_read_impl(ep, ec, bytes_transferred);
}
call_drained_handler();
setup_read(s);
@ -419,7 +419,7 @@ void udp_socket::unsubscribe(udp_socket_observer* o)
m_observers.erase(i);
}
void udp_socket::on_read_impl(udp::socket* s, udp::endpoint const& ep
void udp_socket::on_read_impl(udp::endpoint const& ep
, error_code const& e, std::size_t bytes_transferred)
{
TORRENT_ASSERT(m_magic == 0x1337);

View File

@ -406,7 +406,7 @@ void upnp::on_reply(udp::endpoint const& from, char* buffer
bool non_router = false;
if (m_ignore_non_routers)
{
std::vector<ip_route> routes = enum_routes(m_io_service, ec);
std::vector<ip_route> routes = enum_routes(ec);
if (std::find_if(routes.begin(), routes.end()
, boost::bind(&ip_route::gateway, _1) == from.address()) == routes.end())
{

View File

@ -94,7 +94,7 @@ namespace libtorrent
{
m_last_route_update = aux::time_now();
error_code ec;
m_routes = enum_routes(m_sock.get_io_service(), ec);
m_routes = enum_routes(ec);
}
int mtu = 0;
@ -206,7 +206,7 @@ namespace libtorrent
{
m_last_route_update = aux::time_now();
error_code ec;
m_routes = enum_routes(m_sock.get_io_service(), ec);
m_routes = enum_routes(ec);
if (ec) return socket_ep;
}

View File

@ -229,7 +229,7 @@ int test_main()
initialize_file_progress(fp, picker, fs);
boost::uint64_t sum = 0;
for (int i = 0; i < fp.size(); ++i)
for (int i = 0; i < int(fp.size()); ++i)
sum += fp[i];
TEST_EQUAL(sum, fs.piece_size(idx));