fix some compiler warnings

This commit is contained in:
Arvid Norberg 2012-06-25 14:17:51 +00:00
parent e51e953cb9
commit 57769bab11
10 changed files with 24 additions and 23 deletions

View File

@ -756,7 +756,7 @@ namespace libtorrent
// peer id
memcpy(ptr, &m_ses.get_peer_id()[0], 20);
ptr += 20;
// ptr += 20;
#ifdef TORRENT_VERBOSE_LOGGING
peer_log("==> HANDSHAKE [ ih: %s ]", to_hex(ih.to_string()).c_str());

View File

@ -90,6 +90,7 @@ namespace libtorrent
m_queue.push_front(entry());
e = &m_queue.front();
break;
default: return;
}
e->priority = priority;

View File

@ -123,7 +123,7 @@ namespace libtorrent
if (size < 2) return -1;
size -= 2;
buffer += 2;
// buffer += 2;
}
return total_size - size;

View File

@ -293,8 +293,8 @@ namespace libtorrent
if (ptr == 0 || expect2 == 0 || strcmp(expect2, ptr)) { handle_error(invalid_response, h); return; }
int result = 0;
char const* message = 0;
float version = 3.0f;
// char const* message = 0;
// float version = 3.0f;
for(;;)
{
@ -324,11 +324,11 @@ namespace libtorrent
}
else if (strcmp("MESSAGE", name) == 0)
{
message = ptr;
// message = ptr;
}
else if (strcmp("VERSION", name) == 0)
{
version = float(atof(ptr));
// version = float(atof(ptr));
}
else if (strcmp("VALUE", name) == 0)
{

View File

@ -379,7 +379,7 @@ bool routing_table::add_node(node_entry const& e)
break;
}
if (!done)
{
{
for (bucket_t::iterator i = rb.begin(), end(rb.end());
i != end; ++i)
{
@ -388,7 +388,7 @@ bool routing_table::add_node(node_entry const& e)
TORRENT_LOG(table) << "node ID changed, deleting old entry: "
<< i->id << " " << i->addr;
#endif
rb.erase(i);
rb.erase(i);
done = true;
break;
}
@ -398,7 +398,7 @@ bool routing_table::add_node(node_entry const& e)
}
}
table_t::iterator i = find_bucket(e.id);
table_t::iterator i = find_bucket(e.id);
bucket_t& b = i->live_nodes;
bucket_t& rb = i->replacements;

View File

@ -3746,9 +3746,6 @@ namespace libtorrent
}
p.estimated_reciprocation_rate = m_est_reciprocation_rate;
int upload_capacity = m_ses.settings().upload_rate_limit;
if (upload_capacity == 0)
upload_capacity = (std::max)(20000, m_ses.m_peak_up_rate + 10000);
error_code ec;
p.local_endpoint = get_socket()->local_endpoint(ec);

View File

@ -514,6 +514,9 @@ namespace libtorrent
error_code ec;
int ret = lazy_bdecode(&buf[0], &buf[0] + buf.size(), e, ec);
TORRENT_ASSERT(ret == 0);
#ifndef BOOST_NO_EXCEPTIONS
if (ret != 0) throw libtorrent_exception(ec);
#endif
TORRENT_SYNC_CALL1(load_state, &e);
}

View File

@ -545,6 +545,9 @@ namespace libtorrent
memcpy(m_info_section.get(), t.m_info_section.get(), m_info_section_size);
int ret = lazy_bdecode(m_info_section.get(), m_info_section.get()
+ m_info_section_size, m_info_dict, ec);
#ifndef BOOST_NO_EXCEPTIONS
if (ret != 0) throw libtorrent_exception(ec);
#endif
TORRENT_ASSERT(ret == 0);
ptrdiff_t offset = m_info_section.get() - t.m_info_section.get();
@ -591,7 +594,7 @@ namespace libtorrent
if (tmp.size() == 0 || lazy_bdecode(&tmp[0], &tmp[0] + tmp.size(), e, ec) != 0)
{
#ifndef BOOST_NO_EXCEPTIONS
throw invalid_torrent_file(errors::invalid_bencoding);
throw invalid_torrent_file(ec);
#endif
return;
}

View File

@ -2677,15 +2677,15 @@ bool utp_socket_impl::incoming_packet(boost::uint8_t const* buf, int size
// within reasonable bounds. The one-way delay is never
// higher than the round-trip time.
// it's impossible for delay to be more than the RTT, so make
// sure to clamp it as a sanity check
if (delay > min_rtt) delay = min_rtt;
// only use the minimum from the last 3 delay measurements
delay = *std::min_element(m_delay_sample_hist, m_delay_sample_hist + num_delay_hist);
if (sample && acked_bytes && prev_bytes_in_flight)
{
// it's impossible for delay to be more than the RTT, so make
// sure to clamp it as a sanity check
if (delay > min_rtt) delay = min_rtt;
// only use the minimum from the last 3 delay measurements
delay = *std::min_element(m_delay_sample_hist, m_delay_sample_hist + num_delay_hist);
do_ledbat(acked_bytes, delay, prev_bytes_in_flight, receive_time);
m_send_delay = delay;
}

View File

@ -771,9 +771,6 @@ namespace libtorrent
if (!m_requests.empty())
{
range_overlaps_request = in_range.start + in_range.length
> m_requests.front().start + int(m_piece.size());
if (in_range.start + in_range.length < m_requests.front().start + m_requests.front().length
&& (m_received_body + recv_buffer.left() >= range_end - range_start))
{