fix some warnings
This commit is contained in:
parent
990aabe36f
commit
655a3ae019
|
@ -97,7 +97,9 @@ namespace libtorrent
|
|||
struct TORRENT_EXPORT invalid_encoding: std::exception
|
||||
{
|
||||
// hidden
|
||||
virtual const char* what() const throw() { return "invalid bencoding"; }
|
||||
virtual const char* what() const TORRENT_EXCEPTION_THROW_SPECIFIER
|
||||
TORRENT_OVERRIDE TORRENT_FINAL
|
||||
{ return "invalid bencoding"; }
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -338,7 +340,7 @@ namespace libtorrent
|
|||
// ----------------------------------------------
|
||||
// string
|
||||
default:
|
||||
if (is_digit((unsigned char)*in))
|
||||
if (is_digit(boost::uint8_t(*in)))
|
||||
{
|
||||
std::string len_s = read_until(in, end, ':', err);
|
||||
if (err)
|
||||
|
|
|
@ -172,6 +172,10 @@ namespace libtorrent
|
|||
{
|
||||
cached_piece_entry();
|
||||
~cached_piece_entry();
|
||||
#if __cplusplus >= 201103L
|
||||
cached_piece_entry(cached_piece_entry const& st) = default;
|
||||
cached_piece_entry& operator=(cached_piece_entry const& st) = default;
|
||||
#endif
|
||||
|
||||
bool ok_to_evict(bool ignore_hash = false) const
|
||||
{
|
||||
|
|
|
@ -59,7 +59,7 @@ namespace libtorrent
|
|||
{ set_bits(&k[0], bits, N); }
|
||||
|
||||
std::string to_string() const
|
||||
{ return std::string((char const*)&bits[0], N); }
|
||||
{ return std::string(reinterpret_cast<char const*>(&bits[0]), N); }
|
||||
|
||||
void from_string(char const* str)
|
||||
{ memcpy(bits, str, N); }
|
||||
|
|
|
@ -407,8 +407,7 @@ int snprintf(char* buf, int len, char const* fmt, ...)
|
|||
#endif
|
||||
|
||||
// at the highest warning level, clang actually warns about functions
|
||||
// that could be marked noreturn. There seems to be versions of GCC
|
||||
// that declare being
|
||||
// that could be marked noreturn.
|
||||
#if defined __clang__ || defined __GNUC__
|
||||
#define TORRENT_NO_RETURN __attribute((noreturn))
|
||||
#else
|
||||
|
|
|
@ -128,7 +128,7 @@ public:
|
|||
// not pinged. If the bucket the node falls into is full,
|
||||
// the node will be ignored.
|
||||
void heard_about(node_id const& id, udp::endpoint const& ep);
|
||||
|
||||
|
||||
node_entry const* next_refresh();
|
||||
|
||||
enum
|
||||
|
@ -143,7 +143,7 @@ public:
|
|||
, int options, int count = 0);
|
||||
void remove_node(node_entry* n
|
||||
, table_t::iterator bucket) ;
|
||||
|
||||
|
||||
int bucket_size(int bucket) const
|
||||
{
|
||||
int num_buckets = m_buckets.size();
|
||||
|
@ -151,7 +151,7 @@ public:
|
|||
if (bucket < num_buckets) bucket = num_buckets - 1;
|
||||
table_t::const_iterator i = m_buckets.begin();
|
||||
std::advance(i, bucket);
|
||||
return (int)i->live_nodes.size();
|
||||
return int(i->live_nodes.size());
|
||||
}
|
||||
|
||||
void for_each_node(void (*)(void*, node_entry const&)
|
||||
|
|
|
@ -151,7 +151,7 @@ namespace libtorrent
|
|||
// tells you which specific type this lazy entry has.
|
||||
// See entry_type_t. The type determines which subset of
|
||||
// member functions are valid to use.
|
||||
entry_type_t type() const { return (entry_type_t)m_type; }
|
||||
entry_type_t type() const { return entry_type_t(m_type); }
|
||||
|
||||
// start points to the first decimal digit
|
||||
// length is the number of digits
|
||||
|
|
|
@ -108,8 +108,8 @@ namespace libtorrent
|
|||
private:
|
||||
struct barrier
|
||||
{
|
||||
barrier(boost::shared_ptr<crypto_plugin> plugin, int next)
|
||||
: enc_handler(plugin), next(next) {}
|
||||
barrier(boost::shared_ptr<crypto_plugin> plugin, int n)
|
||||
: enc_handler(plugin), next(n) {}
|
||||
boost::shared_ptr<crypto_plugin> enc_handler;
|
||||
// number of bytes to next barrier
|
||||
int next;
|
||||
|
|
|
@ -90,10 +90,10 @@ namespace libtorrent
|
|||
{
|
||||
friend struct peer_class_pool;
|
||||
|
||||
peer_class(std::string const& label)
|
||||
peer_class(std::string const& l)
|
||||
: ignore_unchoke_slots(false)
|
||||
, connection_limit_factor(100)
|
||||
, label(label)
|
||||
, label(l)
|
||||
, references(1)
|
||||
{
|
||||
priority[0] = 1;
|
||||
|
|
|
@ -33,11 +33,16 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#ifndef TORRENT_RESOLVER_INTERFACE_HPP_INCLUDE
|
||||
#define TORRENT_RESOLVER_INTERFACE_HPP_INCLUDE
|
||||
|
||||
#include <boost/function.hpp>
|
||||
#include <vector>
|
||||
#include "libtorrent/error_code.hpp"
|
||||
#include "libtorrent/address.hpp"
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||
|
||||
#include <boost/function.hpp>
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
||||
|
||||
namespace libtorrent
|
||||
{
|
||||
|
||||
|
|
|
@ -51,6 +51,10 @@ namespace libtorrent
|
|||
struct TORRENT_EXPORT feed_item
|
||||
{
|
||||
feed_item();
|
||||
#if __cplusplus >= 201103L
|
||||
feed_item(feed_item const& st) = default;
|
||||
feed_item & operator=(feed_item const& st) = default;
|
||||
#endif
|
||||
~feed_item();
|
||||
|
||||
// these are self explanatory and may be empty if the feed does not specify
|
||||
|
|
|
@ -125,6 +125,10 @@ namespace libtorrent
|
|||
// implementation object.
|
||||
session_proxy() {}
|
||||
~session_proxy();
|
||||
#if __cplusplus >= 201103L
|
||||
session_proxy(session_proxy const& st) = default;
|
||||
session_proxy& operator=(session_proxy const& st) = default;
|
||||
#endif
|
||||
private:
|
||||
session_proxy(
|
||||
boost::shared_ptr<io_service> ios
|
||||
|
|
|
@ -118,6 +118,9 @@ namespace libtorrent
|
|||
}
|
||||
void assign(char const* str) { std::memcpy(m_number, str, size); }
|
||||
|
||||
char const* data() const { return reinterpret_cast<char const*>(&m_number[0]); }
|
||||
char* data() { return reinterpret_cast<char*>(&m_number[0]); }
|
||||
|
||||
// set the sha1-hash to all zeroes.
|
||||
void clear() { std::memset(m_number, 0, size); }
|
||||
|
||||
|
|
|
@ -282,13 +282,13 @@ namespace libtorrent
|
|||
template <class S> S* get()
|
||||
{
|
||||
if (m_type != socket_type_int_impl<S>::value) return 0;
|
||||
return (S*)m_data;
|
||||
return reinterpret_cast<S*>(m_data);
|
||||
}
|
||||
|
||||
template <class S> S const* get() const
|
||||
template <class S> S const* get() const
|
||||
{
|
||||
if (m_type != socket_type_int_impl<S>::value) return 0;
|
||||
return (S const*)m_data;
|
||||
return reinterpret_cast<S const*>(m_data);
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
@ -604,7 +604,7 @@ namespace libtorrent
|
|||
// if there is a fence up, returns true and adds the job
|
||||
// to the queue of blocked jobs
|
||||
bool is_blocked(disk_io_job* j);
|
||||
|
||||
|
||||
// the number of blocked jobs
|
||||
int num_blocked() const;
|
||||
|
||||
|
@ -638,7 +638,7 @@ namespace libtorrent
|
|||
{
|
||||
void add_piece(cached_piece_entry* p);
|
||||
void remove_piece(cached_piece_entry* p);
|
||||
bool has_piece(cached_piece_entry* p) const;
|
||||
bool has_piece(cached_piece_entry const* p) const;
|
||||
int num_pieces() const { return m_cached_pieces.size(); }
|
||||
boost::unordered_set<cached_piece_entry*> const& cached_pieces() const
|
||||
{ return m_cached_pieces; }
|
||||
|
|
|
@ -310,7 +310,7 @@ namespace libtorrent
|
|||
|
||||
#if TORRENT_USE_ASSERTS
|
||||
bool has_peer(peer_connection const* p) const
|
||||
{ return sorted_find(m_connections, (peer_connection*)p) != m_connections.end(); }
|
||||
{ return sorted_find(m_connections, p) != m_connections.end(); }
|
||||
bool is_single_thread() const { return single_threaded::is_single_thread(); }
|
||||
#endif
|
||||
|
||||
|
@ -393,7 +393,9 @@ namespace libtorrent
|
|||
void on_disk_read_complete(disk_io_job const* j, peer_request r
|
||||
, boost::shared_ptr<read_piece_struct> rp);
|
||||
|
||||
storage_mode_t storage_mode() const { return (storage_mode_t)m_storage_mode; }
|
||||
storage_mode_t storage_mode() const
|
||||
{ return storage_mode_t(m_storage_mode); }
|
||||
|
||||
storage_interface* get_storage()
|
||||
{
|
||||
if (!m_storage) return 0;
|
||||
|
@ -410,7 +412,7 @@ namespace libtorrent
|
|||
void new_external_ip();
|
||||
|
||||
torrent_status::state_t state() const
|
||||
{ return (torrent_status::state_t)m_state; }
|
||||
{ return torrent_status::state_t(m_state); }
|
||||
void set_state(torrent_status::state_t s);
|
||||
|
||||
aux::session_settings const& settings() const;
|
||||
|
@ -589,7 +591,7 @@ namespace libtorrent
|
|||
void set_download_limit(int limit);
|
||||
int download_limit() const;
|
||||
|
||||
peer_class_t peer_class() const { return (peer_class_t)m_peer_class; }
|
||||
peer_class_t peer_class() const { return peer_class_t(m_peer_class); }
|
||||
|
||||
void set_max_uploads(int limit, bool state_update = true);
|
||||
int max_uploads() const { return m_max_uploads; }
|
||||
|
@ -598,13 +600,13 @@ namespace libtorrent
|
|||
|
||||
// --------------------------------------------
|
||||
// PEER MANAGEMENT
|
||||
|
||||
|
||||
// add or remove a url that will be attempted for
|
||||
// finding the file(s) in this torrent.
|
||||
void add_web_seed(std::string const& url, web_seed_t::type_t type);
|
||||
void add_web_seed(std::string const& url, web_seed_t::type_t type
|
||||
, std::string const& auth, web_seed_t::headers_t const& extra_headers);
|
||||
|
||||
|
||||
void remove_web_seed(std::string const& url, web_seed_t::type_t type);
|
||||
void disconnect_web_seed(peer_connection* p);
|
||||
|
||||
|
@ -660,7 +662,7 @@ namespace libtorrent
|
|||
std::pair<peer_list::iterator, peer_list::iterator> find_peers(address const& a);
|
||||
|
||||
// the number of peers that belong to this torrent
|
||||
int num_peers() const { return (int)m_connections.size(); }
|
||||
int num_peers() const { return int(m_connections.size()); }
|
||||
int num_seeds() const;
|
||||
int num_downloaders() const;
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ namespace libtorrent
|
|||
// for compatibility with 0.14
|
||||
typedef libtorrent_exception duplicate_torrent;
|
||||
typedef libtorrent_exception invalid_handle;
|
||||
void throw_invalid_handle();
|
||||
void throw_invalid_handle() TORRENT_NO_RETURN;
|
||||
#endif
|
||||
|
||||
// holds the state of a block in a piece. Who we requested
|
||||
|
@ -252,6 +252,10 @@ namespace libtorrent
|
|||
torrent_handle(torrent_handle const& t)
|
||||
{ if (!t.m_torrent.expired()) m_torrent = t.m_torrent; }
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
torrent_handle& operator=(torrent_handle const& st) = default;
|
||||
#endif
|
||||
|
||||
// flags for add_piece().
|
||||
enum flags_t { overwrite_existing = 1 };
|
||||
|
||||
|
|
|
@ -574,7 +574,7 @@ namespace libtorrent
|
|||
if (is_merkle_torrent())
|
||||
{
|
||||
TORRENT_ASSERT(index < int(m_merkle_tree.size() - m_merkle_first_leaf));
|
||||
return (const char*)&m_merkle_tree[m_merkle_first_leaf + index][0];
|
||||
return m_merkle_tree[m_merkle_first_leaf + index].data();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -50,10 +50,11 @@ namespace libtorrent {
|
|||
}
|
||||
|
||||
template <class T>
|
||||
typename std::vector<T>::const_iterator sorted_find(std::vector<T> const& container
|
||||
, T v)
|
||||
typename std::vector<T*>::const_iterator sorted_find(std::vector<T*> const& container
|
||||
, T const* v)
|
||||
{
|
||||
return sorted_find(const_cast<std::vector<T>&>(container), v);
|
||||
return sorted_find(const_cast<std::vector<T*>&>(container)
|
||||
, const_cast<T*>(v));
|
||||
}
|
||||
|
||||
template<class T>
|
||||
|
|
|
@ -68,7 +68,7 @@ namespace libtorrent {
|
|||
else if (h.is_valid())
|
||||
{
|
||||
char msg[41];
|
||||
to_hex((char const*)&h.native_handle()->info_hash()[0], 20, msg);
|
||||
to_hex(h.native_handle()->info_hash().data(), 20, msg);
|
||||
m_name_idx = alloc.copy_string(msg);
|
||||
}
|
||||
else
|
||||
|
@ -485,12 +485,12 @@ namespace libtorrent {
|
|||
invalid_request_alert::invalid_request_alert(aux::stack_allocator& alloc
|
||||
, torrent_handle const& h, tcp::endpoint const& ep
|
||||
, peer_id const& peer_id, peer_request const& r
|
||||
, bool we_have, bool peer_interested, bool withheld)
|
||||
, bool _have, bool _peer_interested, bool _withheld)
|
||||
: peer_alert(alloc, h, ep, peer_id)
|
||||
, request(r)
|
||||
, we_have(we_have)
|
||||
, peer_interested(peer_interested)
|
||||
, withheld(withheld)
|
||||
, we_have(_have)
|
||||
, peer_interested(_peer_interested)
|
||||
, withheld(_withheld)
|
||||
{}
|
||||
|
||||
std::string invalid_request_alert::message() const
|
||||
|
@ -650,12 +650,12 @@ namespace libtorrent {
|
|||
aux::stack_allocator& alloc
|
||||
, torrent_handle const& h
|
||||
, error_code const& e
|
||||
, std::string const& file
|
||||
, std::string const& f
|
||||
, char const* op)
|
||||
: torrent_alert(alloc, h)
|
||||
, error(e)
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
, file(file)
|
||||
, file(f)
|
||||
#endif
|
||||
, operation(op)
|
||||
, m_file_idx(alloc.copy_string(file))
|
||||
|
@ -937,12 +937,12 @@ namespace libtorrent {
|
|||
aux::stack_allocator& alloc
|
||||
, torrent_handle const& h
|
||||
, error_code const& ec
|
||||
, std::string const& file
|
||||
, std::string const& f
|
||||
, char const* op)
|
||||
: torrent_alert(alloc, h)
|
||||
, error(ec)
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
, file(file)
|
||||
, file(f)
|
||||
#endif
|
||||
, operation(op)
|
||||
, m_path_idx(alloc.copy_string(file))
|
||||
|
@ -1005,7 +1005,7 @@ namespace libtorrent {
|
|||
{
|
||||
error_code ec;
|
||||
char ih_hex[41];
|
||||
to_hex((const char*)&info_hash[0], 20, ih_hex);
|
||||
to_hex(info_hash.data(), 20, ih_hex);
|
||||
char msg[200];
|
||||
snprintf(msg, sizeof(msg), "incoming dht announce: %s:%u (%s)"
|
||||
, ip.to_string(ec).c_str(), port, ih_hex);
|
||||
|
@ -1020,7 +1020,7 @@ namespace libtorrent {
|
|||
std::string dht_get_peers_alert::message() const
|
||||
{
|
||||
char ih_hex[41];
|
||||
to_hex((const char*)&info_hash[0], 20, ih_hex);
|
||||
to_hex(info_hash.data(), 20, ih_hex);
|
||||
char msg[200];
|
||||
snprintf(msg, sizeof(msg), "incoming dht get_peers: %s", ih_hex);
|
||||
return msg;
|
||||
|
@ -1253,7 +1253,7 @@ namespace libtorrent {
|
|||
if (params.ti) torrent_name = params.ti->name().c_str();
|
||||
else if (!params.name.empty()) torrent_name = params.name.c_str();
|
||||
else if (!params.url.empty()) torrent_name = params.url.c_str();
|
||||
else to_hex((const char*)¶ms.info_hash[0], 20, info_hash);
|
||||
else to_hex(params.info_hash.data(), 20, info_hash);
|
||||
|
||||
if (error)
|
||||
{
|
||||
|
@ -1305,12 +1305,12 @@ namespace libtorrent {
|
|||
|
||||
std::string peer_error_alert::message() const
|
||||
{
|
||||
char msg[200];
|
||||
snprintf(msg, sizeof(msg), "%s peer error [%s] [%s]: %s"
|
||||
char buf[200];
|
||||
snprintf(buf, sizeof(buf), "%s peer error [%s] [%s]: %s"
|
||||
, peer_alert::message().c_str()
|
||||
, operation_name(operation), error.category().name()
|
||||
, convert_from_native(error.message()).c_str());
|
||||
return msg;
|
||||
return buf;
|
||||
}
|
||||
|
||||
char const* operation_name(int op)
|
||||
|
@ -1360,9 +1360,9 @@ namespace libtorrent {
|
|||
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
rss_item_alert::rss_item_alert(aux::stack_allocator&, feed_handle h
|
||||
, feed_item const& item)
|
||||
, feed_item const& i)
|
||||
: handle(h)
|
||||
, item(item)
|
||||
, item(i)
|
||||
{}
|
||||
|
||||
std::string rss_item_alert::message() const
|
||||
|
@ -1392,14 +1392,14 @@ namespace libtorrent {
|
|||
|
||||
std::string peer_disconnected_alert::message() const
|
||||
{
|
||||
char msg[600];
|
||||
snprintf(msg, sizeof(msg), "%s disconnecting (%s) [%s] [%s]: %s (reason: %d)"
|
||||
char buf[600];
|
||||
snprintf(buf, sizeof(buf), "%s disconnecting (%s) [%s] [%s]: %s (reason: %d)"
|
||||
, peer_alert::message().c_str()
|
||||
, socket_type_str[socket_type]
|
||||
, operation_name(operation), error.category().name()
|
||||
, convert_from_native(error.message()).c_str()
|
||||
, int(reason));
|
||||
return msg;
|
||||
return buf;
|
||||
}
|
||||
|
||||
dht_error_alert::dht_error_alert(aux::stack_allocator&, int op
|
||||
|
@ -1667,12 +1667,12 @@ namespace libtorrent {
|
|||
|
||||
file_error_alert::file_error_alert(aux::stack_allocator& alloc
|
||||
, error_code const& ec
|
||||
, std::string const& file
|
||||
, std::string const& f
|
||||
, char const* op
|
||||
, torrent_handle const& h)
|
||||
: torrent_alert(alloc, h)
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
, file(file)
|
||||
, file(f)
|
||||
#endif
|
||||
, error(ec)
|
||||
, operation(op)
|
||||
|
@ -1780,8 +1780,8 @@ namespace libtorrent {
|
|||
dht_get_peers_reply_alert::dht_get_peers_reply_alert(aux::stack_allocator& alloc
|
||||
, sha1_hash const& ih
|
||||
, std::vector<tcp::endpoint> const& peers)
|
||||
: m_alloc(alloc)
|
||||
, info_hash(ih)
|
||||
: info_hash(ih)
|
||||
, m_alloc(alloc)
|
||||
, m_num_peers(peers.size())
|
||||
{
|
||||
std::size_t total_size = m_num_peers; // num bytes for sizes
|
||||
|
@ -1796,7 +1796,7 @@ namespace libtorrent {
|
|||
tcp::endpoint endp = peers[i];
|
||||
std::size_t size = endp.size();
|
||||
|
||||
detail::write_uint8((boost::uint8_t)size, ptr);
|
||||
detail::write_uint8(size, ptr);
|
||||
memcpy(ptr, endp.data(), size);
|
||||
ptr += size;
|
||||
}
|
||||
|
@ -1805,7 +1805,7 @@ namespace libtorrent {
|
|||
std::string dht_get_peers_reply_alert::message() const
|
||||
{
|
||||
char ih_hex[41];
|
||||
to_hex((const char*)&info_hash[0], 20, ih_hex);
|
||||
to_hex(info_hash.data(), 20, ih_hex);
|
||||
char msg[200];
|
||||
snprintf(msg, sizeof(msg), "incoming dht get_peers reply: %s, peers %d", ih_hex, m_num_peers);
|
||||
return msg;
|
||||
|
|
|
@ -364,7 +364,8 @@ int block_cache::try_read(disk_io_job* j, bool expect_no_fail)
|
|||
// we're not allowed to add dirty blocks
|
||||
// for a deleted storage!
|
||||
TORRENT_ASSERT(std::find(m_deleted_storages.begin(), m_deleted_storages.end()
|
||||
, std::make_pair(j->storage->files()->name(), (void const*)j->storage->files()))
|
||||
, std::make_pair(j->storage->files()->name()
|
||||
, reinterpret_cast<void const*>(j->storage->files())))
|
||||
== m_deleted_storages.end());
|
||||
#endif
|
||||
|
||||
|
@ -641,8 +642,9 @@ cached_piece_entry* block_cache::allocate_piece(disk_io_job const* j, int cache_
|
|||
#if TORRENT_USE_ASSERTS
|
||||
void block_cache::mark_deleted(file_storage const& fs)
|
||||
{
|
||||
m_deleted_storages.push_back(std::make_pair(fs.name(), (void const*)&fs));
|
||||
if(m_deleted_storages.size() > 100)
|
||||
m_deleted_storages.push_back(std::make_pair(fs.name()
|
||||
, reinterpret_cast<void const*>(&fs)));
|
||||
if (m_deleted_storages.size() > 100)
|
||||
m_deleted_storages.erase(m_deleted_storages.begin());
|
||||
}
|
||||
#endif
|
||||
|
@ -1226,11 +1228,11 @@ void block_cache::insert_blocks(cached_piece_entry* pe, int block, file::iovec_t
|
|||
// either free the block or insert it. Never replace a block
|
||||
if (pe->blocks[block].buf)
|
||||
{
|
||||
free_buffer((char*)iov[i].iov_base);
|
||||
free_buffer(static_cast<char*>(iov[i].iov_base));
|
||||
}
|
||||
else
|
||||
{
|
||||
pe->blocks[block].buf = (char*)iov[i].iov_base;
|
||||
pe->blocks[block].buf = static_cast<char*>(iov[i].iov_base);
|
||||
|
||||
TORRENT_PIECE_ASSERT(iov[i].iov_base != NULL, pe);
|
||||
TORRENT_PIECE_ASSERT(pe->blocks[block].dirty == false, pe);
|
||||
|
@ -1245,7 +1247,7 @@ void block_cache::insert_blocks(cached_piece_entry* pe, int block, file::iovec_t
|
|||
}
|
||||
else
|
||||
{
|
||||
#if TORRENT_USE_PURGABLE_CONTROL && TORRENT_DISABLE_POOL_ALLOCATOR
|
||||
#if TORRENT_USE_PURGABLE_CONTROL && defined TORRENT_DISABLE_POOL_ALLOCATOR
|
||||
// volatile read blocks are group 0, regular reads are group 1
|
||||
int state = VM_PURGABLE_VOLATILE | ((j->flags & disk_io_job::volatile_read) ? VM_VOLATILE_GROUP_0 : VM_VOLATILE_GROUP_1);
|
||||
kern_return_t ret = vm_purgable_control(
|
||||
|
@ -1269,7 +1271,7 @@ void block_cache::insert_blocks(cached_piece_entry* pe, int block, file::iovec_t
|
|||
}
|
||||
}
|
||||
|
||||
#if TORRENT_USE_PURGABLE_CONTROL && TORRENT_DISABLE_POOL_ALLOCATOR
|
||||
#if TORRENT_USE_PURGABLE_CONTROL && defined TORRENT_DISABLE_POOL_ALLOCATOR
|
||||
TORRENT_ASSERT(pe->blocks[block].buf != NULL
|
||||
|| (flags & blocks_inc_refcount) == 0);
|
||||
#else
|
||||
|
@ -1291,7 +1293,7 @@ bool block_cache::inc_block_refcount(cached_piece_entry* pe, int block, int reas
|
|||
TORRENT_PIECE_ASSERT(pe->blocks[block].refcount < cached_block_entry::max_refcount, pe);
|
||||
if (pe->blocks[block].refcount == 0)
|
||||
{
|
||||
#if TORRENT_USE_PURGABLE_CONTROL && TORRENT_DISABLE_POOL_ALLOCATOR
|
||||
#if TORRENT_USE_PURGABLE_CONTROL && defined TORRENT_DISABLE_POOL_ALLOCATOR
|
||||
// we're adding the first refcount to this block, first make sure
|
||||
// its still here. It's only volatile if it's not dirty and has refcount == 0
|
||||
if (!pe->blocks[block].dirty)
|
||||
|
@ -1356,7 +1358,7 @@ void block_cache::dec_block_refcount(cached_piece_entry* pe, int block, int reas
|
|||
TORRENT_PIECE_ASSERT(m_pinned_blocks > 0, pe);
|
||||
--m_pinned_blocks;
|
||||
|
||||
#if TORRENT_USE_PURGABLE_CONTROL && TORRENT_DISABLE_POOL_ALLOCATOR
|
||||
#if TORRENT_USE_PURGABLE_CONTROL && defined TORRENT_DISABLE_POOL_ALLOCATOR
|
||||
// we're removing the last refcount to this block, first make sure
|
||||
// its still here. It's only volatile if it's not dirty and has refcount == 0
|
||||
if (!pe->blocks[block].dirty)
|
||||
|
@ -1564,7 +1566,7 @@ void block_cache::check_invariant() const
|
|||
|
||||
for (list_iterator p = m_lru[i].iterate(); p.get(); p.next())
|
||||
{
|
||||
cached_piece_entry* pe = (cached_piece_entry*)p.get();
|
||||
cached_piece_entry* pe = static_cast<cached_piece_entry*>(p.get());
|
||||
TORRENT_PIECE_ASSERT(pe->cache_state == i, pe);
|
||||
if (pe->num_dirty > 0)
|
||||
TORRENT_PIECE_ASSERT(i == cached_piece_entry::write_lru, pe);
|
||||
|
@ -1573,7 +1575,7 @@ void block_cache::check_invariant() const
|
|||
// TORRENT_ASSERT(pe->num_dirty > 0);
|
||||
for (tailqueue_iterator j = pe->jobs.iterate(); j.get(); j.next())
|
||||
{
|
||||
disk_io_job* job = (disk_io_job*)j.get();
|
||||
disk_io_job const* job = static_cast<disk_io_job const*>(j.get());
|
||||
TORRENT_PIECE_ASSERT(job->piece == pe->piece, pe);
|
||||
TORRENT_PIECE_ASSERT(job->in_use, pe);
|
||||
TORRENT_PIECE_ASSERT(!job->callback_called, pe);
|
||||
|
@ -1615,7 +1617,7 @@ void block_cache::check_invariant() const
|
|||
{
|
||||
cached_piece_entry const& p = *i;
|
||||
TORRENT_PIECE_ASSERT(p.blocks, &p);
|
||||
|
||||
|
||||
TORRENT_PIECE_ASSERT(p.storage, &p);
|
||||
int num_blocks = 0;
|
||||
int num_dirty = 0;
|
||||
|
@ -1822,7 +1824,7 @@ bool block_cache::maybe_free_piece(cached_piece_entry* pe)
|
|||
|
||||
cached_piece_entry* block_cache::find_piece(block_cache_reference const& ref)
|
||||
{
|
||||
return find_piece((piece_manager*)ref.storage, ref.piece);
|
||||
return find_piece(static_cast<piece_manager*>(ref.storage), ref.piece);
|
||||
}
|
||||
|
||||
cached_piece_entry* block_cache::find_piece(disk_io_job const* j)
|
||||
|
@ -1843,7 +1845,7 @@ cached_piece_entry* block_cache::find_piece(piece_manager* st, int piece)
|
|||
#if TORRENT_USE_ASSERTS
|
||||
for (tailqueue_iterator j = i->jobs.iterate(); j.get(); j.next())
|
||||
{
|
||||
disk_io_job* job = (disk_io_job*)j.get();
|
||||
disk_io_job const* job = static_cast<disk_io_job const*>(j.get());
|
||||
TORRENT_PIECE_ASSERT(job->piece == piece, &*i);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -515,7 +515,7 @@ namespace libtorrent
|
|||
// stream key obfuscated hash [ hash('req2',SKEY) xor hash('req3',S) ]
|
||||
h.reset();
|
||||
h.update("req2",4);
|
||||
h.update((const char*)info_hash.begin(), 20);
|
||||
h.update(info_hash.data(), 20);
|
||||
sha1_hash streamkey_hash = h.final();
|
||||
|
||||
h.reset();
|
||||
|
@ -619,7 +619,8 @@ namespace libtorrent
|
|||
detail::write_uint16(handshake_len, write_buf); // len(IA)
|
||||
}
|
||||
|
||||
void bt_peer_connection::init_pe_rc4_handler(char const* secret, sha1_hash const& stream_key)
|
||||
void bt_peer_connection::init_pe_rc4_handler(char const* secret
|
||||
, sha1_hash const& stream_key)
|
||||
{
|
||||
INVARIANT_CHECK;
|
||||
|
||||
|
@ -635,7 +636,7 @@ namespace libtorrent
|
|||
|
||||
if (is_outgoing()) h.update(keyA, 4); else h.update(keyB, 4);
|
||||
h.update(secret, dh_key_len);
|
||||
h.update((char const*)stream_key.begin(), 20);
|
||||
h.update(stream_key.data(), 20);
|
||||
const sha1_hash local_key = h.final();
|
||||
|
||||
h.reset();
|
||||
|
@ -646,7 +647,7 @@ namespace libtorrent
|
|||
|
||||
if (is_outgoing()) h.update(keyB, 4); else h.update(keyA, 4);
|
||||
h.update(secret, dh_key_len);
|
||||
h.update((char const*)stream_key.begin(), 20);
|
||||
h.update(stream_key.data(), 20);
|
||||
const sha1_hash remote_key = h.final();
|
||||
|
||||
TORRENT_ASSERT(!m_rc4.get());
|
||||
|
@ -739,10 +740,10 @@ namespace libtorrent
|
|||
{
|
||||
// if we're encrypting this buffer, we need to make a copy
|
||||
// since we'll mutate it
|
||||
char* buf = (char*)malloc(size);
|
||||
char* buf = static_cast<char*>(malloc(size));
|
||||
memcpy(buf, buffer, size);
|
||||
append_send_buffer(buf, size, ®ular_c_free, NULL);
|
||||
destructor((char*)buffer, userdata, ref);
|
||||
destructor(const_cast<char*>(buffer), userdata, ref);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
@ -830,7 +831,7 @@ namespace libtorrent
|
|||
#ifndef TORRENT_DISABLE_LOGGING
|
||||
{
|
||||
char hex_pid[41];
|
||||
to_hex((char const*)&m_our_peer_id[0], 20, hex_pid);
|
||||
to_hex(m_our_peer_id.data(), 20, hex_pid);
|
||||
hex_pid[40] = 0;
|
||||
peer_log(peer_log_alert::outgoing, "HANDSHAKE"
|
||||
, "sent peer_id: %s client: %s"
|
||||
|
@ -3371,7 +3372,7 @@ namespace libtorrent
|
|||
}
|
||||
#endif
|
||||
peer_id pid;
|
||||
std::copy(recv_buffer.begin, recv_buffer.begin + 20, (char*)pid.begin());
|
||||
std::copy(recv_buffer.begin, recv_buffer.begin + 20, pid.data());
|
||||
|
||||
if (t->settings().get_bool(settings_pack::allow_multiple_connections_per_ip))
|
||||
{
|
||||
|
|
|
@ -151,7 +151,7 @@ namespace libtorrent
|
|||
#ifdef TORRENT_DEBUG
|
||||
m_type_queried = true;
|
||||
#endif
|
||||
return (entry::data_type)m_type;
|
||||
return entry::data_type(m_type);
|
||||
}
|
||||
|
||||
entry::~entry() { destruct(); }
|
||||
|
@ -542,13 +542,13 @@ namespace libtorrent
|
|||
|
||||
if (m_type == undefined_t)
|
||||
{
|
||||
construct((data_type)e.m_type);
|
||||
construct(data_type(e.m_type));
|
||||
clear_that = true;
|
||||
}
|
||||
|
||||
if (e.m_type == undefined_t)
|
||||
{
|
||||
e.construct((data_type)m_type);
|
||||
e.construct(data_type(m_type));
|
||||
clear_this = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#if TORRENT_USE_ICONV
|
||||
#include <iconv.h>
|
||||
#include <locale.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
||||
|
||||
|
@ -161,14 +161,14 @@ namespace libtorrent
|
|||
else
|
||||
{
|
||||
ret += '%';
|
||||
ret += hex_chars[((unsigned char)*str) >> 4];
|
||||
ret += hex_chars[((unsigned char)*str) & 15];
|
||||
ret += hex_chars[boost::uint8_t(*str) >> 4];
|
||||
ret += hex_chars[boost::uint8_t(*str) & 15];
|
||||
}
|
||||
++str;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
std::string escape_string(const char* str, int len)
|
||||
{
|
||||
return escape_string_impl(str, len, 11);
|
||||
|
@ -189,7 +189,7 @@ namespace libtorrent
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void convert_path_to_posix(std::string& path)
|
||||
{
|
||||
for (std::string::iterator i = path.begin()
|
||||
|
|
|
@ -34,8 +34,14 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/string_util.hpp" // for allocate_string_copy
|
||||
#include "libtorrent/file.hpp"
|
||||
#include "libtorrent/utf8.hpp"
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/crc.hpp>
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
||||
|
||||
#include <cstdio>
|
||||
#include <algorithm>
|
||||
|
||||
|
@ -224,7 +230,7 @@ namespace libtorrent
|
|||
|
||||
internal_file_entry::~internal_file_entry()
|
||||
{
|
||||
if (name_len == name_is_owned) free((void*)name);
|
||||
if (name_len == name_is_owned) free(const_cast<char*>(name));
|
||||
}
|
||||
|
||||
internal_file_entry::internal_file_entry(internal_file_entry const& fe)
|
||||
|
|
|
@ -81,8 +81,8 @@ namespace libtorrent
|
|||
std::string ret;
|
||||
for (std::string::const_iterator i = s.begin(); i != s.end(); ++i)
|
||||
{
|
||||
ret += hex_chars[((unsigned char)*i) >> 4];
|
||||
ret += hex_chars[((unsigned char)*i) & 0xf];
|
||||
ret += hex_chars[boost::uint8_t(*i) >> 4];
|
||||
ret += hex_chars[boost::uint8_t(*i) & 0xf];
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -91,8 +91,8 @@ namespace libtorrent
|
|||
{
|
||||
for (char const* end = in + len; in < end; ++in)
|
||||
{
|
||||
*out++ = hex_chars[((unsigned char)*in) >> 4];
|
||||
*out++ = hex_chars[((unsigned char)*in) & 0xf];
|
||||
*out++ = hex_chars[boost::uint8_t(*in) >> 4];
|
||||
*out++ = hex_chars[boost::uint8_t(*in) & 0xf];
|
||||
}
|
||||
*out = '\0';
|
||||
}
|
||||
|
|
|
@ -898,7 +898,7 @@ routing_table::add_node_status_t routing_table::add_node_impl(node_entry e)
|
|||
return node_added;
|
||||
}
|
||||
|
||||
if ((int)rb.size() >= m_bucket_size)
|
||||
if (int(rb.size()) >= m_bucket_size)
|
||||
{
|
||||
// if the replacement bucket is full, remove the oldest entry
|
||||
// but prefer nodes that haven't been pinged, since they are
|
||||
|
@ -1174,7 +1174,7 @@ void routing_table::find_node(node_id const& target
|
|||
{
|
||||
--j;
|
||||
bucket_t& b = j->live_nodes;
|
||||
|
||||
|
||||
if (options & include_failed)
|
||||
{
|
||||
std::copy(b.begin(), b.end(), std::back_inserter(l));
|
||||
|
|
|
@ -164,7 +164,11 @@ namespace libtorrent
|
|||
stack.push_back(ent);
|
||||
break;
|
||||
}
|
||||
default: break;
|
||||
case lazy_entry::int_t:
|
||||
case lazy_entry::string_t:
|
||||
case lazy_entry::none_t:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
--item_limit;
|
||||
|
|
|
@ -606,21 +606,21 @@ namespace libtorrent
|
|||
if (addr.is_v4())
|
||||
{
|
||||
address_v4::bytes_type bytes = addr.to_v4().to_bytes();
|
||||
x.assign((char*)&bytes[0], bytes.size());
|
||||
x.assign(reinterpret_cast<char*>(bytes.data()), bytes.size());
|
||||
}
|
||||
#if TORRENT_USE_IPV6
|
||||
else
|
||||
{
|
||||
address_v6::bytes_type bytes = addr.to_v6().to_bytes();
|
||||
x.assign((char*)&bytes[0], bytes.size());
|
||||
x.assign(reinterpret_cast<char*>(bytes.data()), bytes.size());
|
||||
}
|
||||
#endif
|
||||
x.append((char*)&t->torrent_file().info_hash()[0], 20);
|
||||
x.append(t->torrent_file().info_hash().data(), 20);
|
||||
|
||||
sha1_hash hash = hasher(x.c_str(), x.size()).final();
|
||||
for (;;)
|
||||
{
|
||||
char* p = (char*)&hash[0];
|
||||
char* p = hash.data();
|
||||
for (int i = 0; i < 5; ++i)
|
||||
{
|
||||
int piece = detail::read_uint32(p) % num_pieces;
|
||||
|
@ -642,7 +642,7 @@ namespace libtorrent
|
|||
|| int(m_accept_fast.size()) == num_pieces) return;
|
||||
}
|
||||
}
|
||||
hash = hasher((char*)&hash[0], 20).final();
|
||||
hash = hasher(hash.data(), 20).final();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -878,7 +878,7 @@ namespace libtorrent
|
|||
if (!peer_info_struct() || peer_info_struct()->fast_reconnects > 1)
|
||||
return;
|
||||
m_fast_reconnect = r;
|
||||
peer_info_struct()->last_connected = (boost::uint16_t)m_ses.session_time();
|
||||
peer_info_struct()->last_connected = boost::uint16_t(m_ses.session_time());
|
||||
int rewind = m_settings.get_int(settings_pack::min_reconnect_time)
|
||||
* m_settings.get_int(settings_pack::max_failcount);
|
||||
if (peer_info_struct()->last_connected < rewind) peer_info_struct()->last_connected = 0;
|
||||
|
@ -3295,7 +3295,7 @@ namespace libtorrent
|
|||
{
|
||||
TORRENT_ASSERT(is_single_thread());
|
||||
if (has_peer_choked() || !is_interesting()) return false;
|
||||
if ((int)m_download_queue.size() + (int)m_request_queue.size()
|
||||
if (int(m_download_queue.size()) + int(m_request_queue.size())
|
||||
> m_desired_queue_size * 2) return false;
|
||||
if (on_parole()) return false;
|
||||
if (m_disconnecting) return false;
|
||||
|
@ -3747,7 +3747,7 @@ namespace libtorrent
|
|||
{
|
||||
TORRENT_ASSERT(is_single_thread());
|
||||
INVARIANT_CHECK;
|
||||
|
||||
|
||||
boost::shared_ptr<torrent> t = m_torrent.lock();
|
||||
TORRENT_ASSERT(t);
|
||||
|
||||
|
@ -3769,13 +3769,13 @@ namespace libtorrent
|
|||
|| t->state() == torrent_status::allocating)
|
||||
return;
|
||||
|
||||
if ((int)m_download_queue.size() >= m_desired_queue_size
|
||||
if (int(m_download_queue.size()) >= m_desired_queue_size
|
||||
|| t->upload_mode()) return;
|
||||
|
||||
bool empty_download_queue = m_download_queue.empty();
|
||||
|
||||
while (!m_request_queue.empty()
|
||||
&& ((int)m_download_queue.size() < m_desired_queue_size
|
||||
&& (int(m_download_queue.size()) < m_desired_queue_size
|
||||
|| m_queued_time_critical > 0))
|
||||
{
|
||||
pending_block block = m_request_queue.front();
|
||||
|
@ -3984,7 +3984,7 @@ namespace libtorrent
|
|||
if (m_disconnecting) return;
|
||||
|
||||
m_socket->set_close_reason(error_to_close_reason(ec));
|
||||
close_reason_t close_reason = (close_reason_t)m_socket->get_close_reason();
|
||||
close_reason_t close_reason = close_reason_t(m_socket->get_close_reason());
|
||||
#ifndef TORRENT_DISABLE_LOGGING
|
||||
if (close_reason != 0)
|
||||
{
|
||||
|
@ -4406,7 +4406,7 @@ namespace libtorrent
|
|||
p.used_receive_buffer = m_recv_buffer.pos();
|
||||
p.write_state = m_channel_state[upload_channel];
|
||||
p.read_state = m_channel_state[download_channel];
|
||||
|
||||
|
||||
// pieces may be empty if we don't have metadata yet
|
||||
if (p.pieces.size() == 0)
|
||||
{
|
||||
|
@ -4418,7 +4418,7 @@ namespace libtorrent
|
|||
#if TORRENT_NO_FPU
|
||||
p.progress = 0.f;
|
||||
#else
|
||||
p.progress = (float)p.pieces.count() / (float)p.pieces.size();
|
||||
p.progress = float(p.pieces.count()) / float(p.pieces.size());
|
||||
#endif
|
||||
p.progress_ppm = boost::uint64_t(p.pieces.count()) * 1000000 / p.pieces.size();
|
||||
}
|
||||
|
@ -5055,7 +5055,7 @@ namespace libtorrent
|
|||
peer_request& r = m_requests[i];
|
||||
|
||||
TORRENT_ASSERT(r.piece >= 0);
|
||||
TORRENT_ASSERT(r.piece < (int)m_have_piece.size());
|
||||
TORRENT_ASSERT(r.piece < int(m_have_piece.size()));
|
||||
// TORRENT_ASSERT(t->have_piece(r.piece));
|
||||
TORRENT_ASSERT(r.start + r.length <= t->torrent_file().piece_size(r.piece));
|
||||
TORRENT_ASSERT(r.length > 0 && r.start >= 0);
|
||||
|
@ -6768,7 +6768,7 @@ namespace libtorrent
|
|||
// if m_num_pieces == 0, we probably don't have the
|
||||
// metadata yet.
|
||||
boost::shared_ptr<torrent> t = m_torrent.lock();
|
||||
return m_num_pieces == (int)m_have_piece.size()
|
||||
return m_num_pieces == int(m_have_piece.size())
|
||||
&& m_num_pieces > 0 && t && t->valid_metadata();
|
||||
}
|
||||
|
||||
|
|
|
@ -492,7 +492,7 @@ namespace libtorrent
|
|||
}
|
||||
|
||||
if (t != 0)
|
||||
TORRENT_ASSERT((int)m_piece_map.size() == t->torrent_file().num_pieces());
|
||||
TORRENT_ASSERT(int(m_piece_map.size()) == t->torrent_file().num_pieces());
|
||||
|
||||
for (int j = 0; j < piece_pos::num_download_categories; ++j)
|
||||
{
|
||||
|
@ -1606,7 +1606,7 @@ namespace libtorrent
|
|||
{
|
||||
TORRENT_PIECE_PICKER_INVARIANT_CHECK;
|
||||
TORRENT_ASSERT(index >= 0);
|
||||
TORRENT_ASSERT(index < (int)m_piece_map.size());
|
||||
TORRENT_ASSERT(index < int(m_piece_map.size()));
|
||||
|
||||
piece_pos& p = m_piece_map[index];
|
||||
|
||||
|
@ -1672,7 +1672,7 @@ namespace libtorrent
|
|||
TORRENT_PIECE_PICKER_INVARIANT_CHECK;
|
||||
#endif
|
||||
TORRENT_ASSERT(index >= 0);
|
||||
TORRENT_ASSERT(index < (int)m_piece_map.size());
|
||||
TORRENT_ASSERT(index < int(m_piece_map.size()));
|
||||
|
||||
#ifdef TORRENT_PICKER_LOG
|
||||
std::cerr << "[" << this << "] " << "piece_picker::we_have("
|
||||
|
@ -1752,7 +1752,7 @@ namespace libtorrent
|
|||
TORRENT_ASSERT(new_piece_priority >= 0);
|
||||
TORRENT_ASSERT(new_piece_priority < priority_levels);
|
||||
TORRENT_ASSERT(index >= 0);
|
||||
TORRENT_ASSERT(index < (int)m_piece_map.size());
|
||||
TORRENT_ASSERT(index < int(m_piece_map.size()));
|
||||
|
||||
piece_pos& p = m_piece_map[index];
|
||||
|
||||
|
@ -1855,7 +1855,7 @@ namespace libtorrent
|
|||
int piece_picker::piece_priority(int index) const
|
||||
{
|
||||
TORRENT_ASSERT(index >= 0);
|
||||
TORRENT_ASSERT(index < (int)m_piece_map.size());
|
||||
TORRENT_ASSERT(index < int(m_piece_map.size()));
|
||||
|
||||
return m_piece_map[index].piece_priority;
|
||||
}
|
||||
|
@ -2530,8 +2530,8 @@ get_out:
|
|||
int piece_picker::blocks_in_piece(int index) const
|
||||
{
|
||||
TORRENT_ASSERT(index >= 0);
|
||||
TORRENT_ASSERT(index < (int)m_piece_map.size() || m_piece_map.empty());
|
||||
if (index+1 == (int)m_piece_map.size())
|
||||
TORRENT_ASSERT(index < int(m_piece_map.size()) || m_piece_map.empty());
|
||||
if (index + 1 == int(m_piece_map.size()))
|
||||
return m_blocks_in_last_piece;
|
||||
else
|
||||
return m_blocks_per_piece;
|
||||
|
@ -2852,7 +2852,7 @@ get_out:
|
|||
|
||||
bool piece_picker::is_piece_finished(int index) const
|
||||
{
|
||||
TORRENT_ASSERT(index < (int)m_piece_map.size());
|
||||
TORRENT_ASSERT(index < int(m_piece_map.size()));
|
||||
TORRENT_ASSERT(index >= 0);
|
||||
|
||||
piece_pos const& p = m_piece_map[index];
|
||||
|
@ -2867,7 +2867,7 @@ get_out:
|
|||
}
|
||||
std::vector<downloading_piece>::const_iterator i = find_dl_piece(state, index);
|
||||
TORRENT_ASSERT(i != m_downloads[state].end());
|
||||
TORRENT_ASSERT((int)i->finished <= m_blocks_per_piece);
|
||||
TORRENT_ASSERT(int(i->finished) <= m_blocks_per_piece);
|
||||
int max_blocks = blocks_in_piece(index);
|
||||
if (int(i->finished) + int(i->writing) < max_blocks) return false;
|
||||
TORRENT_ASSERT(int(i->finished) + int(i->writing) == max_blocks);
|
||||
|
@ -2887,7 +2887,7 @@ get_out:
|
|||
|
||||
bool piece_picker::has_piece_passed(int index) const
|
||||
{
|
||||
TORRENT_ASSERT(index < (int)m_piece_map.size());
|
||||
TORRENT_ASSERT(index < int(m_piece_map.size()));
|
||||
TORRENT_ASSERT(index >= 0);
|
||||
|
||||
piece_pos const& p = m_piece_map[index];
|
||||
|
@ -3621,7 +3621,7 @@ get_out:
|
|||
|
||||
void piece_picker::get_downloaders(std::vector<void*>& d, int index) const
|
||||
{
|
||||
TORRENT_ASSERT(index >= 0 && index <= (int)m_piece_map.size());
|
||||
TORRENT_ASSERT(index >= 0 && index <= int(m_piece_map.size()));
|
||||
|
||||
d.clear();
|
||||
int state = m_piece_map[index].download_queue();
|
||||
|
@ -3751,7 +3751,7 @@ get_out:
|
|||
for (std::vector<downloading_piece>::const_iterator i = m_downloads[k].begin();
|
||||
i != m_downloads[k].end(); ++i)
|
||||
{
|
||||
counter += (int)i->finished;
|
||||
counter += int(i->finished);
|
||||
}
|
||||
}
|
||||
return counter;
|
||||
|
|
18
src/rss.cpp
18
src/rss.cpp
|
@ -76,7 +76,7 @@ struct feed_state
|
|||
{
|
||||
case atom: return string_equal_no_case(tag, "entry");
|
||||
case rss2: return string_equal_no_case(tag, "item");
|
||||
default: return false;
|
||||
case none: return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -86,7 +86,7 @@ struct feed_state
|
|||
{
|
||||
case atom:
|
||||
case rss2: return string_equal_no_case(tag, "title");
|
||||
default: return false;
|
||||
case none: return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ struct feed_state
|
|||
{
|
||||
case atom:
|
||||
case rss2: return string_equal_no_case(tag, "link");
|
||||
default: return false;
|
||||
case none: return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -107,7 +107,7 @@ struct feed_state
|
|||
case atom: return string_equal_no_case(tag, "summary");
|
||||
case rss2: return string_equal_no_case(tag, "description")
|
||||
|| string_equal_no_case(tag, "media:text");
|
||||
default: return false;
|
||||
case none: return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -117,7 +117,7 @@ struct feed_state
|
|||
{
|
||||
case atom: return string_equal_no_case(tag, "id");
|
||||
case rss2: return string_equal_no_case(tag, "guid");
|
||||
default: return false;
|
||||
case none: return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -127,7 +127,7 @@ struct feed_state
|
|||
{
|
||||
case atom: return false;
|
||||
case rss2: return string_equal_no_case(tag, "comments");
|
||||
default: return false;
|
||||
case none: return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -137,14 +137,14 @@ struct feed_state
|
|||
{
|
||||
case atom: return false;
|
||||
case rss2: return string_equal_no_case(tag, "category");
|
||||
default: return false;
|
||||
case none: return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool is_size(char const* tag) const
|
||||
{
|
||||
return string_equal_no_case(tag, "size")
|
||||
|| string_equal_no_case(tag, "contentlength");
|
||||
|| string_equal_no_case(tag, "contentlength");
|
||||
}
|
||||
|
||||
bool is_hash(char const* tag) const
|
||||
|
@ -262,7 +262,7 @@ void parse_feed(feed_state& f, int token, char const* name, char const* val)
|
|||
f.current_item.size = strtoll(name, 0, 10);
|
||||
else if (f.is_hash(f.current_tag.c_str()) && strlen(name) == 40)
|
||||
{
|
||||
if (!from_hex(name, 40, (char*)&f.current_item.info_hash[0]))
|
||||
if (!from_hex(name, 40, f.current_item.info_hash.data()))
|
||||
{
|
||||
// hex parsing failed
|
||||
f.current_item.info_hash.clear();
|
||||
|
|
|
@ -414,7 +414,7 @@ namespace libtorrent
|
|||
// close files that were opened in write mode
|
||||
m_pool.release(this);
|
||||
|
||||
#if TORRENT_DEBUG_FILE_LEAKS
|
||||
#if defined TORRENT_DEBUG_FILE_LEAKS
|
||||
print_open_files("release files", m_files.name().c_str());
|
||||
#endif
|
||||
}
|
||||
|
@ -492,7 +492,7 @@ namespace libtorrent
|
|||
// valid.
|
||||
if (exists(old_name, ec.ec))
|
||||
{
|
||||
#if TORRENT_DEBUG_FILE_LEAKS
|
||||
#if defined TORRENT_DEBUG_FILE_LEAKS
|
||||
print_open_files("release files", m_files.name().c_str());
|
||||
#endif
|
||||
|
||||
|
@ -547,7 +547,7 @@ namespace libtorrent
|
|||
// make sure we don't have the files open
|
||||
m_pool.release(this);
|
||||
|
||||
#if TORRENT_DEBUG_FILE_LEAKS
|
||||
#if defined TORRENT_DEBUG_FILE_LEAKS
|
||||
print_open_files("release files", m_files.name().c_str());
|
||||
#endif
|
||||
}
|
||||
|
@ -573,7 +573,7 @@ namespace libtorrent
|
|||
// case
|
||||
if (!m_pool.assert_idle_files(this))
|
||||
{
|
||||
#if TORRENT_DEBUG_FILE_LEAKS
|
||||
#if defined TORRENT_DEBUG_FILE_LEAKS
|
||||
print_open_files("delete-files idle assert failed", m_files.name().c_str());
|
||||
#endif
|
||||
TORRENT_ASSERT(false);
|
||||
|
@ -583,7 +583,7 @@ namespace libtorrent
|
|||
// make sure we don't have the files open
|
||||
m_pool.release(this);
|
||||
|
||||
#if TORRENT_DEBUG_FILE_LEAKS
|
||||
#if defined TORRENT_DEBUG_FILE_LEAKS
|
||||
print_open_files("release files", m_files.name().c_str());
|
||||
#endif
|
||||
|
||||
|
@ -633,7 +633,7 @@ namespace libtorrent
|
|||
|
||||
DFLOG(stderr, "[%p] delete_files result: %s\n", this, ec.ec.message().c_str());
|
||||
|
||||
#if TORRENT_DEBUG_FILE_LEAKS
|
||||
#if defined TORRENT_DEBUG_FILE_LEAKS
|
||||
print_open_files("delete-files done", m_files.name().c_str());
|
||||
#endif
|
||||
}
|
||||
|
@ -1003,7 +1003,7 @@ namespace libtorrent
|
|||
|
||||
m_pool.release(this);
|
||||
|
||||
#if TORRENT_DEBUG_FILE_LEAKS
|
||||
#if defined TORRENT_DEBUG_FILE_LEAKS
|
||||
print_open_files("release files", m_files.name().c_str());
|
||||
#endif
|
||||
|
||||
|
@ -1431,9 +1431,9 @@ namespace libtorrent
|
|||
#endif
|
||||
}
|
||||
|
||||
bool storage_piece_set::has_piece(cached_piece_entry* p) const
|
||||
bool storage_piece_set::has_piece(cached_piece_entry const* p) const
|
||||
{
|
||||
return m_cached_pieces.count(p) > 0;
|
||||
return m_cached_pieces.count(const_cast<cached_piece_entry*>(p)) > 0;
|
||||
}
|
||||
|
||||
void storage_piece_set::remove_piece(cached_piece_entry* p)
|
||||
|
|
|
@ -6947,7 +6947,7 @@ namespace libtorrent
|
|||
if (!m_source_feed_url.empty()) ret["feed"] = m_source_feed_url;
|
||||
|
||||
const sha1_hash& info_hash = torrent_file().info_hash();
|
||||
ret["info-hash"] = std::string((char*)info_hash.begin(), (char*)info_hash.end());
|
||||
ret["info-hash"] = info_hash.to_string();
|
||||
|
||||
if (valid_metadata())
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue