fixed some GCC warnings

This commit is contained in:
arvidn 2015-08-20 01:33:20 +02:00
parent 91a08606cf
commit ffa870d280
46 changed files with 268 additions and 152 deletions

11
Jamfile
View File

@ -280,7 +280,7 @@ rule warnings ( properties * )
# in the code (without final)
result += <cflags>-Wno-non-virtual-dtor ;
# enable these warnings again, once the other ones are delt with
# enable these warnings again, once the other ones are dealt with
result += <cflags>-Wno-weak-vtables ;
result += <cflags>-Wno-sign-compare ;
result += <cflags>-Wno-sign-conversion ;
@ -291,11 +291,18 @@ rule warnings ( properties * )
{
result += <cflags>-Wall ;
result += <cflags>-Wextra ;
result += <cflags>-Wpedantic ;
# result += <cflags>-Wmisleading-indentation ;
result += <cflags>-Wparentheses ;
result += <cflags>-Wvla ;
result += <cflags>-Wc++11-compat ;
result += <cflags>-Wc++14-compat ;
result += <cflags>-Wno-deprecated-declarations ;
result += <cflags>-Wno-format-zero-length ;
# enable these warnings again, once the other ones are dealt with
result += <cflags>-Wno-sign-compare ;
result += <cflags>-Wno-unused-variable ;
}
if <toolset>msvc in $(properties)

View File

