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

@ -127,8 +127,8 @@ namespace libtorrent {
// Enables alerts for port mapping events. For NAT-PMP and UPnP.
port_mapping_notification = 0x4,
// Enables alerts for events related to the storage. File errors and
// synchronization events for moving the storage, renaming files etc.
// Enables alerts for events related to the storage. File errors and
// synchronization events for moving the storage, renaming files etc.
storage_notification = 0x8,
// Enables all tracker events. Includes announcing to trackers,
@ -145,10 +145,10 @@ namespace libtorrent {
// pieces are completed.
progress_notification = 0x80,
// Alerts when a peer is blocked by the ip blocker or port blocker.
// Alerts when a peer is blocked by the ip blocker or port blocker.
ip_block_notification = 0x100,
// Alerts when some limit is reached that might limit the download
// Alerts when some limit is reached that might limit the download
// or upload rate.
performance_warning = 0x200,
@ -163,8 +163,8 @@ namespace libtorrent {
stats_notification = 0x800,
#ifndef TORRENT_NO_DEPRECATE
// Alerts on RSS related events, like feeds being updated, feed error
// conditions and successful RSS feed updates. Enabling this categoty
// Alerts on RSS related events, like feeds being updated, feed error
// conditions and successful RSS feed updates. Enabling this categoty
// will make you receive rss_alert alerts.
rss_notification = 0x1000,
#endif

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;
@ -773,7 +771,7 @@ namespace libtorrent
// we're not super seeding if we're not a seed
return m_super_seeding && is_seed();
}
void super_seeding(bool on);
int get_piece_to_super_seed(bitfield const&);
@ -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;
@ -311,7 +311,7 @@ int _System __libsocket_sysctl(int* mib, u_int namelen, void *oldp, size_t *oldl
namespace libtorrent
{
// return (a1 & mask) == (a2 & mask)
bool match_addr_mask(address const& a1, address const& a2, address const& mask)
{
@ -403,9 +403,10 @@ namespace libtorrent
}
}
#endif
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));
@ -618,7 +619,7 @@ namespace libtorrent
INTERFACE_INFO buffer[30];
DWORD size;
if (WSAIoctl(s, SIO_GET_INTERFACE_LIST, 0, 0, buffer,
sizeof(buffer), &size, 0, 0) != 0)
{
@ -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,10 +682,10 @@ 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;
#if TORRENT_USE_SYSCTL
/*
struct rt_msg
@ -835,12 +836,12 @@ namespace libtorrent
rtm = (rt_msghdr*)next;
if (rtm->rtm_version != RTM_VERSION)
continue;
ip_route r;
if (parse_route(s, rtm, &r)) ret.push_back(r);
}
close(s);
#elif TORRENT_USE_GETIPFORWARDTABLE
/*
move this to enum_net_interfaces
@ -925,7 +926,7 @@ namespace libtorrent
typedef DWORD (WINAPI *GetIpForwardTable2_t)(
ADDRESS_FAMILY, PMIB_IPFORWARD_TABLE2*);
typedef void (WINAPI *FreeMibTable_t)(PVOID Memory);
GetIpForwardTable2_t GetIpForwardTable2 = (GetIpForwardTable2_t)GetProcAddress(
iphlp, "GetIpForwardTable2");
FreeMibTable_t FreeMibTable = (FreeMibTable_t)GetProcAddress(
@ -962,7 +963,7 @@ namespace libtorrent
// Get GetIpForwardTable() pointer
typedef DWORD (WINAPI *GetIpForwardTable_t)(PMIB_IPFORWARDTABLE pIpForwardTable,PULONG pdwSize,BOOL bOrder);
GetIpForwardTable_t GetIpForwardTable = (GetIpForwardTable_t)GetProcAddress(
iphlp, "GetIpForwardTable");
if (!GetIpForwardTable)

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

@ -159,7 +159,7 @@ namespace libtorrent
++i;
continue;
}
int current = i - m_peers.begin();
TORRENT_ASSERT(current >= 0);
TORRENT_ASSERT(m_peers.size() > 0);
@ -171,7 +171,7 @@ namespace libtorrent
// peer_info_struct. If that is the case, just continue
size_t count = m_peers.size();
peer_connection_interface* p = (*i)->connection;
banned.push_back(p->remote().address());
p->disconnect(errors::banned_by_ip_filter
@ -221,7 +221,7 @@ namespace libtorrent
++i;
continue;
}
int current = i - m_peers.begin();
TORRENT_ASSERT(current >= 0);
TORRENT_ASSERT(m_peers.size() > 0);
@ -233,7 +233,7 @@ namespace libtorrent
// peer_info_struct. If that is the case, just continue
int count = m_peers.size();
peer_connection_interface* p = (*i)->connection;
banned.push_back(p->remote().address());
p->disconnect(errors::banned_by_port_filter, op_bittorrent);
@ -389,7 +389,7 @@ namespace libtorrent
++round_robin;
}
if (erase_candidate > -1)
{
TORRENT_ASSERT(erase_candidate >= 0 && erase_candidate < int(m_peers.size()));
@ -467,7 +467,7 @@ namespace libtorrent
|| (p.seed && m_finished)
|| int(p.failcount) >= m_max_failcount)
return false;
return true;
}
@ -554,7 +554,7 @@ namespace libtorrent
peers.insert(i, &pe);
}
if (erase_candidate > -1)
{
erase_peer(m_peers.begin() + erase_candidate, state);
@ -581,7 +581,7 @@ namespace libtorrent
tcp::endpoint remote = c.remote();
std::pair<iterator, iterator> range = find_peers(remote.address());
iter = std::find_if(range.first, range.second, match_peer_endpoint(remote));
if (iter != range.second)
{
TORRENT_ASSERT((*iter)->in_use);
@ -766,10 +766,10 @@ namespace libtorrent
if (m_round_robin >= iter - m_peers.begin()) ++m_round_robin;
i = *iter;
i->source = peer_info::incoming;
}
TORRENT_ASSERT(i);
c.set_peer_info(i);
TORRENT_ASSERT(i->connection == 0);

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)
@ -4281,7 +4281,7 @@ namespace libtorrent
std::vector<int>::iterator i = std::lower_bound(m_predictive_pieces.begin()
, m_predictive_pieces.end(), index);
if (i != m_predictive_pieces.end() && *i == index) return;
for (peer_iterator p = m_connections.begin()
, end(m_connections.end()); p != end; ++p)
{
@ -4307,7 +4307,7 @@ namespace libtorrent
TORRENT_ASSERT(m_picker.get());
TORRENT_ASSERT(index >= 0);
TORRENT_ASSERT(index < m_torrent_file->num_pieces());
TORRENT_ASSERT(index < m_torrent_file->num_pieces());
inc_stats_counter(counters::num_piece_failed);
@ -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());
@ -6303,7 +6302,7 @@ namespace libtorrent
, a.address(), peer_blocked_alert::ip_filter);
return;
}
TORRENT_ASSERT(web->resolving == false);
TORRENT_ASSERT(web->peer_info.connection == 0);
@ -6319,7 +6318,7 @@ namespace libtorrent
boost::shared_ptr<socket_type> s
= boost::make_shared<socket_type>(boost::ref(m_ses.get_io_service()));
if (!s) return;
void* userdata = 0;
#ifdef TORRENT_USE_OPENSSL
bool ssl = string_begins_no_case("https://", web->url.c_str());
@ -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)
{
@ -11123,7 +11120,7 @@ namespace libtorrent
fp.resize(m_torrent_file->num_files(), 0);
return;
}
int num_files = m_torrent_file->num_files();
if (m_file_progress.empty())
{

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

@ -401,12 +401,12 @@ void upnp::on_reply(udp::endpoint const& from, char* buffer
}
log(msg, l);
return;
}
}
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

@ -169,7 +169,7 @@ int test_main()
std::vector<char> piece(128 * 1024);
for (int i = 0; i < int(piece.size()); ++i)
piece[i] = (i % 26) + 'A';
// calculate the hash for all pieces
sha1_hash ph = hasher(&piece[0], piece.size()).final();
int num = t.num_pieces();
@ -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));