fix some warnings
This commit is contained in:
@@ -46,6 +46,10 @@ namespace libtorrent
|
|||||||
struct socket_job
|
struct socket_job
|
||||||
{
|
{
|
||||||
socket_job() : type(none), vec(NULL), recv_buf(NULL), buf_size(0) {}
|
socket_job() : type(none), vec(NULL), recv_buf(NULL), buf_size(0) {}
|
||||||
|
#if __cplusplus >= 201103L
|
||||||
|
socket_job(socket_job const& st) = default;
|
||||||
|
socket_job& operator=(socket_job const& st) = default;
|
||||||
|
#endif
|
||||||
|
|
||||||
enum job_type_t
|
enum job_type_t
|
||||||
{
|
{
|
||||||
|
@@ -144,6 +144,10 @@ namespace libtorrent
|
|||||||
|
|
||||||
struct has_block
|
struct has_block
|
||||||
{
|
{
|
||||||
|
#if __cplusplus >= 201103L
|
||||||
|
has_block(has_block const&) = default;
|
||||||
|
#endif
|
||||||
|
|
||||||
has_block(piece_block const& b): block(b) {}
|
has_block(piece_block const& b): block(b) {}
|
||||||
piece_block const& block;
|
piece_block const& block;
|
||||||
bool operator()(pending_block const& pb) const
|
bool operator()(pending_block const& pb) const
|
||||||
|
@@ -159,6 +159,10 @@ namespace libtorrent
|
|||||||
session_settings(std::string const& user_agent = "libtorrent/"
|
session_settings(std::string const& user_agent = "libtorrent/"
|
||||||
LIBTORRENT_VERSION);
|
LIBTORRENT_VERSION);
|
||||||
~session_settings();
|
~session_settings();
|
||||||
|
#if __cplusplus >= 201103L
|
||||||
|
session_settings(session_settings const& st) = default;
|
||||||
|
session_settings& operator=(session_settings const& st) = default;
|
||||||
|
#endif
|
||||||
|
|
||||||
// automatically set to the libtorrent version you're using in order to
|
// automatically set to the libtorrent version you're using in order to
|
||||||
// be forward binary compatible. This field should not be changed.
|
// be forward binary compatible. This field should not be changed.
|
||||||
|
@@ -509,10 +509,9 @@ namespace libtorrent
|
|||||||
// of normal bittorrent operation, since it will just send garbage
|
// of normal bittorrent operation, since it will just send garbage
|
||||||
// to peers and throw away all the data it downloads. It would end
|
// to peers and throw away all the data it downloads. It would end
|
||||||
// up being banned immediately
|
// up being banned immediately
|
||||||
class disabled_storage : public storage_interface, boost::noncopyable
|
class disabled_storage TORRENT_FINAL : public storage_interface, boost::noncopyable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
disabled_storage(int piece_size) : m_piece_size(piece_size) {}
|
|
||||||
virtual bool has_any_file(storage_error&) TORRENT_OVERRIDE { return false; }
|
virtual bool has_any_file(storage_error&) TORRENT_OVERRIDE { return false; }
|
||||||
virtual void set_file_priority(std::vector<boost::uint8_t> const&
|
virtual void set_file_priority(std::vector<boost::uint8_t> const&
|
||||||
, storage_error&) TORRENT_OVERRIDE {}
|
, storage_error&) TORRENT_OVERRIDE {}
|
||||||
@@ -531,15 +530,11 @@ namespace libtorrent
|
|||||||
, std::vector<std::string> const*
|
, std::vector<std::string> const*
|
||||||
, storage_error&) TORRENT_OVERRIDE { return false; }
|
, storage_error&) TORRENT_OVERRIDE { return false; }
|
||||||
virtual void write_resume_data(entry&, storage_error&) const TORRENT_OVERRIDE {}
|
virtual void write_resume_data(entry&, storage_error&) const TORRENT_OVERRIDE {}
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
int m_piece_size;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// this storage implementation always reads zeroes, and always discards
|
// this storage implementation always reads zeroes, and always discards
|
||||||
// anything written to it
|
// anything written to it
|
||||||
struct zero_storage : storage_interface
|
struct zero_storage TORRENT_FINAL : storage_interface
|
||||||
{
|
{
|
||||||
virtual void initialize(storage_error&) TORRENT_OVERRIDE {}
|
virtual void initialize(storage_error&) TORRENT_OVERRIDE {}
|
||||||
|
|
||||||
|
@@ -50,13 +50,13 @@ namespace libtorrent
|
|||||||
thread_pool() : m_num_threads(0) {}
|
thread_pool() : m_num_threads(0) {}
|
||||||
virtual ~thread_pool() {}
|
virtual ~thread_pool() {}
|
||||||
void stop() { set_num_threads(0, true); }
|
void stop() { set_num_threads(0, true); }
|
||||||
void set_num_threads(int i, bool wait = true)
|
void set_num_threads(int n, bool wait = true)
|
||||||
{
|
{
|
||||||
if (i == m_num_threads) return;
|
if (n == m_num_threads) return;
|
||||||
|
|
||||||
if (i > m_num_threads)
|
if (n > m_num_threads)
|
||||||
{
|
{
|
||||||
while (m_num_threads < i)
|
while (m_num_threads < n)
|
||||||
{
|
{
|
||||||
++m_num_threads;
|
++m_num_threads;
|
||||||
m_threads.push_back(boost::shared_ptr<thread>(
|
m_threads.push_back(boost::shared_ptr<thread>(
|
||||||
@@ -65,11 +65,15 @@ namespace libtorrent
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
while (m_num_threads > i) { --m_num_threads; }
|
while (m_num_threads > n) { --m_num_threads; }
|
||||||
mutex::scoped_lock l(m_mutex);
|
mutex::scoped_lock l(m_mutex);
|
||||||
m_cond.notify_all();
|
m_cond.notify_all();
|
||||||
l.unlock();
|
l.unlock();
|
||||||
if (wait) for (int i = m_num_threads; i < int(m_threads.size()); ++i) m_threads[i]->join();
|
if (wait)
|
||||||
|
{
|
||||||
|
for (int i = m_num_threads; i < int(m_threads.size()); ++i)
|
||||||
|
m_threads[i]->join();
|
||||||
|
}
|
||||||
// this will detach the threads
|
// this will detach the threads
|
||||||
m_threads.resize(m_num_threads);
|
m_threads.resize(m_num_threads);
|
||||||
}
|
}
|
||||||
|
@@ -83,6 +83,10 @@ namespace libtorrent
|
|||||||
announce_entry(std::string const& u);
|
announce_entry(std::string const& u);
|
||||||
announce_entry();
|
announce_entry();
|
||||||
~announce_entry();
|
~announce_entry();
|
||||||
|
#if __cplusplus >= 201103L
|
||||||
|
announce_entry(announce_entry const& st) = default;
|
||||||
|
announce_entry& operator=(announce_entry const& st) = default;
|
||||||
|
#endif
|
||||||
|
|
||||||
// tracker URL as it appeared in the torrent file
|
// tracker URL as it appeared in the torrent file
|
||||||
std::string url;
|
std::string url;
|
||||||
|
@@ -272,6 +272,10 @@ private:
|
|||||||
TORRENT_ASSERT(magic == 1337);
|
TORRENT_ASSERT(magic == 1337);
|
||||||
magic = 0;
|
magic = 0;
|
||||||
}
|
}
|
||||||
|
#if __cplusplus >= 201103L
|
||||||
|
rootdevice(rootdevice const& st) = default;
|
||||||
|
rootdevice& operator=(rootdevice const& st) = default;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// the interface url, through which the list of
|
// the interface url, through which the list of
|
||||||
|
@@ -39,6 +39,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#include "libtorrent/packet_buffer.hpp"
|
#include "libtorrent/packet_buffer.hpp"
|
||||||
#include "libtorrent/error_code.hpp"
|
#include "libtorrent/error_code.hpp"
|
||||||
|
|
||||||
|
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||||
|
|
||||||
#include <boost/bind.hpp>
|
#include <boost/bind.hpp>
|
||||||
#include <boost/function/function1.hpp>
|
#include <boost/function/function1.hpp>
|
||||||
#include <boost/function/function2.hpp>
|
#include <boost/function/function2.hpp>
|
||||||
@@ -47,6 +49,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#include <boost/system/system_error.hpp>
|
#include <boost/system/system_error.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
||||||
|
|
||||||
#define CCONTROL_TARGET 100
|
#define CCONTROL_TARGET 100
|
||||||
|
|
||||||
namespace libtorrent
|
namespace libtorrent
|
||||||
|
@@ -161,7 +161,23 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||||||
|
|
||||||
#define DEBUG_CACHE 0
|
#define DEBUG_CACHE 0
|
||||||
|
|
||||||
#define DLOG if (DEBUG_CACHE) fprintf
|
#if __cplusplus >= 201103L
|
||||||
|
|
||||||
|
#if DEBUG_CACHE
|
||||||
|
#define DLOG(...) fprintf(__VA_ARGS__)
|
||||||
|
#else
|
||||||
|
#define DLOG(...) do {} while (false)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#else // cplusplus
|
||||||
|
|
||||||
|
#if DEBUG_CACHE
|
||||||
|
#define DLOG fprintf
|
||||||
|
#else
|
||||||
|
#define DLOG TORRENT_WHILE_0 fprintf
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // cplusplus
|
||||||
|
|
||||||
namespace libtorrent {
|
namespace libtorrent {
|
||||||
|
|
||||||
|
@@ -33,11 +33,22 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#include <boost/version.hpp>
|
#include <boost/version.hpp>
|
||||||
|
|
||||||
#include "libtorrent/config.hpp"
|
#include "libtorrent/config.hpp"
|
||||||
|
|
||||||
|
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||||
|
|
||||||
#if defined TORRENT_OS2
|
#if defined TORRENT_OS2
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <boost/bind.hpp>
|
#include <boost/bind.hpp>
|
||||||
|
#include <boost/asio/ip/host_name.hpp>
|
||||||
|
#include <boost/asio/ip/multicast.hpp>
|
||||||
|
|
||||||
|
#ifdef TORRENT_WINDOWS
|
||||||
|
#include <iphlpapi.h> // for if_nametoindex
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
||||||
|
|
||||||
#include "libtorrent/socket.hpp"
|
#include "libtorrent/socket.hpp"
|
||||||
#include "libtorrent/enum_net.hpp"
|
#include "libtorrent/enum_net.hpp"
|
||||||
@@ -52,13 +63,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#include "libtorrent/socket_io.hpp"
|
#include "libtorrent/socket_io.hpp"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <boost/asio/ip/host_name.hpp>
|
|
||||||
#include <boost/asio/ip/multicast.hpp>
|
|
||||||
|
|
||||||
#ifdef TORRENT_WINDOWS
|
|
||||||
#include <iphlpapi.h> // for if_nametoindex
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace libtorrent
|
namespace libtorrent
|
||||||
{
|
{
|
||||||
bool is_local(address const& a)
|
bool is_local(address const& a)
|
||||||
|
@@ -60,12 +60,24 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||||||
|
|
||||||
#define DEBUG_DISK_THREAD 0
|
#define DEBUG_DISK_THREAD 0
|
||||||
|
|
||||||
|
#if __cplusplus >= 201103L
|
||||||
|
|
||||||
|
#if DEBUG_DISK_THREAD
|
||||||
|
#define DLOG(...) debug_log(__VA_ARGS__)
|
||||||
|
#else
|
||||||
|
#define DLOG(...) do {} while(false)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
#if DEBUG_DISK_THREAD
|
#if DEBUG_DISK_THREAD
|
||||||
#define DLOG debug_log
|
#define DLOG debug_log
|
||||||
#else
|
#else
|
||||||
#define DLOG TORRENT_WHILE_0 debug_log
|
#define DLOG TORRENT_WHILE_0 debug_log
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif // cplusplus
|
||||||
|
|
||||||
namespace libtorrent
|
namespace libtorrent
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@@ -90,6 +90,22 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#define DEBUG_STORAGE 0
|
#define DEBUG_STORAGE 0
|
||||||
#define DEBUG_DELETE_FILES 0
|
#define DEBUG_DELETE_FILES 0
|
||||||
|
|
||||||
|
#if __cplusplus >= 201103L
|
||||||
|
|
||||||
|
#if DEBUG_STORAGE
|
||||||
|
#define DLOG(...) fprintf(__VA_ARGS__)
|
||||||
|
#else
|
||||||
|
#define DLOG(...) do {} while (false)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if DEBUG_DELETE_FILES
|
||||||
|
#define DFLOG(...) fprintf(__VA_ARGS__)
|
||||||
|
#else
|
||||||
|
#define DFLOG(...) do {} while (false)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
#if DEBUG_STORAGE
|
#if DEBUG_STORAGE
|
||||||
#define DLOG fprintf
|
#define DLOG fprintf
|
||||||
#else
|
#else
|
||||||
@@ -102,6 +118,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#define DFLOG TORRENT_WHILE_0 fprintf
|
#define DFLOG TORRENT_WHILE_0 fprintf
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif // cplusplus
|
||||||
|
|
||||||
namespace libtorrent
|
namespace libtorrent
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -1389,7 +1407,7 @@ namespace libtorrent
|
|||||||
|
|
||||||
storage_interface* disabled_storage_constructor(storage_params const& params)
|
storage_interface* disabled_storage_constructor(storage_params const& params)
|
||||||
{
|
{
|
||||||
return new disabled_storage(params.files->piece_length());
|
return new disabled_storage;
|
||||||
}
|
}
|
||||||
|
|
||||||
// -- zero_storage ------------------------------------------------------
|
// -- zero_storage ------------------------------------------------------
|
||||||
|
@@ -132,14 +132,14 @@ namespace libtorrent
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
torrent_peer::torrent_peer(boost::uint16_t port, bool conn, int src)
|
torrent_peer::torrent_peer(boost::uint16_t port_, bool conn, int src)
|
||||||
: prev_amount_upload(0)
|
: prev_amount_upload(0)
|
||||||
, prev_amount_download(0)
|
, prev_amount_download(0)
|
||||||
, connection(0)
|
, connection(0)
|
||||||
, peer_rank(0)
|
, peer_rank(0)
|
||||||
, last_optimistically_unchoked(0)
|
, last_optimistically_unchoked(0)
|
||||||
, last_connected(0)
|
, last_connected(0)
|
||||||
, port(port)
|
, port(port_)
|
||||||
, hashfails(0)
|
, hashfails(0)
|
||||||
, failcount(0)
|
, failcount(0)
|
||||||
, connectable(conn)
|
, connectable(conn)
|
||||||
|
@@ -45,10 +45,15 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#include "libtorrent/debug.hpp"
|
#include "libtorrent/debug.hpp"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||||
|
|
||||||
#include <boost/bind.hpp>
|
#include <boost/bind.hpp>
|
||||||
#include <boost/ref.hpp>
|
#include <boost/ref.hpp>
|
||||||
#include <boost/asio/ip/host_name.hpp>
|
#include <boost/asio/ip/host_name.hpp>
|
||||||
#include <boost/asio/ip/multicast.hpp>
|
#include <boost/asio/ip/multicast.hpp>
|
||||||
|
|
||||||
|
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
namespace libtorrent {
|
namespace libtorrent {
|
||||||
|
@@ -95,9 +95,18 @@ void utp_log(char const* fmt, ...)
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
#if __cplusplus >= 201103L
|
||||||
|
|
||||||
|
#define UTP_LOG(...) do {} while(false)
|
||||||
|
#define UTP_LOGV(...) do {} while(false)
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
#define UTP_LOG TORRENT_WHILE_0 printf
|
#define UTP_LOG TORRENT_WHILE_0 printf
|
||||||
#define UTP_LOGV TORRENT_WHILE_0 printf
|
#define UTP_LOGV TORRENT_WHILE_0 printf
|
||||||
|
|
||||||
|
#endif // cplusplus
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
enum
|
enum
|
||||||
|
Reference in New Issue
Block a user