@ -266,6 +266,10 @@ namespace libtorrent {
virtual int category() const = 0;
#ifndef TORRENT_NO_DEPRECATE
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
// determines whether or not an alert is allowed to be discarded
// when the alert queue is full. There are a few alerts which may not be discared,
// since they would break the user contract, such as save_resume_data_alert.
@ -284,6 +288,9 @@ namespace libtorrent {
virtual bool discardable_impl() const { return true; }
virtual std::auto_ptr<alert> clone_impl() const = 0;
#pragma GCC diagnostic pop
#endif
private:

View File

@ -69,7 +69,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/debug.hpp"
#include "libtorrent/piece_block_progress.hpp"
#include "libtorrent/ip_filter.hpp"
#include "libtorrent/config.hpp"
#include "libtorrent/session_settings.hpp"
#include "libtorrent/session_status.hpp"
#include "libtorrent/add_torrent_params.hpp"

View File

@ -39,7 +39,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/bdecode.hpp"
#include <string>
#include <memory>
namespace libtorrent
{
@ -68,7 +67,7 @@ namespace libtorrent
= boost::function<void(disk_io_job const*)>()) = 0;
virtual void async_check_fastresume(piece_manager* storage
, bdecode_node const* resume_data
, std::auto_ptr<std::vector<std::string> >& links
, std::vector<std::string>& links
, boost::function<void(disk_io_job const*)> const& handler) = 0;
#ifndef TORRENT_NO_DEPRECATE
virtual void async_finalize_file(piece_manager*, int file

View File

@ -235,7 +235,7 @@ namespace libtorrent
// number of read jobs in the disk job queue
int read_queue_size;
// number of jobs blocked because of a fence
int blocked_jobs;
@ -315,7 +315,7 @@ namespace libtorrent
, boost::function<void(disk_io_job const*)> const& handler);
void async_check_fastresume(piece_manager* storage
, bdecode_node const* resume_data
, std::auto_ptr<std::vector<std::string> >& links
, std::vector<std::string>& links
, boost::function<void(disk_io_job const*)> const& handler);
void async_save_resume_data(piece_manager* storage
, boost::function<void(disk_io_job const*)> const& handler);

View File

@ -33,11 +33,13 @@ POSSIBILITY OF SUCH DAMAGE.
#ifndef TORRENT_IP_FILTER_HPP
#define TORRENT_IP_FILTER_HPP
#include <set>
#include <vector>
#include "libtorrent/config.hpp"
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <set>
#include <vector>
#include <boost/limits.hpp>
#include <boost/utility.hpp>
#include <boost/cstdint.hpp>
@ -45,7 +47,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#include "libtorrent/config.hpp"
#include "libtorrent/address.hpp"
#include "libtorrent/assert.hpp"
@ -148,15 +149,15 @@ namespace detail
{
TORRENT_ASSERT(!m_access_list.empty());
TORRENT_ASSERT(first < last || first == last);
typename range_t::iterator i = m_access_list.upper_bound(first);
typename range_t::iterator j = m_access_list.upper_bound(last);
if (i != m_access_list.begin()) --i;
TORRENT_ASSERT(j != m_access_list.begin());
TORRENT_ASSERT(j != i);
boost::uint32_t first_access = i->access;
boost::uint32_t last_access = boost::prior(j)->access;
@ -184,7 +185,7 @@ namespace detail
{
m_access_list.insert(i, range(first, flags));
}
if ((j != m_access_list.end()
&& minus_one(j->start) != last)
|| (j == m_access_list.end()
@ -228,14 +229,14 @@ namespace detail
r.last = ExternalAddressType(max_addr<Addr>());
else
r.last = ExternalAddressType(minus_one(i->start));
ret.push_back(r);
}
return ret;
}
private:
struct range
{
range(Addr addr, int a = 0): start(addr), access(a) {}
@ -300,7 +301,7 @@ struct TORRENT_EXPORT ip_filter
#else
typedef std::vector<ip_range<address_v4> > filter_tuple_t;
#endif
// This function will return the current state of the filter in the minimum number of
// ranges possible. They are sorted from ranges in low addresses to high addresses. Each
// entry in the returned vector is a range with the access control specified in its
@ -311,7 +312,7 @@ struct TORRENT_EXPORT ip_filter
filter_tuple_t export_filter() const;
// void print() const;
private:
detail::filter_impl<address_v4::bytes_type> m_filter4;

View File

@ -41,11 +41,15 @@ POSSIBILITY OF SUCH DAMAGE.
#include <libtorrent/kademlia/observer.hpp>
#include <libtorrent/address.hpp>
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <boost/noncopyable.hpp>
#include <boost/intrusive_ptr.hpp>
#include <boost/bind.hpp>
#include <boost/pool/pool.hpp>
#include "libtorrent/aux_/disable_warnings_pop.hpp"
namespace libtorrent { struct dht_lookup; }
namespace libtorrent { namespace dht
{

View File

@ -892,11 +892,17 @@ namespace libtorrent
TORRENT_DEPRECATED
int max_uploads() const;
TORRENT_DEPRECATED
std::auto_ptr<alert> pop_alert();
TORRENT_DEPRECATED
void pop_alerts(std::deque<alert*>* alerts);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
TORRENT_DEPRECATED
std::auto_ptr<alert> pop_alert();
#pragma GCC diagnostic pop
#endif
// Alerts is the main mechanism for libtorrent to report errors and
@ -974,6 +980,9 @@ namespace libtorrent
TORRENT_DEPRECATED
boost::uint32_t get_alert_mask() const;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
// This sets a function to be called (from within libtorrent's netowrk
// thread) every time an alert is posted. Since the function (``fun``) is
// run in libtorrent's internal thread, it may not block.
@ -986,6 +995,8 @@ namespace libtorrent
void set_alert_dispatch(
boost::function<void(std::auto_ptr<alert>)> const& fun);
#pragma GCC diagnostic pop
// Starts and stops Local Service Discovery. This service will broadcast
// the infohashes of all the non-private torrents on the local network to
// look for peers on the same swarm within multicast reach.

View File

@ -117,6 +117,9 @@ namespace libtorrent
return false;
}
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
void alert_manager::set_dispatch_function(
boost::function<void(std::auto_ptr<alert>)> const& fun)
{
@ -137,6 +140,9 @@ namespace libtorrent
m_dispatch((*i)->clone());
}
}
#pragma GCC diagnostic pop
#endif
void alert_manager::set_notify_function(boost::function<void()> const& fun)

View File

@ -283,7 +283,7 @@ const char* const job_action_name[] =
"hash_passed: %d\nread_jobs: %d\njobs: %d\n"
"piece_log:\n"
, int(pe->piece), pe->refcount, pe->piece_refcount, int(pe->num_blocks)
, int(pe->hashing), pe->hash, pe->hash ? pe->hash->offset : -1
, int(pe->hashing), static_cast<void*>(pe->hash), pe->hash ? pe->hash->offset : -1
, int(pe->cache_state)
, pe->cache_state < cached_piece_entry::num_lrus ? cache_state[pe->cache_state] : ""
, int(pe->outstanding_flush), int(pe->piece), int(pe->num_dirty)

View File

@ -31,6 +31,10 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#include "libtorrent/config.hpp"
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <vector>
#include <boost/limits.hpp>
#include <boost/bind.hpp>
@ -39,6 +43,8 @@ POSSIBILITY OF SUCH DAMAGE.
#include <memory> // autp_ptr
#endif
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#include "libtorrent/bt_peer_connection.hpp"
#include "libtorrent/session.hpp"
#include "libtorrent/identify_client.hpp"
@ -196,7 +202,6 @@ namespace libtorrent
#ifndef TORRENT_DISABLE_LOGGING
char const* policy_name[] = {"forced", "enabled", "disabled"};
TORRENT_ASSERT(out_policy < sizeof(policy_name)/sizeof(policy_name[0]));
TORRENT_ASSERT(out_policy >= 0);
peer_log(peer_log_alert::info, "ENCRYPTION"
, "outgoing encryption policy: %s", policy_name[out_policy]);
#endif

View File

@ -1878,7 +1878,7 @@ namespace libtorrent
void disk_io_thread::async_check_fastresume(piece_manager* storage
, bdecode_node const* resume_data
, std::auto_ptr<std::vector<std::string> >& links
, std::vector<std::string>& links
, boost::function<void(disk_io_job const*)> const& handler)
{
#ifdef TORRENT_DEBUG
@ -1887,14 +1887,17 @@ namespace libtorrent
storage->assert_torrent_refcount();
#endif
std::vector<std::string>* links_vector
= new std::vector<std::string>();
links_vector->swap(links);
disk_io_job* j = allocate_job(disk_io_job::check_fastresume);
j->storage = storage->shared_from_this();
j->buffer.string = (char*)resume_data;
j->d.links = links.get();
j->d.links = links_vector;
j->callback = handler;
add_fence_job(storage, j);
links.release();
}
void disk_io_thread::async_save_resume_data(piece_manager* storage
@ -2570,7 +2573,7 @@ namespace libtorrent
#if TORRENT_USE_ASSERTS
m_disk_cache.mark_deleted(*j->storage->files());
#endif
flush_cache(j->storage.get(), flush_delete_cache | flush_expect_clear
, completed_jobs, l);
l.unlock();
@ -2588,7 +2591,7 @@ namespace libtorrent
bdecode_node tmp;
if (rd == NULL) rd = &tmp;
std::auto_ptr<std::vector<std::string> > links(j->d.links);
boost::scoped_ptr<std::vector<std::string> > links(j->d.links);
return j->storage->check_fastresume(*rd, links.get(), j->error);
}

View File

@ -30,8 +30,15 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#include "libtorrent/config.hpp"
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <boost/version.hpp>
#include <boost/bind.hpp>
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#include "libtorrent/assert.hpp"
#include "libtorrent/file_pool.hpp"
#include "libtorrent/error_code.hpp"

View File

@ -45,10 +45,14 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/debug.hpp"
#endif
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <boost/bind.hpp>
#include <string>
#include <algorithm>
#include "libtorrent/aux_/disable_warnings_pop.hpp"
namespace libtorrent {
http_connection::http_connection(io_service& ios

View File

@ -30,10 +30,16 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#include "libtorrent/config.hpp"
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <vector>
#include <boost/limits.hpp>
#include <boost/bind.hpp>
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#include "libtorrent/http_seed_connection.hpp"
#include "libtorrent/session.hpp"
#include "libtorrent/identify_client.hpp"

View File

@ -30,24 +30,20 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#include "libtorrent/config.hpp"
#include "libtorrent/gzip.hpp"
#include "libtorrent/socket_io.hpp"
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <vector>
#include <list>
#include <cctype>
#include <algorithm>
#include "libtorrent/config.hpp"
#include "libtorrent/gzip.hpp"
#include "libtorrent/socket_io.hpp"
#ifdef _MSC_VER
#pragma warning(push, 1)
#endif
#include <boost/bind.hpp>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#include "libtorrent/tracker_manager.hpp"
#include "libtorrent/http_tracker_connection.hpp"

View File

@ -54,7 +54,7 @@ void find_data_observer::reply(msg const& m)
{
#ifndef TORRENT_DISABLE_LOGGING
get_observer()->log(dht_logger::traversal, "[%p] missing response dict"
, algorithm());
, static_cast<void*>(algorithm()));
#endif
return;
}
@ -64,7 +64,7 @@ void find_data_observer::reply(msg const& m)
{
#ifndef TORRENT_DISABLE_LOGGING
get_observer()->log(dht_logger::traversal, "[%p] invalid id in response"
, algorithm());
, static_cast<void*>(algorithm()));
#endif
return;
}
@ -112,8 +112,10 @@ void find_data::start()
void find_data::got_write_token(node_id const& n, std::string const& write_token)
{
#ifndef TORRENT_DISABLE_LOGGING
get_node().observer()->log(dht_logger::traversal, "[%p] adding write token '%s' under id '%s'"
, this, to_hex(write_token).c_str(), to_hex(n.to_string()).c_str());
get_node().observer()->log(dht_logger::traversal
, "[%p] adding write token '%s' under id '%s'"
, static_cast<void*>(this), to_hex(write_token).c_str()
, to_hex(n.to_string()).c_str());
#endif
m_write_tokens[n] = write_token;
}
@ -138,7 +140,7 @@ void find_data::done()
#ifndef TORRENT_DISABLE_LOGGING
get_node().observer()->log(dht_logger::traversal, "[%p] %s DONE"
, this, name());
, static_cast<void*>(this), name());
#endif
std::vector<std::pair<node_entry, std::string> > results;
@ -151,7 +153,7 @@ void find_data::done()
{
#ifndef TORRENT_DISABLE_LOGGING
get_node().observer()->log(dht_logger::traversal, "[%p] not alive: %s"
, this, print_endpoint(o->target_ep()).c_str());
, static_cast<void*>(this), print_endpoint(o->target_ep()).c_str());
#endif
continue;
}
@ -160,14 +162,14 @@ void find_data::done()
{
#ifndef TORRENT_DISABLE_LOGGING
get_node().observer()->log(dht_logger::traversal, "[%p] no write token: %s"
, this, print_endpoint(o->target_ep()).c_str());
, static_cast<void*>(this), print_endpoint(o->target_ep()).c_str());
#endif
continue;
}
results.push_back(std::make_pair(node_entry(o->id(), o->target_ep()), j->second));
#ifndef TORRENT_DISABLE_LOGGING
get_node().observer()->log(dht_logger::traversal, "[%p] %s"
, this, print_endpoint(o->target_ep()).c_str());
, static_cast<void*>(this), print_endpoint(o->target_ep()).c_str());
#endif
--num_results;
}

View File

@ -213,7 +213,7 @@ void get_item::put(std::vector<std::pair<node_entry, std::string> > const& v)
// the bencoded dict if logging is disabled
get_node().observer()->log(dht_logger::traversal, "[%p] sending put "
"[ seq: %" PRId64 " nodes: %d ]"
, this, (m_data.is_mutable() ? m_data.seq() : -1)
, static_cast<void*>(this), (m_data.is_mutable() ? m_data.seq() : -1)
, int(v.size()));
#endif
@ -227,7 +227,7 @@ void get_item::put(std::vector<std::pair<node_entry, std::string> > const& v)
{
#ifndef TORRENT_DISABLE_LOGGING
get_node().observer()->log(dht_logger::traversal, "[%p] put-distance: %d"
, this, 160 - distance_exp(m_target, i->first.id));
, static_cast<void*>(this), 160 - distance_exp(m_target, i->first.id));
#endif
void* ptr = m_node.m_rpc.allocate_observer();
@ -269,7 +269,7 @@ void get_item_observer::reply(msg const& m)
{
#ifndef TORRENT_DISABLE_LOGGING
get_observer()->log(dht_logger::traversal, "[%p] missing response dict"
, algorithm());
, static_cast<void*>(algorithm()));
#endif
return;
}

View File

@ -52,7 +52,7 @@ void get_peers_observer::reply(msg const& m)
{
#ifndef TORRENT_DISABLE_LOGGING
get_observer()->log(dht_logger::traversal, "[%p] missing response dict"
, algorithm());
, static_cast<void*>(algorithm()));
#endif
return;
}
@ -74,7 +74,7 @@ void get_peers_observer::reply(msg const& m)
{
get_observer()->log(dht_logger::traversal, "[%p] PEERS "
"invoke-count: %d branch-factor: %d addr: %s id: %s distance: %d p: %d"
, algorithm()
, static_cast<void*>(algorithm())
, algorithm()->invoke_count()
, algorithm()->branch_factor()
, print_endpoint(m.addr).c_str()
@ -96,7 +96,7 @@ void get_peers_observer::reply(msg const& m)
{
get_observer()->log(dht_logger::traversal, "[%p] PEERS "
"invoke-count: %d branch-factor: %d addr: %s id: %s distance: %d p: %d"
, algorithm()
, static_cast<void*>(algorithm())
, algorithm()->invoke_count()
, algorithm()->branch_factor()
, print_endpoint(m.addr).c_str()
@ -279,7 +279,8 @@ void obfuscated_get_peers::done()
#ifndef TORRENT_DISABLE_LOGGING
get_node().observer()->log(dht_logger::traversal, "[%p] obfuscated get_peers "
"phase 1 done, spawning get_peers [ %p ]"
, this, ta.get());
, static_cast<void*>(this)
, static_cast<void*>(ta.get()));
#endif
int num_added = 0;
@ -309,7 +310,7 @@ void obfuscated_get_peers_observer::reply(msg const& m)
{
#ifndef TORRENT_DISABLE_LOGGING
get_observer()->log(dht_logger::traversal, "[%p] missing response dict"
, algorithm());
, static_cast<void*>(algorithm()));
#endif
return;
}
@ -319,7 +320,7 @@ void obfuscated_get_peers_observer::reply(msg const& m)
{
#ifndef TORRENT_DISABLE_LOGGING
get_observer()->log(dht_logger::traversal, "[%p] invalid id in response"
, algorithm());
, static_cast<void*>(algorithm()));
#endif
return;
}

View File

@ -484,7 +484,7 @@ struct ping_observer : observer
{
get_observer()->log(dht_logger::node
, "[%p] missing response dict"
, algorithm());
, static_cast<void*>(algorithm()));
}
#endif
return;

View File

@ -89,7 +89,7 @@ void bootstrap::done()
{
#ifndef TORRENT_DISABLE_LOGGING
get_node().observer()->log(dht_logger::traversal, "[%p] bootstrap done, pinging remaining nodes"
, this);
, static_cast<void*>(this));
#endif
for (std::vector<observer_ptr>::iterator i = m_results.begin()

View File

@ -337,7 +337,7 @@ bool rpc_manager::incoming(msg const& m, node_id* id
#ifndef TORRENT_DISABLE_LOGGING
m_log->log(dht_logger::rpc_manager, "[%p] reply with transaction id: %d from %s"
, o->algorithm(), int(transaction_id.size())
, static_cast<void*>(o->algorithm()), int(transaction_id.size())
, print_endpoint(m.addr).c_str());
#endif
o->reply(m);
@ -357,7 +357,7 @@ time_duration rpc_manager::tick()
static const int short_timeout = 1;
static const int timeout = 15;
// look for observers that have timed out
// look for observers that have timed out
if (m_transactions.empty()) return seconds(short_timeout);
@ -377,7 +377,7 @@ time_duration rpc_manager::tick()
{
#ifndef TORRENT_DISABLE_LOGGING
m_log->log(dht_logger::rpc_manager, "[%p] timing out transaction id: %d from: %s"
, o->algorithm(), o->transaction_id()
, static_cast<void*>(o->algorithm()), o->transaction_id()
, print_endpoint(o->target_ep()).c_str());
#endif
m_transactions.erase(i++);
@ -391,7 +391,7 @@ time_duration rpc_manager::tick()
{
#ifndef TORRENT_DISABLE_LOGGING
m_log->log(dht_logger::rpc_manager, "[%p] short-timing out transaction id: %d from: %s"
, o->algorithm(), o->transaction_id()
, static_cast<void*>(o->algorithm()), o->transaction_id()
, print_endpoint(o->target_ep()).c_str());
#endif
++i;
@ -438,7 +438,7 @@ bool rpc_manager::invoke(entry& e, udp::endpoint target_addr
#ifndef TORRENT_DISABLE_LOGGING
m_log->log(dht_logger::rpc_manager, "[%p] invoking %s -> %s"
, o->algorithm(), e["q"].string().c_str()
, static_cast<void*>(o->algorithm()), e["q"].string().c_str()
, print_endpoint(target_addr).c_str());
#endif

View File

@ -95,7 +95,7 @@ traversal_algorithm::traversal_algorithm(
char hex_target[41];
to_hex(reinterpret_cast<char const*>(&target[0]), 20, hex_target);
get_node().observer()->log(dht_logger::traversal, "[%p] NEW target: %s k: %d"
, this, hex_target, int(m_node.m_table.bucket_size()));
, static_cast<void*>(this), hex_target, int(m_node.m_table.bucket_size()));
}
#endif
}
@ -124,7 +124,7 @@ void traversal_algorithm::add_entry(node_id const& id, udp::endpoint addr, unsig
if (get_node().observer())
{
get_node().observer()->log(dht_logger::traversal, "[%p] failed to allocate memory or observer. aborting!"
, this);
, static_cast<void*>(this));
}
#endif
done();
@ -180,7 +180,7 @@ void traversal_algorithm::add_entry(node_id const& id, udp::endpoint addr, unsig
to_hex(reinterpret_cast<char const*>(&o->id()[0]), 20, hex_id);
get_node().observer()->log(dht_logger::traversal
, "[%p] IGNORING result id: %s addr: %s type: %s"
, this, hex_id, print_address(o->target_addr()).c_str(), name());
, static_cast<void*>(this), hex_id, print_address(o->target_addr()).c_str(), name());
}
#endif
return;
@ -200,7 +200,7 @@ void traversal_algorithm::add_entry(node_id const& id, udp::endpoint addr, unsig
to_hex(reinterpret_cast<char const*>(&id[0]), 20, hex_id);
get_node().observer()->log(dht_logger::traversal
, "[%p] ADD id: %s addr: %s distance: %d invoke-count: %d type: %s"
, this, hex_id, print_endpoint(addr).c_str()
, static_cast<void*>(this), hex_id, print_endpoint(addr).c_str()
, distance_exp(m_target, id), m_invoke_count, name());
}
#endif
@ -257,7 +257,7 @@ void traversal_algorithm::traverse(node_id const& id, udp::endpoint addr)
{
get_node().observer()->log(dht_logger::traversal
, "[%p] WARNING node returned a list which included a node with id 0"
, this);
, static_cast<void*>(this));
}
#endif
@ -326,7 +326,7 @@ void traversal_algorithm::failed(observer_ptr o, int flags)
get_node().observer()->log(dht_logger::traversal
, "[%p] 1ST_TIMEOUT id: %s distance: %d addr: %s branch-factor: %d "
"invoke-count: %d type: %s"
, this, hex_id, distance_exp(m_target, o->id())
, static_cast<void*>(this), hex_id, distance_exp(m_target, o->id())
, print_address(o->target_addr()).c_str(), m_branch_factor
, m_invoke_count, name());
}
@ -348,7 +348,7 @@ void traversal_algorithm::failed(observer_ptr o, int flags)
get_node().observer()->log(dht_logger::traversal
, "[%p] TIMEOUT id: %s distance: %d addr: %s branch-factor: %d "
"invoke-count: %d type: %s"
, this, hex_id, distance_exp(m_target, o->id())
, static_cast<void*>(this), hex_id, distance_exp(m_target, o->id())
, print_address(o->target_addr()).c_str(), m_branch_factor
, m_invoke_count, name());
}
@ -387,7 +387,7 @@ void traversal_algorithm::done()
to_hex(reinterpret_cast<char const*>(&o->id()[0]), 20, hex_id);
get_node().observer()->log(dht_logger::traversal
, "[%p] id: %s distance: %d addr: %s"
, this, hex_id, closest_target
, static_cast<void*>(this), hex_id, closest_target
, print_endpoint(o->target_ep()).c_str());
--results_target;
@ -400,7 +400,7 @@ void traversal_algorithm::done()
{
get_node().observer()->log(dht_logger::traversal
, "[%p] COMPLETED distance: %d type: %s"
, this, closest_target, name());
, static_cast<void*>(this), closest_target, name());
}
#endif
// delete all our references to the observer objects so
@ -465,7 +465,7 @@ bool traversal_algorithm::add_requests()
, "[%p] INVOKE nodes-left: %d top-invoke-count: %d "
"invoke-count: %d branch-factor: %d "
"distance: %d id: %s addr: %s type: %s"
, this, int(m_results.end() - i), outstanding, int(m_invoke_count)
, static_cast<void*>(this), int(m_results.end() - i), outstanding, int(m_invoke_count)
, int(m_branch_factor), distance_exp(m_target, o->id()), hex_id
, print_address(o->target_addr()).c_str(), name());
}
@ -499,7 +499,7 @@ void traversal_algorithm::add_router_entries()
{
get_node().observer()->log(dht_logger::traversal
, "[%p] using router nodes to initiate traversal algorithm %d routers"
, this, int(std::distance(m_node.m_table.router_begin(), m_node.m_table.router_end())));
, static_cast<void*>(this), int(std::distance(m_node.m_table.router_begin(), m_node.m_table.router_end())));
}
#endif
for (routing_table::router_iterator i = m_node.m_table.router_begin()
@ -557,7 +557,7 @@ void traversal_observer::reply(msg const& m)
{
get_observer()->log(dht_logger::traversal
, "[%p] missing response dict"
, algorithm());
, static_cast<void*>(algorithm()));
}
#endif
return;
@ -571,7 +571,7 @@ void traversal_observer::reply(msg const& m)
to_hex(nid.string_ptr(), 20, hex_id);
get_observer()->log(dht_logger::traversal
, "[%p] RESPONSE id: %s invoke-count: %d addr: %s type: %s"
, algorithm(), hex_id, algorithm()->invoke_count()
, static_cast<void*>(algorithm()), hex_id, algorithm()->invoke_count()
, print_endpoint(target_ep()).c_str(), algorithm()->name());
}
#endif
@ -598,7 +598,7 @@ void traversal_observer::reply(msg const& m)
if (get_observer())
{
get_observer()->log(dht_logger::traversal, "[%p] invalid id in response"
, algorithm());
, static_cast<void*>(algorithm()));
}
#endif
return;
@ -623,7 +623,7 @@ void traversal_algorithm::abort()
if (get_node().observer())
{
get_node().observer()->log(dht_logger::traversal, "[%p] ABORTED type: %s"
, this, name());
, static_cast<void*>(this), name());
}
#endif

View File

@ -30,6 +30,9 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#include "libtorrent/config.hpp"
#include "libtorrent/aux_/disable_warnings_push.hpp"
#if defined TORRENT_OS2
#include <pthread.h>
#endif
@ -37,6 +40,8 @@ POSSIBILITY OF SUCH DAMAGE.
#include <boost/version.hpp>
#include <boost/bind.hpp>
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#include "libtorrent/natpmp.hpp"
#include "libtorrent/io.hpp"
#include "libtorrent/assert.hpp"

View File

@ -230,7 +230,8 @@ namespace libtorrent
, "ep: %s type: %s seed: %d p: %p local: %s"
, print_endpoint(m_remote).c_str()
, m_socket->type_name()
, m_peer_info ? m_peer_info->seed : 0, m_peer_info
, m_peer_info ? m_peer_info->seed : 0
, static_cast<void*>(m_peer_info)
, print_endpoint(local_ep).c_str());
#endif
#ifdef TORRENT_DEBUG
@ -389,7 +390,7 @@ namespace libtorrent
disconnect(ec, op_sock_bind);
return;
}
#ifndef TORRENT_DISABLE_LOGGING
peer_log(peer_log_alert::outgoing, "ASYNC_CONNECT", "dst: %s"
, print_endpoint(m_remote).c_str());
@ -400,7 +401,8 @@ namespace libtorrent
#ifndef TORRENT_DISABLE_LOGGING
if (t)
t->debug_log("START connect [%p] (%d)", this, int(t->num_peers()));
t->debug_log("START connect [%p] (%d)", static_cast<void*>(this)
, int(t->num_peers()));
#endif
m_socket->async_connect(m_remote
@ -706,7 +708,8 @@ namespace libtorrent
if (m_num_pieces == int(m_have_piece.size()))
{
#ifndef TORRENT_DISABLE_LOGGING
peer_log(peer_log_alert::info, "INIT", "this is a seed p: %p", m_peer_info);
peer_log(peer_log_alert::info, "INIT", "this is a seed p: %p"
, static_cast<void*>(m_peer_info));
#endif
TORRENT_ASSERT(m_have_piece.all_set());
@ -1576,7 +1579,8 @@ namespace libtorrent
#ifndef TORRENT_DISABLE_LOGGING
m_unchoke_time = clock_type::now();
t->debug_log("UNCHOKE [%p] (%d ms)", this, int(total_milliseconds(m_unchoke_time - m_bitfield_time)));
t->debug_log("UNCHOKE [%p] (%d ms)", static_cast<void*>(this)
, int(total_milliseconds(m_unchoke_time - m_bitfield_time)));
#endif
#ifndef TORRENT_DISABLE_EXTENSIONS
@ -1881,7 +1885,8 @@ namespace libtorrent
if (is_seed())
{
#ifndef TORRENT_DISABLE_LOGGING
peer_log(peer_log_alert::info, "SEED", "this is a seed. p: %p", m_peer_info);
peer_log(peer_log_alert::info, "SEED", "this is a seed. p: %p"
, static_cast<void*>(m_peer_info));
#endif
TORRENT_ASSERT(m_have_piece.all_set());
@ -2039,7 +2044,9 @@ namespace libtorrent
#ifndef TORRENT_DISABLE_LOGGING
m_bitfield_time = clock_type::now();
t->debug_log("HANDSHAKE [%p] (%d ms)", this, int(total_milliseconds(m_bitfield_time - m_connect_time)));
t->debug_log("HANDSHAKE [%p] (%d ms)"
, static_cast<void*>(this)
, int(total_milliseconds(m_bitfield_time - m_connect_time)));
#endif
// if we don't have metadata yet
// just remember the bitmask
@ -2049,7 +2056,8 @@ namespace libtorrent
{
#ifndef TORRENT_DISABLE_LOGGING
if (m_num_pieces == int(bits.size()))
peer_log(peer_log_alert::info, "SEED", "this is a seed. p: %p", m_peer_info);
peer_log(peer_log_alert::info, "SEED", "this is a seed. p: %p"
, static_cast<void*>(m_peer_info));
#endif
m_have_piece = bits;
m_num_pieces = bits.count();
@ -2063,12 +2071,13 @@ namespace libtorrent
}
TORRENT_ASSERT(t->valid_metadata());
int num_pieces = bits.count();
if (num_pieces == int(m_have_piece.size()))
{
#ifndef TORRENT_DISABLE_LOGGING
peer_log(peer_log_alert::info, "SEED", "this is a seed. p: %p", m_peer_info);
peer_log(peer_log_alert::info, "SEED", "this is a seed. p: %p"
, static_cast<void*>(m_peer_info));
#endif
t->set_seed(m_peer_info, true);
@ -2780,7 +2789,7 @@ namespace libtorrent
}
#ifndef TORRENT_DISABLE_LOGGING
t->debug_log("PIECE [%p] (%d ms) (%d)", this
t->debug_log("PIECE [%p] (%d ms) (%d)", static_cast<void*>(this)
, int(total_milliseconds(clock_type::now() - m_unchoke_time)), t->num_have());
peer_log(peer_log_alert::info, "FILE_ASYNC_WRITE", "piece: %d s: %x l: %x"
@ -2977,7 +2986,7 @@ namespace libtorrent
if (t->alerts().should_post<block_finished_alert>())
{
t->alerts().emplace_alert<block_finished_alert>(t->get_handle(),
t->alerts().emplace_alert<block_finished_alert>(t->get_handle(),
remote(), pid(), int(block_finished.block_index)
, int(block_finished.piece_index));
}
@ -3111,7 +3120,8 @@ namespace libtorrent
m_have_all = true;
#ifndef TORRENT_DISABLE_LOGGING
peer_log(peer_log_alert::info, "SEED", "this is a seed p: %p", m_peer_info);
peer_log(peer_log_alert::info, "SEED", "this is a seed p: %p"
, static_cast<void*>(m_peer_info));
#endif
t->set_seed(m_peer_info, true);
@ -3120,7 +3130,9 @@ namespace libtorrent
#ifndef TORRENT_DISABLE_LOGGING
m_bitfield_time = clock_type::now();
t->debug_log("HANDSHAKE [%p] (%d ms)", this, int(total_milliseconds(m_bitfield_time - m_connect_time)));
t->debug_log("HANDSHAKE [%p] (%d ms)"
, static_cast<void*>(this)
, int(total_milliseconds(m_bitfield_time - m_connect_time)));
#endif
// if we don't have metadata yet
@ -3140,7 +3152,7 @@ namespace libtorrent
TORRENT_ASSERT(!m_have_piece.empty());
m_have_piece.set_all();
m_num_pieces = m_have_piece.size();
t->peer_has_all(this);
#if TORRENT_USE_INVARIANT_CHECKS
@ -3192,12 +3204,14 @@ namespace libtorrent
#ifndef TORRENT_DISABLE_LOGGING
m_bitfield_time = clock_type::now();
t->debug_log("HANDSHAKE [%p] (%d ms)", this, int(total_milliseconds(m_bitfield_time - m_connect_time)));
t->debug_log("HANDSHAKE [%p] (%d ms)"
, static_cast<void*>(this)
, int(total_milliseconds(m_bitfield_time - m_connect_time)));
#endif
m_have_piece.clear_all();
m_num_pieces = 0;
// if the peer is ready to download stuff, it must have metadata
// if the peer is ready to download stuff, it must have metadata
m_has_metadata = true;
// we're never interested in a peer that doesn't have anything
@ -3222,7 +3236,9 @@ namespace libtorrent
#ifndef TORRENT_DISABLE_LOGGING
{
time_point now = clock_type::now();
t->debug_log("ALLOW FAST [%p] (%d ms)", this, int(total_milliseconds(now - m_connect_time)));
t->debug_log("ALLOW FAST [%p] (%d ms)"
, static_cast<void*>(this)
, int(total_milliseconds(now - m_connect_time)));
if (m_peer_choked) m_unchoke_time = now;
}
peer_log(peer_log_alert::incoming_message, "ALLOWED_FAST", "%d", index);
@ -3901,7 +3917,7 @@ namespace libtorrent
// request timeout.
m_requested = aux::time_now();
#ifndef TORRENT_DISABLE_LOGGING
t->debug_log("REQUEST [%p] (%d ms)", this
t->debug_log("REQUEST [%p] (%d ms)", static_cast<void*>(this)
, int(total_milliseconds(clock_type::now() - m_unchoke_time)));
#endif
}
@ -5211,7 +5227,8 @@ namespace libtorrent
#ifndef TORRENT_DISABLE_LOGGING
peer_log(peer_log_alert::info, "FILE_ASYNC_READ_COMPLETE"
, "ret: %d piece: %d s: %x l: %x b: %p c: %s e: %s rtt: %d us"
, j->ret, r.piece, r.start, r.length, j->buffer.disk_block
, j->ret, r.piece, r.start, r.length
, static_cast<void*>(j->buffer.disk_block)
, (j->flags & disk_io_job::cache_hit ? "cache hit" : "cache miss")
, j->error.ec.message().c_str(), disk_rtt);
#endif
@ -5229,7 +5246,7 @@ namespace libtorrent
disconnect(j->error.ec, op_file_read);
return;
}
TORRENT_ASSERT(j->buffer.disk_block == 0);
write_dont_have(r.piece);
write_reject_request(r);
@ -6225,7 +6242,7 @@ namespace libtorrent
#ifndef TORRENT_DISABLE_LOGGING
{
boost::shared_ptr<torrent> t = m_torrent.lock();
if (t) t->debug_log("END connect [%p]", this);
if (t) t->debug_log("END connect [%p]", static_cast<void*>(this));
m_connect_time = completed;
}
#endif
@ -6249,7 +6266,7 @@ namespace libtorrent
}
if (m_disconnecting) return;
if (e)
{
connect_failed(e);

View File

@ -3270,9 +3270,6 @@ get_out:
// if we already have this piece, just ignore this
if (have_piece(block.piece_index)) return false;
#ifdef TORRENT_EXPENSIVE_INVARIANT_CHECKS
TORRENT_PIECE_PICKER_INVARIANT_CHECK;
#endif
int prio = p.priority(this);
TORRENT_ASSERT(prio < int(m_priority_boundries.size())
|| m_dirty);

View File

@ -78,6 +78,7 @@ struct feed_state
case rss2: return string_equal_no_case(tag, "item");
case none: return false;
}
return false;
}
bool is_title(char const* tag) const
@ -88,6 +89,7 @@ struct feed_state
case rss2: return string_equal_no_case(tag, "title");
case none: return false;
}
return false;
}
bool is_url(char const* tag) const
@ -98,6 +100,7 @@ struct feed_state
case rss2: return string_equal_no_case(tag, "link");
case none: return false;
}
return false;
}
bool is_desc(char const* tag) const
@ -109,6 +112,7 @@ struct feed_state
|| string_equal_no_case(tag, "media:text");
case none: return false;
}
return false;
}
bool is_uuid(char const* tag) const
@ -119,6 +123,7 @@ struct feed_state
case rss2: return string_equal_no_case(tag, "guid");
case none: return false;
}
return false;
}
bool is_comment(char const* tag) const
@ -129,6 +134,7 @@ struct feed_state
case rss2: return string_equal_no_case(tag, "comments");
case none: return false;
}
return false;
}
bool is_category(char const* tag) const
@ -139,6 +145,7 @@ struct feed_state
case rss2: return string_equal_no_case(tag, "category");
case none: return false;
}
return false;
}
bool is_size(char const* tag) const

