merged silencing of warnings from RC_0_16

This commit is contained in:
Arvid Norberg 2013-06-14 16:41:47 +00:00
parent f91d83434b
commit 50ecb07d19
11 changed files with 33 additions and 16 deletions

View File

@ -1557,7 +1557,7 @@ int main(int argc, char* argv[])
int c = 0; int c = 0;
while (sleep_and_input(&c, refresh_delay)) while (sleep_and_input(&c, refresh_delay))
{ {
if (c == EOF) { c = 'q'; break; } if (c == EOF) { break; }
if (c == 27) if (c == 27)
{ {
// escape code, read another character // escape code, read another character
@ -1566,7 +1566,7 @@ int main(int argc, char* argv[])
#else #else
int c = getc(stdin); int c = getc(stdin);
#endif #endif
if (c == EOF) { c = 'q'; break; } if (c == EOF) { break; }
if (c != '[') continue; if (c != '[') continue;
#ifdef _WIN32 #ifdef _WIN32
c = _getch(); c = _getch();

View File

@ -287,11 +287,11 @@ void _setup_segments(GeoIP * gi) {
if (gi->databaseType == GEOIP_REGION_EDITION_REV0) { if (gi->databaseType == GEOIP_REGION_EDITION_REV0) {
/* Region Edition, pre June 2003 */ /* Region Edition, pre June 2003 */
gi->databaseSegments = (unsigned int*)malloc(sizeof(int)); gi->databaseSegments = (unsigned int*)malloc(sizeof(unsigned int));
gi->databaseSegments[0] = STATE_BEGIN_REV0; gi->databaseSegments[0] = STATE_BEGIN_REV0;
} else if (gi->databaseType == GEOIP_REGION_EDITION_REV1) { } else if (gi->databaseType == GEOIP_REGION_EDITION_REV1) {
/* Region Edition, post June 2003 */ /* Region Edition, post June 2003 */
gi->databaseSegments = (unsigned int*)malloc(sizeof(int)); gi->databaseSegments = (unsigned int*)malloc(sizeof(unsigned int));
gi->databaseSegments[0] = STATE_BEGIN_REV1; gi->databaseSegments[0] = STATE_BEGIN_REV1;
} else if (gi->databaseType == GEOIP_CITY_EDITION_REV0 || } else if (gi->databaseType == GEOIP_CITY_EDITION_REV0 ||
gi->databaseType == GEOIP_CITY_EDITION_REV1 || gi->databaseType == GEOIP_CITY_EDITION_REV1 ||
@ -299,7 +299,7 @@ void _setup_segments(GeoIP * gi) {
gi->databaseType == GEOIP_ISP_EDITION || gi->databaseType == GEOIP_ISP_EDITION ||
gi->databaseType == GEOIP_ASNUM_EDITION) { gi->databaseType == GEOIP_ASNUM_EDITION) {
/* City/Org Editions have two segments, read offset of second segment */ /* City/Org Editions have two segments, read offset of second segment */
gi->databaseSegments = (unsigned int*)malloc(sizeof(int)); gi->databaseSegments = (unsigned int*)malloc(sizeof(unsigned int));
gi->databaseSegments[0] = 0; gi->databaseSegments[0] = 0;
fread(buf, SEGMENT_RECORD_LENGTH, 1, gi->GeoIPDatabase); fread(buf, SEGMENT_RECORD_LENGTH, 1, gi->GeoIPDatabase);
for (j = 0; j < SEGMENT_RECORD_LENGTH; j++) { for (j = 0; j < SEGMENT_RECORD_LENGTH; j++) {
@ -317,7 +317,7 @@ void _setup_segments(GeoIP * gi) {
if (gi->databaseType == GEOIP_COUNTRY_EDITION || if (gi->databaseType == GEOIP_COUNTRY_EDITION ||
gi->databaseType == GEOIP_PROXY_EDITION || gi->databaseType == GEOIP_PROXY_EDITION ||
gi->databaseType == GEOIP_NETSPEED_EDITION) { gi->databaseType == GEOIP_NETSPEED_EDITION) {
gi->databaseSegments = (unsigned int*)malloc(sizeof(int)); gi->databaseSegments = (unsigned int*)malloc(sizeof(unsigned int));
gi->databaseSegments[0] = COUNTRY_BEGIN; gi->databaseSegments[0] = COUNTRY_BEGIN;
} }
} }

View File

@ -2008,7 +2008,6 @@ namespace libtorrent
lazy_pieces[lazy_piece++] = i; lazy_pieces[lazy_piece++] = i;
} }
TORRENT_ASSERT(lazy_piece == num_lazy_pieces); TORRENT_ASSERT(lazy_piece == num_lazy_pieces);
lazy_piece = 0;
} }
const int packet_size = (num_pieces + 7) / 8 + 5; const int packet_size = (num_pieces + 7) / 8 + 5;
@ -3063,7 +3062,7 @@ namespace libtorrent
{ {
TORRENT_ASSERT(m_sent_handshake); TORRENT_ASSERT(m_sent_handshake);
m_statistics.received_bytes(0, bytes_transferred); m_statistics.received_bytes(0, bytes_transferred);
bytes_transferred = 0; // bytes_transferred = 0;
if (!t) if (!t)
{ {
TORRENT_ASSERT(!packet_finished()); // TODO TORRENT_ASSERT(!packet_finished()); // TODO

View File

@ -309,7 +309,7 @@ restart_response:
{ {
m_recv_pos += incoming; m_recv_pos += incoming;
boost::get<0>(ret) += incoming; boost::get<0>(ret) += incoming;
incoming = 0; // incoming = 0;
} }
} }
else else

View File

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

View File

@ -575,6 +575,10 @@ bool verify_message(lazy_entry const* msg, key_desc_t const desc[], lazy_entry c
else if (k.flags & key_desc_t::last_child) else if (k.flags & key_desc_t::last_child)
{ {
TORRENT_ASSERT(stack_ptr > 0); TORRENT_ASSERT(stack_ptr > 0);
// this can happen if the specification passed
// in is unbalanced. i.e. contain more last_child
// nodes than parse_children
if (stack_ptr == 0) return false;
--stack_ptr; --stack_ptr;
msg = stack[stack_ptr]; msg = stack[stack_ptr];
} }

View File

@ -413,12 +413,14 @@ bool routing_table::add_node(node_entry e)
i != end; ++i) i != end; ++i)
{ {
if (i->addr() != e.addr() || i->port() != e.port()) continue; if (i->addr() != e.addr() || i->port() != e.port()) continue;
#ifdef TORRENT_DHT_VERBOSE_LOGGING #ifdef TORRENT_DHT_VERBOSE_LOGGING
TORRENT_LOG(table) << "node ID changed, deleting old entry: " TORRENT_LOG(table) << "node ID changed, deleting old entry: "
<< i->id << " " << i->addr(); << i->id << " " << i->addr();
#endif #endif
b.erase(i); b.erase(i);
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
done = true; done = true;
#endif
break; break;
} }
if (!done) if (!done)
@ -427,12 +429,14 @@ bool routing_table::add_node(node_entry e)
i != end; ++i) i != end; ++i)
{ {
if (i->addr() != e.addr() || i->port() != e.port()) continue; if (i->addr() != e.addr() || i->port() != e.port()) continue;
#ifdef TORRENT_DHT_VERBOSE_LOGGING #ifdef TORRENT_DHT_VERBOSE_LOGGING
TORRENT_LOG(table) << "node ID changed, deleting old entry: " TORRENT_LOG(table) << "node ID changed, deleting old entry: "
<< i->id << " " << i->addr(); << i->id << " " << i->addr();
#endif #endif
rb.erase(i); rb.erase(i);
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
done = true; done = true;
#endif
break; break;
} }
} }

View File

@ -540,7 +540,11 @@ namespace libtorrent
bencode(std::back_inserter(buf), ses_state); bencode(std::back_inserter(buf), ses_state);
lazy_entry e; lazy_entry e;
error_code ec; error_code ec;
int ret = lazy_bdecode(&buf[0], &buf[0] + buf.size(), e, ec); #if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
int ret =
#endif
lazy_bdecode(&buf[0], &buf[0] + buf.size(), e, ec);
TORRENT_ASSERT(ret == 0); TORRENT_ASSERT(ret == 0);
#ifndef BOOST_NO_EXCEPTIONS #ifndef BOOST_NO_EXCEPTIONS
if (ret != 0) throw libtorrent_exception(ec); if (ret != 0) throw libtorrent_exception(ec);

View File

@ -590,7 +590,10 @@ namespace libtorrent
error_code ec; error_code ec;
m_info_section.reset(new char[m_info_section_size]); m_info_section.reset(new char[m_info_section_size]);
memcpy(m_info_section.get(), t.m_info_section.get(), m_info_section_size); 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() #if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
int ret =
#endif
lazy_bdecode(m_info_section.get(), m_info_section.get()
+ m_info_section_size, m_info_dict, ec); + m_info_section_size, m_info_dict, ec);
#ifndef BOOST_NO_EXCEPTIONS #ifndef BOOST_NO_EXCEPTIONS
if (ret != 0) throw libtorrent_exception(ec); if (ret != 0) throw libtorrent_exception(ec);

View File

@ -490,8 +490,10 @@ namespace libtorrent
detail::write_int32(m_transaction_id, out); // transaction_id detail::write_int32(m_transaction_id, out); // transaction_id
// info_hash // info_hash
std::copy(tracker_req().info_hash.begin(), tracker_req().info_hash.end(), out); std::copy(tracker_req().info_hash.begin(), tracker_req().info_hash.end(), out);
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
out += 20; out += 20;
TORRENT_ASSERT(out - buf == sizeof(buf)); TORRENT_ASSERT(out - buf == sizeof(buf));
#endif
error_code ec; error_code ec;
if (!m_hostname.empty()) if (!m_hostname.empty())

View File

@ -3176,7 +3176,6 @@ void utp_socket_impl::tick(ptime const& now)
, this, socket_state_names[m_state], m_read, m_read_handler ? "handler" : "no handler" , this, socket_state_names[m_state], m_read, m_read_handler ? "handler" : "no handler"
, m_written, m_write_handler ? "handler" : "no handler"); , m_written, m_write_handler ? "handler" : "no handler");
#endif #endif
bool window_opened = false;
TORRENT_ASSERT(m_outbuf.at((m_acked_seq_nr + 1) & ACK_MASK) || ((m_seq_nr - m_acked_seq_nr) & ACK_MASK) <= 1); TORRENT_ASSERT(m_outbuf.at((m_acked_seq_nr + 1) & ACK_MASK) || ((m_seq_nr - m_acked_seq_nr) & ACK_MASK) <= 1);