forked from premiere/premiere-libtorrent
fix some msvc warnings
This commit is contained in:
parent
6fc0b3609f
commit
fba0762353
|
@ -260,7 +260,7 @@ namespace libtorrent
|
||||||
std::string const& collection) const TORRENT_OVERRIDE TORRENT_FINAL;
|
std::string const& collection) const TORRENT_OVERRIDE TORRENT_FINAL;
|
||||||
#endif
|
#endif
|
||||||
boost::weak_ptr<torrent> find_disconnect_candidate_torrent() const TORRENT_OVERRIDE TORRENT_FINAL;
|
boost::weak_ptr<torrent> find_disconnect_candidate_torrent() const TORRENT_OVERRIDE TORRENT_FINAL;
|
||||||
int num_torrents() const TORRENT_OVERRIDE TORRENT_FINAL { return m_torrents.size(); }
|
int num_torrents() const TORRENT_OVERRIDE TORRENT_FINAL { return int(m_torrents.size()); }
|
||||||
|
|
||||||
void insert_torrent(sha1_hash const& ih, boost::shared_ptr<torrent> const& t
|
void insert_torrent(sha1_hash const& ih, boost::shared_ptr<torrent> const& t
|
||||||
, std::string uuid);
|
, std::string uuid);
|
||||||
|
@ -458,8 +458,7 @@ namespace libtorrent
|
||||||
bool preemptive_unchoke() const;
|
bool preemptive_unchoke() const;
|
||||||
int num_uploads() const
|
int num_uploads() const
|
||||||
{ return int(m_stats_counters[counters::num_peers_up_unchoked]); }
|
{ return int(m_stats_counters[counters::num_peers_up_unchoked]); }
|
||||||
int num_connections() const
|
int num_connections() const { return int(m_connections.size()); }
|
||||||
{ return m_connections.size(); }
|
|
||||||
|
|
||||||
int peak_up_rate() const { return m_peak_up_rate; }
|
int peak_up_rate() const { return m_peak_up_rate; }
|
||||||
|
|
||||||
|
|
|
@ -107,7 +107,7 @@ namespace libtorrent { namespace aux
|
||||||
// This is the basic logging and debug interface offered by the session.
|
// This is the basic logging and debug interface offered by the session.
|
||||||
// a release build with logging disabled (which is the default) will
|
// a release build with logging disabled (which is the default) will
|
||||||
// not have this class at all
|
// not have this class at all
|
||||||
struct session_logger
|
struct TORRENT_EXTRA_EXPORT session_logger
|
||||||
{
|
{
|
||||||
#ifndef TORRENT_DISABLE_LOGGING
|
#ifndef TORRENT_DISABLE_LOGGING
|
||||||
virtual void session_log(char const* fmt, ...) const TORRENT_FORMAT(2,3) = 0;
|
virtual void session_log(char const* fmt, ...) const TORRENT_FORMAT(2,3) = 0;
|
||||||
|
@ -128,7 +128,7 @@ namespace libtorrent { namespace aux
|
||||||
// TOOD: 2 make this interface a lot smaller. It could be split up into
|
// TOOD: 2 make this interface a lot smaller. It could be split up into
|
||||||
// several smaller interfaces. Each subsystem could then limit the size
|
// several smaller interfaces. Each subsystem could then limit the size
|
||||||
// of the mock object to test it.
|
// of the mock object to test it.
|
||||||
struct session_interface
|
struct TORRENT_EXTRA_EXPORT session_interface
|
||||||
: buffer_allocator_interface
|
: buffer_allocator_interface
|
||||||
#if !defined TORRENT_DISABLE_LOGGING || TORRENT_USE_ASSERTS
|
#if !defined TORRENT_DISABLE_LOGGING || TORRENT_USE_ASSERTS
|
||||||
, session_logger
|
, session_logger
|
||||||
|
|
|
@ -36,7 +36,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
namespace libtorrent
|
namespace libtorrent
|
||||||
{
|
{
|
||||||
struct bandwidth_socket
|
struct TORRENT_EXTRA_EXPORT bandwidth_socket
|
||||||
{
|
{
|
||||||
virtual void assign_bandwidth(int channel, int amount) = 0;
|
virtual void assign_bandwidth(int channel, int amount) = 0;
|
||||||
virtual bool is_disconnecting() const = 0;
|
virtual bool is_disconnecting() const = 0;
|
||||||
|
|
|
@ -94,7 +94,7 @@ namespace libtorrent
|
||||||
#ifndef TORRENT_NO_DEPRECATE
|
#ifndef TORRENT_NO_DEPRECATE
|
||||||
// thrown by bdecode() if the provided bencoded buffer does not contain
|
// thrown by bdecode() if the provided bencoded buffer does not contain
|
||||||
// valid encoding.
|
// valid encoding.
|
||||||
struct TORRENT_EXPORT invalid_encoding: std::exception
|
struct invalid_encoding: std::exception
|
||||||
{
|
{
|
||||||
// hidden
|
// hidden
|
||||||
virtual const char* what() const TORRENT_EXCEPTION_THROW_SPECIFIER
|
virtual const char* what() const TORRENT_EXCEPTION_THROW_SPECIFIER
|
||||||
|
|
|
@ -360,12 +360,12 @@ namespace libtorrent
|
||||||
// returns a range of all pieces. This migh be a very
|
// returns a range of all pieces. This migh be a very
|
||||||
// long list, use carefully
|
// long list, use carefully
|
||||||
std::pair<iterator, iterator> all_pieces() const;
|
std::pair<iterator, iterator> all_pieces() const;
|
||||||
int num_pieces() const { return m_pieces.size(); }
|
int num_pieces() const { return int(m_pieces.size()); }
|
||||||
|
|
||||||
list_iterator<cached_piece_entry> write_lru_pieces() const
|
list_iterator<cached_piece_entry> write_lru_pieces() const
|
||||||
{ return m_lru[cached_piece_entry::write_lru].iterate(); }
|
{ return m_lru[cached_piece_entry::write_lru].iterate(); }
|
||||||
|
|
||||||
int num_write_lru_pieces() const { return m_lru[cached_piece_entry::write_lru].size(); }
|
int num_write_lru_pieces() const { return int(m_lru[cached_piece_entry::write_lru].size()); }
|
||||||
|
|
||||||
// mark this piece for deletion. If there are no outstanding
|
// mark this piece for deletion. If there are no outstanding
|
||||||
// requests to this piece, it's removed immediately, and the
|
// requests to this piece, it's removed immediately, and the
|
||||||
|
|
|
@ -79,7 +79,7 @@ namespace libtorrent
|
||||||
void send(char const* buffer, int size, error_code& ec, int flags = 0);
|
void send(char const* buffer, int size, error_code& ec, int flags = 0);
|
||||||
|
|
||||||
void close();
|
void close();
|
||||||
int num_send_sockets() const { return m_unicast_sockets.size(); }
|
int num_send_sockets() const { return int(m_unicast_sockets.size()); }
|
||||||
void enable_ip_broadcast(bool e);
|
void enable_ip_broadcast(bool e);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -50,7 +50,7 @@ namespace libtorrent
|
||||||
struct disk_io_thread;
|
struct disk_io_thread;
|
||||||
struct disk_observer;
|
struct disk_observer;
|
||||||
|
|
||||||
struct buffer_allocator_interface
|
struct TORRENT_EXTRA_EXPORT buffer_allocator_interface
|
||||||
{
|
{
|
||||||
virtual char* allocate_disk_buffer(char const* category) = 0;
|
virtual char* allocate_disk_buffer(char const* category) = 0;
|
||||||
virtual void free_disk_buffer(char* b) = 0;
|
virtual void free_disk_buffer(char* b) = 0;
|
||||||
|
|
|
@ -50,7 +50,7 @@ namespace libtorrent
|
||||||
struct add_torrent_params;
|
struct add_torrent_params;
|
||||||
struct cache_status;
|
struct cache_status;
|
||||||
|
|
||||||
struct disk_interface
|
struct TORRENT_EXTRA_EXPORT disk_interface
|
||||||
{
|
{
|
||||||
virtual void async_read(piece_manager* storage, peer_request const& r
|
virtual void async_read(piece_manager* storage, peer_request const& r
|
||||||
, boost::function<void(disk_io_job const*)> const& handler, void* requester
|
, boost::function<void(disk_io_job const*)> const& handler, void* requester
|
||||||
|
|
|
@ -46,7 +46,7 @@ namespace libtorrent
|
||||||
{
|
{
|
||||||
struct disk_io_job;
|
struct disk_io_job;
|
||||||
|
|
||||||
struct disk_job_pool
|
struct TORRENT_EXTRA_EXPORT disk_job_pool
|
||||||
{
|
{
|
||||||
disk_job_pool();
|
disk_job_pool();
|
||||||
~disk_job_pool();
|
~disk_job_pool();
|
||||||
|
|
|
@ -37,7 +37,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
namespace libtorrent
|
namespace libtorrent
|
||||||
{
|
{
|
||||||
struct disk_observer
|
struct TORRENT_EXTRA_EXPORT disk_observer
|
||||||
{
|
{
|
||||||
// called when the disk cache size has dropped
|
// called when the disk cache size has dropped
|
||||||
// below the low watermark again and we can
|
// below the low watermark again and we can
|
||||||
|
|
|
@ -88,7 +88,7 @@ namespace libtorrent
|
||||||
// thrown by any accessor function of entry if the accessor
|
// thrown by any accessor function of entry if the accessor
|
||||||
// function requires a type different than the actual type
|
// function requires a type different than the actual type
|
||||||
// of the entry object.
|
// of the entry object.
|
||||||
struct TORRENT_EXPORT type_error: std::runtime_error
|
struct type_error : std::runtime_error
|
||||||
{
|
{
|
||||||
// internal
|
// internal
|
||||||
type_error(const char* error): std::runtime_error(error) {}
|
type_error(const char* error): std::runtime_error(error) {}
|
||||||
|
|
|
@ -39,7 +39,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
namespace libtorrent { namespace dht
|
namespace libtorrent { namespace dht
|
||||||
{
|
{
|
||||||
struct dht_logger
|
struct TORRENT_EXTRA_EXPORT dht_logger
|
||||||
{
|
{
|
||||||
enum module_t
|
enum module_t
|
||||||
{
|
{
|
||||||
|
@ -64,7 +64,7 @@ namespace libtorrent { namespace dht
|
||||||
~dht_logger() {}
|
~dht_logger() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct dht_observer : dht_logger
|
struct TORRENT_EXTRA_EXPORT dht_observer : dht_logger
|
||||||
{
|
{
|
||||||
virtual void set_external_address(address const& addr
|
virtual void set_external_address(address const& addr
|
||||||
, address const& source) = 0;
|
, address const& source) = 0;
|
||||||
|
|
|
@ -128,7 +128,6 @@ namespace libtorrent
|
||||||
|
|
||||||
struct TORRENT_EXTRA_EXPORT peer_class_pool
|
struct TORRENT_EXTRA_EXPORT peer_class_pool
|
||||||
{
|
{
|
||||||
|
|
||||||
peer_class_t new_peer_class(std::string const& label);
|
peer_class_t new_peer_class(std::string const& label);
|
||||||
void decref(peer_class_t c);
|
void decref(peer_class_t c);
|
||||||
void incref(peer_class_t c);
|
void incref(peer_class_t c);
|
||||||
|
|
|
@ -40,7 +40,7 @@ namespace libtorrent {
|
||||||
|
|
||||||
// this represents an object that can have many peer classes applied
|
// this represents an object that can have many peer classes applied
|
||||||
// to it. Most notably, peer connections and torrents derive from this.
|
// to it. Most notably, peer connections and torrents derive from this.
|
||||||
struct peer_class_set
|
struct TORRENT_EXTRA_EXPORT peer_class_set
|
||||||
{
|
{
|
||||||
peer_class_set() : m_size(0) {}
|
peer_class_set() : m_size(0) {}
|
||||||
void add_class(peer_class_pool& pool, peer_class_t c);
|
void add_class(peer_class_pool& pool, peer_class_t c);
|
||||||
|
|
|
@ -175,7 +175,7 @@ namespace libtorrent
|
||||||
// internal
|
// internal
|
||||||
inline void nop(char*, void*, block_cache_reference) {}
|
inline void nop(char*, void*, block_cache_reference) {}
|
||||||
|
|
||||||
struct peer_connection_hot_members
|
struct TORRENT_EXTRA_EXPORT peer_connection_hot_members
|
||||||
{
|
{
|
||||||
// if tor is set, this is an outgoing connection
|
// if tor is set, this is an outgoing connection
|
||||||
peer_connection_hot_members(
|
peer_connection_hot_members(
|
||||||
|
@ -1274,8 +1274,11 @@ namespace libtorrent
|
||||||
m_need_uncork = true;
|
m_need_uncork = true;
|
||||||
}
|
}
|
||||||
~cork() { if (m_need_uncork) m_pc.uncork_socket(); }
|
~cork() { if (m_need_uncork) m_pc.uncork_socket(); }
|
||||||
|
private:
|
||||||
peer_connection& m_pc;
|
peer_connection& m_pc;
|
||||||
bool m_need_uncork;
|
bool m_need_uncork;
|
||||||
|
|
||||||
|
cork& operator=(cork const&);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ namespace libtorrent
|
||||||
struct peer_info;
|
struct peer_info;
|
||||||
|
|
||||||
// TODO: make this interface smaller!
|
// TODO: make this interface smaller!
|
||||||
struct peer_connection_interface
|
struct TORRENT_EXTRA_EXPORT peer_connection_interface
|
||||||
{
|
{
|
||||||
virtual tcp::endpoint const& remote() const = 0;
|
virtual tcp::endpoint const& remote() const = 0;
|
||||||
virtual tcp::endpoint local_endpoint() const = 0;
|
virtual tcp::endpoint local_endpoint() const = 0;
|
||||||
|
|
|
@ -53,7 +53,7 @@ namespace libtorrent
|
||||||
// in other torrents.
|
// in other torrents.
|
||||||
struct TORRENT_EXTRA_EXPORT resolve_links
|
struct TORRENT_EXTRA_EXPORT resolve_links
|
||||||
{
|
{
|
||||||
struct link_t
|
struct TORRENT_EXTRA_EXPORT link_t
|
||||||
{
|
{
|
||||||
boost::shared_ptr<const torrent_info> ti;
|
boost::shared_ptr<const torrent_info> ti;
|
||||||
std::string save_path;
|
std::string save_path;
|
||||||
|
|
|
@ -46,7 +46,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
namespace libtorrent
|
namespace libtorrent
|
||||||
{
|
{
|
||||||
|
|
||||||
struct resolver_interface
|
struct TORRENT_EXTRA_EXPORT resolver_interface
|
||||||
{
|
{
|
||||||
typedef boost::function<void(error_code const&, std::vector<address> const&)>
|
typedef boost::function<void(error_code const&, std::vector<address> const&)>
|
||||||
callback_t;
|
callback_t;
|
||||||
|
|
|
@ -73,7 +73,7 @@ namespace libtorrent
|
||||||
: m_impl(impl)
|
: m_impl(impl)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
bool is_valid() const { return m_impl; }
|
bool is_valid() const { return m_impl != NULL; }
|
||||||
|
|
||||||
// TODO: 2 the ip filter should probably be saved here too
|
// TODO: 2 the ip filter should probably be saved here too
|
||||||
|
|
||||||
|
|
|
@ -136,7 +136,7 @@ namespace libtorrent
|
||||||
sha1_hash& operator<<=(int n)
|
sha1_hash& operator<<=(int n)
|
||||||
{
|
{
|
||||||
TORRENT_ASSERT(n >= 0);
|
TORRENT_ASSERT(n >= 0);
|
||||||
const size_t num_words = size_t(n) / 32;
|
const int num_words = n / 32;
|
||||||
if (num_words >= number_size)
|
if (num_words >= number_size)
|
||||||
{
|
{
|
||||||
std::memset(m_number, 0, size);
|
std::memset(m_number, 0, size);
|
||||||
|
@ -175,7 +175,7 @@ namespace libtorrent
|
||||||
sha1_hash& operator>>=(int n)
|
sha1_hash& operator>>=(int n)
|
||||||
{
|
{
|
||||||
TORRENT_ASSERT(n >= 0);
|
TORRENT_ASSERT(n >= 0);
|
||||||
const size_t num_words = size_t(n) / 32;
|
const int num_words = n / 32;
|
||||||
if (num_words >= number_size)
|
if (num_words >= number_size)
|
||||||
{
|
{
|
||||||
std::memset(m_number, 0, size_t(size));
|
std::memset(m_number, 0, size_t(size));
|
||||||
|
|
|
@ -625,7 +625,7 @@ namespace libtorrent
|
||||||
void add_piece(cached_piece_entry* p);
|
void add_piece(cached_piece_entry* p);
|
||||||
void remove_piece(cached_piece_entry* p);
|
void remove_piece(cached_piece_entry* p);
|
||||||
bool has_piece(cached_piece_entry const* p) const;
|
bool has_piece(cached_piece_entry const* p) const;
|
||||||
int num_pieces() const { return m_cached_pieces.size(); }
|
int num_pieces() const { return int(m_cached_pieces.size()); }
|
||||||
boost::unordered_set<cached_piece_entry*> const& cached_pieces() const
|
boost::unordered_set<cached_piece_entry*> const& cached_pieces() const
|
||||||
{ return m_cached_pieces; }
|
{ return m_cached_pieces; }
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -177,7 +177,7 @@ namespace libtorrent
|
||||||
std::vector<char> restart_piece;
|
std::vector<char> restart_piece;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct torrent_hot_members
|
struct TORRENT_EXTRA_EXPORT torrent_hot_members
|
||||||
{
|
{
|
||||||
torrent_hot_members(aux::session_interface& ses
|
torrent_hot_members(aux::session_interface& ses
|
||||||
, add_torrent_params const& p, int block_size);
|
, add_torrent_params const& p, int block_size);
|
||||||
|
@ -1018,7 +1018,7 @@ namespace libtorrent
|
||||||
bool are_files_checked() const
|
bool are_files_checked() const
|
||||||
{ return m_files_checked; }
|
{ return m_files_checked; }
|
||||||
bool valid_storage() const
|
bool valid_storage() const
|
||||||
{ return m_storage.get(); }
|
{ return m_storage.get() != NULL; }
|
||||||
|
|
||||||
// parses the info section from the given
|
// parses the info section from the given
|
||||||
// bencoded tree and moves the torrent
|
// bencoded tree and moves the torrent
|
||||||
|
@ -1107,7 +1107,7 @@ namespace libtorrent
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int num_time_critical_pieces() const
|
int num_time_critical_pieces() const
|
||||||
{ return m_time_critical_pieces.size(); }
|
{ return int(m_time_critical_pieces.size()); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
namespace libtorrent
|
namespace libtorrent
|
||||||
{
|
{
|
||||||
|
|
||||||
struct torrent_peer_allocator_interface
|
struct TORRENT_EXTRA_EXPORT torrent_peer_allocator_interface
|
||||||
{
|
{
|
||||||
enum peer_type_t
|
enum peer_type_t
|
||||||
{
|
{
|
||||||
|
|
|
@ -46,7 +46,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
namespace libtorrent
|
namespace libtorrent
|
||||||
{
|
{
|
||||||
struct udp_socket_observer
|
struct TORRENT_EXTRA_EXPORT udp_socket_observer
|
||||||
{
|
{
|
||||||
// return true if the packet was handled (it won't be
|
// return true if the packet was handled (it won't be
|
||||||
// propagated to the next observer)
|
// propagated to the next observer)
|
||||||
|
|
|
@ -33,6 +33,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#ifndef TORRENT_UNCORK_INTERFACE_HPP
|
#ifndef TORRENT_UNCORK_INTERFACE_HPP
|
||||||
#define TORRENT_UNCORK_INTERFACE_HPP
|
#define TORRENT_UNCORK_INTERFACE_HPP
|
||||||
|
|
||||||
|
#include "libtorrent/export.hpp"
|
||||||
|
|
||||||
namespace libtorrent
|
namespace libtorrent
|
||||||
{
|
{
|
||||||
// the uncork interface is used by the disk_io_thread
|
// the uncork interface is used by the disk_io_thread
|
||||||
|
@ -45,7 +47,7 @@ namespace libtorrent
|
||||||
// kernel per system call.
|
// kernel per system call.
|
||||||
// uncorking refers to releasing the "cork" in the peers
|
// uncorking refers to releasing the "cork" in the peers
|
||||||
// preventing them to issue sends
|
// preventing them to issue sends
|
||||||
struct uncork_interface
|
struct TORRENT_EXTRA_EXPORT uncork_interface
|
||||||
{
|
{
|
||||||
virtual void do_delayed_uncork() = 0;
|
virtual void do_delayed_uncork() = 0;
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -313,7 +313,7 @@ public:
|
||||||
m_connect_handler = handler;
|
m_connect_handler = handler;
|
||||||
do_connect(endpoint);
|
do_connect(endpoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class Mutable_Buffers, class Handler>
|
template <class Mutable_Buffers, class Handler>
|
||||||
void async_read_some(Mutable_Buffers const& buffers, Handler const& handler)
|
void async_read_some(Mutable_Buffers const& buffers, Handler const& handler)
|
||||||
{
|
{
|
||||||
|
@ -329,7 +329,7 @@ public:
|
||||||
m_io_service.post(boost::bind<void>(handler, boost::asio::error::operation_not_supported, 0));
|
m_io_service.post(boost::bind<void>(handler, boost::asio::error::operation_not_supported, 0));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int bytes_added = 0;
|
std::size_t bytes_added = 0;
|
||||||
for (typename Mutable_Buffers::const_iterator i = buffers.begin()
|
for (typename Mutable_Buffers::const_iterator i = buffers.begin()
|
||||||
, end(buffers.end()); i != end; ++i)
|
, end(buffers.end()); i != end; ++i)
|
||||||
{
|
{
|
||||||
|
@ -465,7 +465,7 @@ public:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bytes_added = 0;
|
std::size_t bytes_added = 0;
|
||||||
for (typename Const_Buffers::const_iterator i = buffers.begin()
|
for (typename Const_Buffers::const_iterator i = buffers.begin()
|
||||||
, end(buffers.end()); i != end; ++i)
|
, end(buffers.end()); i != end; ++i)
|
||||||
{
|
{
|
||||||
|
|
|
@ -463,6 +463,8 @@ namespace libtorrent
|
||||||
void disk_buffer_pool::set_settings(aux::session_settings const& sett
|
void disk_buffer_pool::set_settings(aux::session_settings const& sett
|
||||||
, error_code& ec)
|
, error_code& ec)
|
||||||
{
|
{
|
||||||
|
TORRENT_UNUSED(ec);
|
||||||
|
|
||||||
mutex::scoped_lock l(m_pool_mutex);
|
mutex::scoped_lock l(m_pool_mutex);
|
||||||
|
|
||||||
// 0 cache_buffer_chunk_size means 'automatic' (i.e.
|
// 0 cache_buffer_chunk_size means 'automatic' (i.e.
|
||||||
|
|
12
src/file.cpp
12
src/file.cpp
|
@ -309,10 +309,10 @@ namespace libtorrent
|
||||||
{
|
{
|
||||||
int bufs_size(file::iovec_t const* bufs, int num_bufs)
|
int bufs_size(file::iovec_t const* bufs, int num_bufs)
|
||||||
{
|
{
|
||||||
int size = 0;
|
std::size_t size = 0;
|
||||||
for (file::iovec_t const* i = bufs, *end(bufs + num_bufs); i < end; ++i)
|
for (file::iovec_t const* i = bufs, *end(bufs + num_bufs); i < end; ++i)
|
||||||
size += i->iov_len;
|
size += i->iov_len;
|
||||||
return size;
|
return int(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TORRENT_WINDOWS
|
#ifdef TORRENT_WINDOWS
|
||||||
|
@ -341,6 +341,8 @@ namespace libtorrent
|
||||||
ec.clear();
|
ec.clear();
|
||||||
#ifdef TORRENT_WINDOWS
|
#ifdef TORRENT_WINDOWS
|
||||||
|
|
||||||
|
TORRENT_UNUSED(flags);
|
||||||
|
|
||||||
#if TORRENT_USE_WSTRING && defined TORRENT_WINDOWS
|
#if TORRENT_USE_WSTRING && defined TORRENT_WINDOWS
|
||||||
#define GetFileAttributesEx_ GetFileAttributesExW
|
#define GetFileAttributesEx_ GetFileAttributesExW
|
||||||
std::wstring f = convert_to_wstring(inf);
|
std::wstring f = convert_to_wstring(inf);
|
||||||
|
@ -1546,7 +1548,7 @@ typedef struct _FILE_ALLOCATED_RANGE_BUFFER {
|
||||||
}
|
}
|
||||||
else if (ret == FALSE)
|
else if (ret == FALSE)
|
||||||
{
|
{
|
||||||
int error = GetLastError();
|
// int error = GetLastError();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1616,7 +1618,7 @@ typedef struct _FILE_ALLOCATED_RANGE_BUFFER {
|
||||||
|
|
||||||
void gather_copy(file::iovec_t const* bufs, int num_bufs, char* dst)
|
void gather_copy(file::iovec_t const* bufs, int num_bufs, char* dst)
|
||||||
{
|
{
|
||||||
int offset = 0;
|
std::size_t offset = 0;
|
||||||
for (int i = 0; i < num_bufs; ++i)
|
for (int i = 0; i < num_bufs; ++i)
|
||||||
{
|
{
|
||||||
memcpy(dst + offset, bufs[i].iov_base, bufs[i].iov_len);
|
memcpy(dst + offset, bufs[i].iov_base, bufs[i].iov_len);
|
||||||
|
@ -1626,7 +1628,7 @@ typedef struct _FILE_ALLOCATED_RANGE_BUFFER {
|
||||||
|
|
||||||
void scatter_copy(file::iovec_t const* bufs, int num_bufs, char const* src)
|
void scatter_copy(file::iovec_t const* bufs, int num_bufs, char const* src)
|
||||||
{
|
{
|
||||||
int offset = 0;
|
std::size_t offset = 0;
|
||||||
for (int i = 0; i < num_bufs; ++i)
|
for (int i = 0; i < num_bufs; ++i)
|
||||||
{
|
{
|
||||||
memcpy(bufs[i].iov_base, src + offset, bufs[i].iov_len);
|
memcpy(bufs[i].iov_base, src + offset, bufs[i].iov_len);
|
||||||
|
|
|
@ -56,14 +56,14 @@ namespace libtorrent
|
||||||
if (!st.name.empty())
|
if (!st.name.empty())
|
||||||
{
|
{
|
||||||
ret += "&dn=";
|
ret += "&dn=";
|
||||||
ret += escape_string(st.name.c_str(), st.name.length());
|
ret += escape_string(st.name.c_str(), int(st.name.length()));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<announce_entry> const& tr = handle.trackers();
|
std::vector<announce_entry> const& tr = handle.trackers();
|
||||||
for (std::vector<announce_entry>::const_iterator i = tr.begin(), end(tr.end()); i != end; ++i)
|
for (std::vector<announce_entry>::const_iterator i = tr.begin(), end(tr.end()); i != end; ++i)
|
||||||
{
|
{
|
||||||
ret += "&tr=";
|
ret += "&tr=";
|
||||||
ret += escape_string(i->url.c_str(), i->url.length());
|
ret += escape_string(i->url.c_str(), int(i->url.length()));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::set<std::string> seeds = handle.url_seeds();
|
std::set<std::string> seeds = handle.url_seeds();
|
||||||
|
@ -71,7 +71,7 @@ namespace libtorrent
|
||||||
, end(seeds.end()); i != end; ++i)
|
, end(seeds.end()); i != end; ++i)
|
||||||
{
|
{
|
||||||
ret += "&ws=";
|
ret += "&ws=";
|
||||||
ret += escape_string(i->c_str(), i->length());
|
ret += escape_string(i->c_str(), int(i->length()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Reference in New Issue