View File

@ -30,6 +30,10 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#include "libtorrent/config.hpp"
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <ctime>
#include <algorithm>
#include <set>
@ -37,17 +41,15 @@ POSSIBILITY OF SUCH DAMAGE.
#include <cctype>
#include <algorithm>
#ifdef _MSC_VER
#pragma warning(push, 1)
#endif
#include <boost/limits.hpp>
#include <boost/bind.hpp>
#ifdef _MSC_VER
#pragma warning(pop)
#ifdef TORRENT_PROFILE_CALLS
#include <boost/unordered_map.hpp>
#endif
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#include "libtorrent/extensions/ut_pex.hpp"
#include "libtorrent/extensions/ut_metadata.hpp"
#include "libtorrent/extensions/smart_ban.hpp"
@ -75,10 +77,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/magnet_uri.hpp"
#include "libtorrent/lazy_entry.hpp"
#ifdef TORRENT_PROFILE_CALLS
#include <boost/unordered_map.hpp>
#endif
using boost::shared_ptr;
using boost::weak_ptr;
using libtorrent::aux::session_impl;

View File

@ -838,6 +838,9 @@ namespace libtorrent
return TORRENT_SYNC_CALL_RET(int, max_connections);
}
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
std::auto_ptr<alert> session_handle::pop_alert()
{
alert const* a = m_impl->pop_alert();
@ -845,6 +848,8 @@ namespace libtorrent
return a->clone();
}
#pragma GCC diagnostic pop
void session_handle::pop_alerts(std::deque<alert*>* alerts)
{
m_impl->pop_alerts(alerts);
@ -906,11 +911,16 @@ namespace libtorrent
return get_settings().get_int(settings_pack::alert_mask);
}
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
void session_handle::set_alert_dispatch(boost::function<void(std::auto_ptr<alert>)> const& fun)
{
m_impl->alerts().set_dispatch_function(fun);
}
#pragma GCC diagnostic pop
void session_handle::start_lsd()
{
settings_pack p;

View File

@ -2013,7 +2013,7 @@ namespace libtorrent
if (num_pad_files > 0)
m_picker->set_num_pad_files(num_pad_files);
std::auto_ptr<std::vector<std::string> > links;
std::vector<std::string> links;
#ifndef TORRENT_DISABLE_MUTABLE_TORRENTS
if (!m_torrent_file->similar_torrents().empty()
|| !m_torrent_file->collections().empty())
@ -2055,7 +2055,6 @@ namespace libtorrent
std::vector<resolve_links::link_t> const& l = res.get_links();
if (!l.empty())
{
links.reset(new std::vector<std::string>(l.size()));
for (std::vector<resolve_links::link_t>::const_iterator i = l.begin()
, end(l.end()); i != end; ++i)
{
@ -2063,7 +2062,7 @@ namespace libtorrent
torrent_info const& ti = *i->ti;
std::string const& save_path = i->save_path;
links->push_back(combine_path(save_path
links.push_back(combine_path(save_path
, ti.files().file_path(i->file_idx)));
}
}
@ -2071,7 +2070,7 @@ namespace libtorrent
#endif // TORRENT_DISABLE_MUTABLE_TORRENTS
inc_refcount("check_fastresume");
// async_check_fastresume will release links
// async_check_fastresume will gut links
m_ses.disk_thread().async_check_fastresume(
m_storage.get(), m_resume_data ? &m_resume_data->node : NULL
, links, boost::bind(&torrent::on_resume_data_checked
@ -2601,7 +2600,7 @@ namespace libtorrent
m_resume_data.reset();
std::auto_ptr<std::vector<std::string> > links;
std::vector<std::string> links;
inc_refcount("force_recheck");
m_ses.disk_thread().async_check_fastresume(m_storage.get(), NULL
, links, boost::bind(&torrent::on_force_recheck
@ -6483,7 +6482,8 @@ namespace libtorrent
if (c->is_disconnecting()) return;
#ifndef TORRENT_DISABLE_LOGGING
debug_log("START queue peer [%p] (%d)", c.get(), num_peers());
debug_log("START queue peer [%p] (%d)", static_cast<void*>(c.get())
, num_peers());
#endif
}
TORRENT_CATCH (std::exception& e)

View File

@ -30,11 +30,17 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#include "libtorrent/config.hpp"
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <vector>
#include <limits>
#include <boost/bind.hpp>
#include <stdlib.h>
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#include "libtorrent/web_connection_base.hpp"
#include "libtorrent/session.hpp"
#include "libtorrent/identify_client.hpp"

View File

@ -30,11 +30,17 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#include "libtorrent/config.hpp"
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <vector>
#include <boost/limits.hpp>
#include <boost/bind.hpp>
#include <stdlib.h>
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#include "libtorrent/web_peer_connection.hpp"
#include "libtorrent/session.hpp"
#include "libtorrent/identify_client.hpp"

View File

@ -732,7 +732,7 @@ TORRENT_TEST(parse_length_overflow)
"d1:a9205357638345293824:11111",
};
for (int i = 0; i < sizeof(b)/sizeof(b[0]); ++i)
for (int i = 0; i < int(sizeof(b)/sizeof(b[0])); ++i)
{
error_code ec;
bdecode_node e;

View File

@ -599,7 +599,7 @@ TORRENT_TEST(bencoding)
"d1:a9205357638345293824:11111",
};
for (int i = 0; i < sizeof(b)/sizeof(b[0]); ++i)
for (int i = 0; i < int(sizeof(b)/sizeof(b[0])); ++i)
{
lazy_entry e;
error_code ec;

View File

@ -142,7 +142,7 @@ static void nop() {}
rj.d.io.ref.storage = 0
#define FLUSH(flushing) \
for (int i = 0; i < sizeof(flushing)/sizeof(flushing[0]); ++i) \
for (int i = 0; i < int(sizeof(flushing)/sizeof(flushing[0])); ++i) \
{ \
pe->blocks[flushing[i]].pending = true; \
bc.inc_block_refcount(pe, 0, block_cache::ref_flushing); \

View File

@ -774,7 +774,7 @@ TORRENT_TEST(dht)
{ generate_next(), 8 }
};
for (int i = 0; i < sizeof(items)/sizeof(items[0]); ++i)
for (int i = 0; i < int(sizeof(items)/sizeof(items[0])); ++i)
items[i].gen();
announce_immutable_items(node, eps, items, sizeof(items)/sizeof(items[0]));
@ -1729,7 +1729,7 @@ TORRENT_TEST(dht)
TEST_EQUAL(g_got_items.front().value(), items[0].ent);
TEST_CHECK(memcmp(g_got_items.front().pk().data(), public_key, item_pk_len) == 0);
TEST_CHECK(memcmp(g_got_items.front().sig().data(), signature, item_sig_len) == 0);
TEST_EQUAL(g_got_items.front().seq(), seq);
TEST_EQUAL(int(g_got_items.front().seq()), seq);
g_got_items.clear();
} while (false);

View File

@ -70,7 +70,7 @@ TORRENT_TEST(init)
for (int i = 0; i < int(vec.size()); ++i)
sum += vec[i];
TEST_EQUAL(sum, fs.piece_size(idx));
TEST_EQUAL(int(sum), fs.piece_size(idx));
}
}
@ -99,7 +99,7 @@ TORRENT_TEST(init2)
fp.export_progress(vec);
boost::uint64_t sum = 0;
for (int i = 0; i < vec.size(); ++i)
for (int i = 0; i < int(vec.size()); ++i)
sum += vec[i];
TEST_EQUAL(int(sum), fs.piece_size(idx));

View File

@ -161,7 +161,7 @@ TORRENT_TEST(push_back)
std::vector<A*> ptrs;
q.get_pointers(ptrs);
TEST_EQUAL(ptrs.size(), q.size());
TEST_EQUAL(int(ptrs.size()), q.size());
TEST_EQUAL(ptrs[0]->type(), 1);
TEST_EQUAL(ptrs[1]->type(), 1);
TEST_EQUAL(ptrs[2]->type(), 1);
@ -207,14 +207,14 @@ TORRENT_TEST(swap)
std::vector<A*> ptrs;
q1.get_pointers(ptrs);
TEST_EQUAL(ptrs.size(), q1.size());
TEST_EQUAL(int(ptrs.size()), q1.size());
TEST_EQUAL(ptrs[0]->type(), 1);
TEST_EQUAL(ptrs[1]->type(), 1);
TEST_EQUAL(ptrs[2]->type(), 1);
q2.get_pointers(ptrs);
TEST_EQUAL(ptrs.size(), q2.size());
TEST_EQUAL(int(ptrs.size()), q2.size());
TEST_EQUAL(ptrs[0]->type(), 2);
TEST_EQUAL(ptrs[1]->type(), 2);
@ -223,14 +223,14 @@ TORRENT_TEST(swap)
q1.get_pointers(ptrs);
TEST_EQUAL(q1.size(), 2);
TEST_EQUAL(ptrs.size(), q1.size());
TEST_EQUAL(int(ptrs.size()), q1.size());
TEST_EQUAL(ptrs[0]->type(), 2);
TEST_EQUAL(ptrs[1]->type(), 2);
q2.get_pointers(ptrs);
TEST_EQUAL(q2.size(), 3);
TEST_EQUAL(ptrs.size(), q2.size());
TEST_EQUAL(int(ptrs.size()), q2.size());
TEST_EQUAL(ptrs[0]->type(), 1);
TEST_EQUAL(ptrs[1]->type(), 1);
@ -274,9 +274,9 @@ TORRENT_TEST(copy_move)
std::vector<F*> ptrs;
q.get_pointers(ptrs);
TEST_EQUAL(ptrs.size(), 1000);
TEST_EQUAL(int(ptrs.size()), 1000);
for (int i = 0; i < ptrs.size(); ++i)
for (int i = 0; i < int(ptrs.size()); ++i)
{
ptrs[i]->check_invariant();
TEST_EQUAL(ptrs[i]->f, i);

View File

@ -68,7 +68,7 @@ tuple<int, int, bool> feed_bytes(http_parser& parser, char const* str)
TEST_CHECK(prev == make_tuple(0, 0, false) || ret == prev || ret.get<2>());
if (!ret.get<2>())
{
TEST_EQUAL(ret.get<0>() + ret.get<1>(), strlen(str));
TEST_EQUAL(ret.get<0>() + ret.get<1>(), int(strlen(str)));
}
prev = ret;
@ -227,7 +227,7 @@ TORRENT_TEST(http_parser)
received = feed_bytes(parser, chunked_test);
printf("payload: %d protocol: %d\n", received.get<0>(), received.get<1>());
TEST_CHECK(received == make_tuple(20, strlen(chunked_test) - 20, false));
TEST_CHECK(received == make_tuple(20, int(strlen(chunked_test)) - 20, false));
TEST_CHECK(parser.finished());
TEST_CHECK(std::equal(parser.get_body().begin, parser.get_body().end
, "4\r\ntest\r\n10\r\n0123456789abcdef"));

View File

@ -83,8 +83,8 @@ void test_rules_invariant(std::vector<ip_range<T> > const& r, ip_filter const& f
for (iterator i(r.begin()), j(boost::next(r.begin()))
, end(r.end()); j != end; ++j, ++i)
{
TEST_CHECK(f.access(i->last) == i->flags);
TEST_CHECK(f.access(j->first) == j->flags);
TEST_EQUAL(f.access(i->last), int(i->flags));
TEST_EQUAL(f.access(j->first), int(j->flags));
TEST_CHECK(detail::plus_one(i->last.to_bytes()) == j->first.to_bytes());
}
}
@ -261,7 +261,7 @@ TORRENT_TEST(ip_filter)
range = boost::get<1>(f.export_filter());
test_rules_invariant(range, f);
TEST_CHECK(range.size() == 3);
TEST_EQUAL(range.size(), 3);
TEST_CHECK(std::equal(range.begin(), range.end(), expected2, &compare<address_v6>));
}

View File

@ -36,6 +36,8 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/performance_counters.hpp"
#include "libtorrent/random.hpp"
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <boost/shared_ptr.hpp>
#include <boost/bind.hpp>
#include <algorithm>
@ -44,6 +46,8 @@ POSSIBILITY OF SUCH DAMAGE.
#include <map>
#include <iostream>
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#include "test.hpp"
using namespace libtorrent;
@ -97,7 +101,7 @@ boost::shared_ptr<piece_picker> setup_picker(
{
const int avail = availability[i] - '0';
assert(avail >= 0);
static const torrent_peer* peers[10] = { &tmp0, &tmp1, &tmp2
, &tmp3, &tmp4, &tmp5, &tmp6, &tmp7, &tmp8, &tmp9 };
TORRENT_ASSERT(avail < 10);
@ -141,12 +145,12 @@ boost::shared_ptr<piece_picker> setup_picker(
piece_picker::downloading_piece st;
p->piece_info(i, st);
TEST_CHECK(st.writing == 0);
TEST_CHECK(st.requested == 0);
TEST_CHECK(st.index == i);
TEST_EQUAL(int(st.writing), 0);
TEST_EQUAL(int(st.requested), 0);
TEST_EQUAL(int(st.index), i);
TEST_CHECK(st.finished == counter);
TEST_CHECK(st.finished + st.requested + st.writing == counter);
TEST_EQUAL(st.finished, counter);
TEST_EQUAL(st.finished + st.requested + st.writing, counter);
TEST_CHECK(p->is_piece_finished(i) == (counter == 4));
}
@ -1774,11 +1778,14 @@ TORRENT_TEST(piece_picker)
TEST_EQUAL(downloads.size(), 3);
TEST_CHECK(std::find_if(downloads.begin(), downloads.end()
, boost::bind(&piece_picker::downloading_piece::index, _1) == 1) != downloads.end());
, boost::bind(&piece_picker::downloading_piece::index, _1)
== boost::uint32_t(1)) != downloads.end());
TEST_CHECK(std::find_if(downloads.begin(), downloads.end()
, boost::bind(&piece_picker::downloading_piece::index, _1) == 2) != downloads.end());
, boost::bind(&piece_picker::downloading_piece::index, _1)
== boost::uint32_t(2)) != downloads.end());
TEST_CHECK(std::find_if(downloads.begin(), downloads.end()
, boost::bind(&piece_picker::downloading_piece::index, _1) == 3) != downloads.end());
, boost::bind(&piece_picker::downloading_piece::index, _1)
== boost::uint32_t(3)) != downloads.end());
// ========================================================

