fix more warnings

This commit is contained in:
arvidn 2015-08-22 00:28:12 +02:00
parent 42fdd0f896
commit a42f9e0c63
17 changed files with 87 additions and 12 deletions

View File

@ -445,7 +445,7 @@ private:
char m_reserved_bits[8];
#endif
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
#if defined TORRENT_DEBUG || defined TORRENT_RELEASE_ASSERTS
bool m_in_constructor;
#endif

View File

@ -227,7 +227,7 @@ namespace libtorrent
// flags controlling this job
boost::uint8_t flags;
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
#if defined TORRENT_DEBUG || defined TORRENT_RELEASE_ASSERTS
bool in_use:1;
// set to true when the job is added to the completion queue.

View File

@ -140,6 +140,7 @@ namespace libtorrent
return memcmp(&b[0], teredo_prefix, 4) == 0;
} TORRENT_CATCH(std::exception&) { return false; }
#else
TORRENT_UNUSED(addr);
return false;
#endif
}

View File

@ -127,7 +127,7 @@ namespace libtorrent
, m_dont_have_id(0)
, m_share_mode_id(0)
#endif
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
#if defined TORRENT_DEBUG || defined TORRENT_RELEASE_ASSERTS
, m_in_constructor(true)
#endif
{

View File

@ -43,7 +43,7 @@ namespace libtorrent
, action(read)
, ret(0)
, flags(0)
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
#if defined TORRENT_DEBUG || defined TORRENT_RELEASE_ASSERTS
, in_use(false)
, job_posted(false)
, callback_called(false)

View File

@ -62,7 +62,7 @@ namespace libtorrent
new (ptr) disk_io_job;
ptr->action = static_cast<disk_io_job::action_t>(type);
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
#if defined TORRENT_DEBUG || defined TORRENT_RELEASE_ASSERTS
ptr->in_use = true;
#endif
return ptr;
@ -72,7 +72,7 @@ namespace libtorrent
{
TORRENT_ASSERT(j);
if (j == 0) return;
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
#if defined TORRENT_DEBUG || defined TORRENT_RELEASE_ASSERTS
TORRENT_ASSERT(j->in_use);
j->in_use = false;
#endif

View File

@ -255,7 +255,7 @@ namespace libtorrent
boost::tie(payload, protocol) = m_parser.incoming(recv_buffer, parse_error);
received_bytes(0, protocol);
bytes_transferred -= protocol;
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
#if defined TORRENT_DEBUG || defined TORRENT_RELEASE_ASSERTS
if (payload > front_request.length) payload = front_request.length;
#endif

View File

@ -384,6 +384,8 @@ namespace libtorrent
peer_log(peer_log_alert::outgoing, "BIND", "dst: %s ec: %s"
, print_endpoint(bound_ip).c_str()
, ec.message().c_str());
#else
TORRENT_UNUSED(bound_ip);
#endif
if (ec)
{
@ -1119,6 +1121,8 @@ namespace libtorrent
(*i)->on_piece_pass(index);
} TORRENT_CATCH(std::exception&) {}
}
#else
TORRENT_UNUSED(index);
#endif
}
@ -2172,6 +2176,8 @@ namespace libtorrent
{
if (!(*i)->can_disconnect(ec)) return false;
}
#else
TORRENT_UNUSED(ec);
#endif
return true;
}
@ -3083,6 +3089,8 @@ namespace libtorrent
#ifndef TORRENT_DISABLE_DHT
m_ses.add_dht_node(udp::endpoint(
m_remote.address(), listen_port));
#else
TORRENT_UNUSED(listen_port);
#endif
}

View File

@ -54,6 +54,8 @@ void peer_connection_handle::add_extension(boost::shared_ptr<peer_plugin> ext)
boost::shared_ptr<peer_connection> pc = native_handle();
TORRENT_ASSERT(pc);
pc->add_extension(ext);
#else
TORRENT_UNUSED(ext);
#endif
}
@ -64,6 +66,7 @@ peer_plugin const* peer_connection_handle::find_plugin(char const* type)
TORRENT_ASSERT(pc);
return pc->find_plugin(type);
#else
TORRENT_UNUSED(type);
return NULL;
#endif
}
@ -228,6 +231,10 @@ void peer_connection_handle::peer_log(peer_log_alert::direction_t direction
va_start(v, fmt);
pc->peer_log(direction, event, fmt, v);
va_end(v);
#else
TORRENT_UNUSED(direction);
TORRENT_UNUSED(event);
TORRENT_UNUSED(fmt);
#endif
}
@ -304,6 +311,8 @@ void bt_peer_connection_handle::switch_send_crypto(boost::shared_ptr<crypto_plug
boost::shared_ptr<bt_peer_connection> pc = native_handle();
TORRENT_ASSERT(pc);
pc->switch_send_crypto(crypto);
#else
TORRENT_UNUSED(crypto);
#endif
}
@ -313,6 +322,8 @@ void bt_peer_connection_handle::switch_recv_crypto(boost::shared_ptr<crypto_plug
boost::shared_ptr<bt_peer_connection> pc = native_handle();
TORRENT_ASSERT(pc);
pc->switch_recv_crypto(crypto);
#else
TORRENT_UNUSED(crypto);
#endif
}

View File

@ -57,7 +57,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/bt_peer_connection.hpp"
#endif
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
#if defined TORRENT_DEBUG || defined TORRENT_RELEASE_ASSERTS
#include "libtorrent/socket_io.hpp" // for print_endpoint
#endif

View File

@ -380,6 +380,8 @@ namespace libtorrent
add_extension(create_ut_metadata_plugin);
add_extension(create_smart_ban_plugin);
}
#else
TORRENT_UNUSED(flags);
#endif
m_impl->start_session(pack);

View File

@ -328,6 +328,8 @@ namespace libtorrent
{
#ifndef TORRENT_DISABLE_DHT
TORRENT_ASYNC_CALL1(set_dht_settings, settings);
#else
TORRENT_UNUSED(settings);
#endif
}
@ -353,6 +355,8 @@ namespace libtorrent
{
#ifndef TORRENT_DISABLE_DHT
TORRENT_ASYNC_CALL1(add_dht_node_name, node);
#else
TORRENT_UNUSED(node);
#endif
}
@ -360,6 +364,8 @@ namespace libtorrent
{
#ifndef TORRENT_DISABLE_DHT
TORRENT_ASYNC_CALL1(add_dht_router, node);
#else
TORRENT_UNUSED(node);
#endif
}
@ -367,6 +373,8 @@ namespace libtorrent
{
#ifndef TORRENT_DISABLE_DHT
TORRENT_ASYNC_CALL1(dht_get_immutable_item, target);
#else
TORRENT_UNUSED(target);
#endif
}
@ -375,6 +383,9 @@ namespace libtorrent
{
#ifndef TORRENT_DISABLE_DHT
TORRENT_ASYNC_CALL2(dht_get_mutable_item, key, salt);
#else
TORRENT_UNUSED(key);
TORRENT_UNUSED(salt);
#endif
}
@ -397,6 +408,10 @@ namespace libtorrent
{
#ifndef TORRENT_DISABLE_DHT
TORRENT_ASYNC_CALL3(dht_put_mutable_item, key, cb, salt);
#else
TORRENT_UNUSED(key);
TORRENT_UNUSED(cb);
TORRENT_UNUSED(salt);
#endif
}
@ -404,6 +419,8 @@ namespace libtorrent
{
#ifndef TORRENT_DISABLE_DHT
TORRENT_ASYNC_CALL1(dht_get_peers, info_hash);
#else
TORRENT_UNUSED(info_hash);
#endif
}
@ -411,6 +428,10 @@ namespace libtorrent
{
#ifndef TORRENT_DISABLE_DHT
TORRENT_ASYNC_CALL3(dht_announce, info_hash, port, flags);
#else
TORRENT_UNUSED(info_hash);
TORRENT_UNUSED(port);
TORRENT_UNUSED(flags);
#endif
}
@ -418,6 +439,10 @@ namespace libtorrent
{
#ifndef TORRENT_DISABLE_DHT
TORRENT_ASYNC_CALL3(dht_direct_request, ep, e, userdata);
#else
TORRENT_UNUSED(ep);
TORRENT_UNUSED(e);
TORRENT_UNUSED(userdata);
#endif
}
@ -435,6 +460,8 @@ namespace libtorrent
{
#ifndef TORRENT_DISABLE_DHT
TORRENT_ASYNC_CALL1(start_dht, startup_state);
#else
TORRENT_UNUSED(startup_state);
#endif
}
#endif // TORRENT_NO_DEPRECATE
@ -443,6 +470,8 @@ namespace libtorrent
{
#ifndef TORRENT_DISABLE_EXTENSIONS
TORRENT_ASYNC_CALL1(add_extension, ext);
#else
TORRENT_UNUSED(ext);
#endif
}
@ -450,6 +479,8 @@ namespace libtorrent
{
#ifndef TORRENT_DISABLE_EXTENSIONS
TORRENT_ASYNC_CALL1(add_ses_extension, ext);
#else
TORRENT_UNUSED(ext);
#endif
}

View File

@ -697,6 +697,7 @@ namespace aux {
void session_impl::save_state(entry* eptr, boost::uint32_t flags) const
{
TORRENT_ASSERT(is_single_thread());
TORRENT_UNUSED(flags); // potentially unused
entry& e = *eptr;
@ -2729,6 +2730,8 @@ retry:
#ifndef TORRENT_DISABLE_LOGGING
session_log(" CLOSING CONNECTION %s : %s"
, print_endpoint(p->remote()).c_str(), ec.message().c_str());
#else
TORRENT_UNUSED(ec);
#endif
TORRENT_ASSERT(p->is_disconnecting());
@ -4089,6 +4092,9 @@ retry:
return handle.native_handle();
}
}
#else
TORRENT_UNUSED(pc);
TORRENT_UNUSED(info_hash);
#endif
return boost::shared_ptr<torrent>();
}
@ -6597,6 +6603,11 @@ retry:
&& i->handler(request.addr, request.message, response))
return true;
}
#else
TORRENT_UNUSED(query);
TORRENT_UNUSED(query_len);
TORRENT_UNUSED(request);
TORRENT_UNUSED(response);
#endif
return false;
}

View File

@ -928,7 +928,7 @@ namespace libtorrent
TORRENT_ASSERT(m_abort);
TORRENT_ASSERT(prev == NULL && next == NULL);
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
#if defined TORRENT_DEBUG || defined TORRENT_RELEASE_ASSERTS
for (int i = 0; i < aux::session_interface::num_torrent_lists; ++i)
{
if (!m_links[i].in_list()) continue;
@ -2244,6 +2244,8 @@ namespace libtorrent
if (!pp) continue;
if (was_introduced_by(pp, ep)) return p;
}
#else
TORRENT_UNUSED(ep);
#endif
return NULL;
}
@ -4312,6 +4314,8 @@ namespace libtorrent
#ifndef TORRENT_DISABLE_LOGGING
(*p)->peer_log(peer_log_alert::outgoing, "PREDICTIVE_HAVE", "piece: %d expected in %d ms"
, index, milliseconds);
#else
TORRENT_UNUSED(milliseconds);
#endif
(*p)->announce_piece(index);
}
@ -8702,7 +8706,7 @@ namespace libtorrent
TORRENT_ASSERT(m_info_hash == m_torrent_file->info_hash());
}
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
#if defined TORRENT_DEBUG || defined TORRENT_RELEASE_ASSERTS
for (int i = 0; i < aux::session_interface::num_torrent_lists; ++i)
{
if (!m_links[i].in_list()) continue;
@ -11696,7 +11700,7 @@ namespace libtorrent
st->state = static_cast<torrent_status::state_t>(m_state);
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
#if defined TORRENT_DEBUG || defined TORRENT_RELEASE_ASSERTS
if (st->state == torrent_status::finished
|| st->state == torrent_status::seeding)
{

View File

@ -311,6 +311,9 @@ namespace libtorrent
{
#ifndef TORRENT_DISABLE_EXTENSIONS
TORRENT_ASYNC_CALL2(add_extension, ext, userdata);
#else
TORRENT_UNUSED(ext);
TORRENT_UNUSED(userdata);
#endif
}

View File

@ -243,6 +243,8 @@ void udp_socket::on_writable(error_code const& ec, udp::socket* s)
if (s == &m_ipv6_sock)
m_v6_write_subscribed = false;
else
#else
TORRENT_UNUSED(s);
#endif
m_v4_write_subscribed = false;
@ -268,6 +270,8 @@ void udp_socket::on_read(error_code const& ec, udp::socket* s)
--m_v6_outstanding;
}
else
#else
TORRENT_UNUSED(s);
#endif
{
TORRENT_ASSERT(m_v4_outstanding > 0);

View File

@ -558,7 +558,7 @@ namespace libtorrent
detail::write_int32(m_transaction_id, out); // transaction_id
// info_hash
std::copy(tracker_req().info_hash.begin(), tracker_req().info_hash.end(), out);
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
#if defined TORRENT_DEBUG || defined TORRENT_RELEASE_ASSERTS
out += 20;
TORRENT_ASSERT(out - buf == sizeof(buf));
#endif