View File

@ -90,7 +90,7 @@ TORRENT_TEST(resolve_links)
std::string path = combine_path(parent_path(current_working_directory())
, "mutable_test_torrents");
for (int i = 0; i < sizeof(test_torrents)/sizeof(test_torrents[0]); ++i)
for (int i = 0; i < int(sizeof(test_torrents)/sizeof(test_torrents[0])); ++i)
{
test_torrent_t const& e = test_torrents[i];
@ -115,7 +115,7 @@ TORRENT_TEST(resolve_links)
if (num_matches > e.expected_matches)
{
file_storage const& fs = ti1->files();
for (int i = 0; i < links.size(); ++i)
for (int i = 0; i < int(links.size()); ++i)
{
TORRENT_ASSERT(i < fs.num_files());
fprintf(stderr, "%s --> %s : %d\n", fs.file_name(i).c_str()

View File

@ -209,7 +209,7 @@ TORRENT_TEST(piece_priorities)
{
fprintf(stderr, "%s\n", ra->resume_data->to_string().c_str());
entry::string_type prios = (*ra->resume_data)["piece_priority"].string();
TEST_EQUAL(prios.size(), ti->num_pieces());
TEST_EQUAL(int(prios.size()), ti->num_pieces());
TEST_EQUAL(prios[0], '\0');
TEST_EQUAL(prios[1], '\x04');
TEST_EQUAL(prios[ti->num_pieces()-1], '\0');

View File

@ -463,7 +463,7 @@ void test_check_files(std::string const& test_path
bool done = false;
bdecode_node frd;
std::auto_ptr<std::vector<std::string> > links;
std::vector<std::string> links;
io.async_check_fastresume(pm.get(), &frd, links
, boost::bind(&on_check_resume_data, _1, &done));
io.submit_jobs();

View File

@ -30,9 +30,14 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <boost/bind.hpp>
#include <boost/atomic.hpp>
#include <list>
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#include "libtorrent/thread.hpp"
#include "test.hpp"
#include "setup_transfer.hpp" // for test_sleep

View File

@ -112,7 +112,7 @@ void test_running_torrent(boost::shared_ptr<torrent_info> info, boost::int64_t f
TEST_EQUAL(st.total_wanted_done, 0);
if (!st.is_seeding)
{
TEST_EQUAL(h.file_priorities().size(), info->num_files());
TEST_EQUAL(int(h.file_priorities().size()), info->num_files());
TEST_EQUAL(h.file_priorities()[0], 0);
if (info->num_files() > 1)
TEST_EQUAL(h.file_priorities()[1], 0);