forked from premiere/premiere-libtorrent
fix some more coverity issues and add more todo comments
This commit is contained in:
parent
8fdacf9534
commit
f90537c52d
|
@ -4,7 +4,8 @@
|
|||
#include <algorithm> // for std::max
|
||||
|
||||
session_view::session_view()
|
||||
: m_print_utp_stats(false)
|
||||
: m_position(0)
|
||||
, m_print_utp_stats(false)
|
||||
{
|
||||
using libtorrent::find_metric_idx;
|
||||
|
||||
|
|
|
@ -1143,7 +1143,8 @@ namespace libtorrent
|
|||
// shutting down. This list is just here to keep them alive during
|
||||
// whe shutting down process
|
||||
std::list<boost::shared_ptr<tracker_logger> > m_tracker_loggers;
|
||||
|
||||
#endif
|
||||
#ifdef TORRENT_REQUEST_LOGGING
|
||||
FILE* m_request_logger;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -37,6 +37,10 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/stringize.hpp>
|
||||
|
||||
// TODO: 2 instead of using a dummy function to cause link errors when
|
||||
// incompatible build configurations are used, make the namespace name
|
||||
// depend on the configuration, and have a using declaration in the headers
|
||||
// to pull it into libtorrent.
|
||||
#if TORRENT_USE_IPV6
|
||||
#define TORRENT_CFG_IPV6 ipv6_
|
||||
#else
|
||||
|
|
|
@ -111,8 +111,9 @@ namespace libtorrent
|
|||
{ return m_buf == 0? 0: &disk_buffer_holder::release; }
|
||||
|
||||
private:
|
||||
// explicitly disallow assignment, to silence msvc warning
|
||||
// non-copyable
|
||||
disk_buffer_holder& operator=(disk_buffer_holder const&);
|
||||
disk_buffer_holder(disk_buffer_holder const*);
|
||||
|
||||
buffer_allocator_interface& m_allocator;
|
||||
char* m_buf;
|
||||
|
|
|
@ -70,8 +70,7 @@ namespace libtorrent
|
|||
io_service& ios
|
||||
, tracker_manager& man
|
||||
, tracker_request const& req
|
||||
, boost::weak_ptr<request_callback> c
|
||||
);
|
||||
, boost::weak_ptr<request_callback> c);
|
||||
|
||||
void start();
|
||||
void close();
|
||||
|
|
|
@ -45,12 +45,13 @@ namespace libtorrent
|
|||
|
||||
struct socket_job
|
||||
{
|
||||
socket_job() : vec(NULL), recv_buf(NULL), buf_size(0) {}
|
||||
socket_job() : vec(NULL), recv_buf(NULL), buf_size(0), type(none) {}
|
||||
|
||||
enum job_type_t
|
||||
{
|
||||
read_job = 0,
|
||||
write_job
|
||||
write_job,
|
||||
none
|
||||
};
|
||||
|
||||
job_type_t type;
|
||||
|
|
|
@ -121,12 +121,9 @@ namespace libtorrent
|
|||
struct TORRENT_EXTRA_EXPORT rc4_handler : crypto_plugin
|
||||
{
|
||||
public:
|
||||
// Input longkeys must be 20 bytes
|
||||
rc4_handler()
|
||||
: m_encrypt(false)
|
||||
, m_decrypt(false)
|
||||
{}
|
||||
rc4_handler();
|
||||
|
||||
// Input keys must be 20 bytes
|
||||
void set_incoming_key(unsigned char const* key, int len);
|
||||
void set_outgoing_key(unsigned char const* key, int len);
|
||||
|
||||
|
|
|
@ -186,7 +186,6 @@ namespace libtorrent
|
|||
, int flags = start_default_features | add_default_plugins)
|
||||
{
|
||||
TORRENT_CFG();
|
||||
init();
|
||||
start(flags, pack);
|
||||
}
|
||||
session(fingerprint const& print = fingerprint("LT"
|
||||
|
@ -196,6 +195,9 @@ namespace libtorrent
|
|||
{
|
||||
TORRENT_CFG();
|
||||
settings_pack pack;
|
||||
// TODO: 2 the two second constructors here should probably
|
||||
// be deprecated in favor of the more generic one that just
|
||||
// takes a settings_pack and a string
|
||||
pack.set_int(settings_pack::alert_mask, alert_mask);
|
||||
pack.set_str(settings_pack::peer_fingerprint, print.to_string());
|
||||
if ((flags & start_default_features) == 0)
|
||||
|
@ -206,7 +208,6 @@ namespace libtorrent
|
|||
pack.set_bool(settings_pack::enable_dht, false);
|
||||
}
|
||||
|
||||
init();
|
||||
start(flags, pack);
|
||||
}
|
||||
session(fingerprint const& print
|
||||
|
@ -234,7 +235,6 @@ namespace libtorrent
|
|||
pack.set_bool(settings_pack::enable_lsd, false);
|
||||
pack.set_bool(settings_pack::enable_dht, false);
|
||||
}
|
||||
init();
|
||||
start(flags, pack);
|
||||
}
|
||||
|
||||
|
@ -1218,7 +1218,6 @@ namespace libtorrent
|
|||
|
||||
private:
|
||||
|
||||
void init();
|
||||
void start(int flags, settings_pack const& pack);
|
||||
|
||||
// data shared between the main thread
|
||||
|
|
|
@ -41,6 +41,8 @@ namespace libtorrent
|
|||
: m_allocator(alloc), m_buf(buf)
|
||||
{
|
||||
m_ref.storage = 0;
|
||||
m_ref.piece = -1;
|
||||
m_ref.block = -1;
|
||||
}
|
||||
|
||||
disk_buffer_holder::disk_buffer_holder(buffer_allocator_interface& alloc, disk_io_job const& j)
|
||||
|
|
|
@ -74,6 +74,9 @@ namespace libtorrent
|
|||
, boost::weak_ptr<request_callback> c)
|
||||
: tracker_connection(man, req, ios, c)
|
||||
, m_man(man)
|
||||
#if TORRENT_USE_I2P
|
||||
, m_i2p_conn(NULL)
|
||||
#endif
|
||||
{}
|
||||
|
||||
void http_tracker_connection::start()
|
||||
|
|
|
@ -92,7 +92,8 @@ namespace libtorrent
|
|||
}
|
||||
|
||||
i2p_connection::i2p_connection(io_service& ios)
|
||||
: m_state(sam_idle)
|
||||
: m_port(0)
|
||||
, m_state(sam_idle)
|
||||
, m_io_service(ios)
|
||||
{}
|
||||
|
||||
|
|
|
@ -264,6 +264,16 @@ namespace libtorrent
|
|||
recv_buffer.crypto_reset(packet_size);
|
||||
}
|
||||
|
||||
rc4_handler::rc4_handler()
|
||||
: m_encrypt(false)
|
||||
, m_decrypt(false)
|
||||
{
|
||||
m_rc4_incoming.x = 0;
|
||||
m_rc4_incoming.y = 0;
|
||||
m_rc4_outgoing.x = 0;
|
||||
m_rc4_outgoing.y = 0;
|
||||
}
|
||||
|
||||
void rc4_handler::set_incoming_key(unsigned char const* key, int len)
|
||||
{
|
||||
m_decrypt = true;
|
||||
|
|
|
@ -388,7 +388,7 @@ namespace libtorrent
|
|||
{ throw; }
|
||||
#endif
|
||||
|
||||
void session::init()
|
||||
void session::start(int flags, settings_pack const& pack)
|
||||
{
|
||||
#if defined _MSC_VER && defined TORRENT_DEBUG
|
||||
// workaround for microsofts
|
||||
|
@ -398,10 +398,6 @@ namespace libtorrent
|
|||
#endif
|
||||
|
||||
m_impl.reset(new session_impl());
|
||||
}
|
||||
|
||||
void session::start(int flags, settings_pack const& pack)
|
||||
{
|
||||
#ifndef TORRENT_DISABLE_EXTENSIONS
|
||||
if (flags & add_default_plugins)
|
||||
{
|
||||
|
|
|
@ -357,6 +357,9 @@ namespace aux {
|
|||
#else
|
||||
, m_upload_rate(peer_connection::upload_channel)
|
||||
#endif
|
||||
, m_global_class(0)
|
||||
, m_tcp_peer_class(0)
|
||||
, m_local_peer_class(0)
|
||||
, m_tracker_manager(m_udp_socket, m_stats_counters, m_host_resolver
|
||||
, m_ip_filter, m_settings
|
||||
#if !defined TORRENT_DISABLE_LOGGING || TORRENT_USE_ASSERTS
|
||||
|
@ -392,6 +395,7 @@ namespace aux {
|
|||
#ifndef TORRENT_NO_DEPRECATE
|
||||
, m_next_rss_update(min_time())
|
||||
#endif
|
||||
, m_next_port(0)
|
||||
#ifndef TORRENT_DISABLE_DHT
|
||||
, m_dht_announce_timer(m_io_service)
|
||||
, m_dht_interval_update_torrents(0)
|
||||
|
@ -410,7 +414,10 @@ namespace aux {
|
|||
, m_timer(m_io_service)
|
||||
, m_lsd_announce_timer(m_io_service)
|
||||
, m_host_resolver(m_io_service)
|
||||
, m_next_downloading_connect_torrent(0)
|
||||
, m_next_finished_connect_torrent(0)
|
||||
, m_download_connect_attempts(0)
|
||||
, m_next_scrape_torrent(0)
|
||||
, m_tick_residual(0)
|
||||
, m_deferred_submit_disk_jobs(false)
|
||||
, m_pending_auto_manage(false)
|
||||
|
@ -435,6 +442,8 @@ namespace aux {
|
|||
m_ssl_udp_socket.subscribe(this);
|
||||
#endif
|
||||
|
||||
// TODO: 3 remove REQUESST_LOGGING build configuration. Make sure the
|
||||
// same information can be logged via alerts
|
||||
#ifdef TORRENT_REQUEST_LOGGING
|
||||
char log_filename[200];
|
||||
#ifdef TORRENT_WINDOWS
|
||||
|
@ -478,10 +487,6 @@ namespace aux {
|
|||
m_next_dht_torrent = m_torrents.begin();
|
||||
#endif
|
||||
m_next_lsd_torrent = m_torrents.begin();
|
||||
m_next_downloading_connect_torrent = 0;
|
||||
m_next_finished_connect_torrent = 0;
|
||||
m_next_scrape_torrent = 0;
|
||||
|
||||
m_tcp_mapping[0] = -1;
|
||||
m_tcp_mapping[1] = -1;
|
||||
m_udp_mapping[0] = -1;
|
||||
|
|
|
@ -134,6 +134,8 @@ namespace libtorrent
|
|||
{
|
||||
peer_info.web_seed = true;
|
||||
restart_request.piece = -1;
|
||||
restart_request.start = -1;
|
||||
restart_request.length = -1;
|
||||
}
|
||||
|
||||
web_seed_t::web_seed_t(std::string const& url_, web_seed_entry::type_t type_
|
||||
|
@ -148,6 +150,8 @@ namespace libtorrent
|
|||
{
|
||||
peer_info.web_seed = true;
|
||||
restart_request.piece = -1;
|
||||
restart_request.start = -1;
|
||||
restart_request.length = -1;
|
||||
}
|
||||
|
||||
#ifndef TORRENT_DISABLE_EXTENSIONS
|
||||
|
@ -266,6 +270,7 @@ namespace libtorrent
|
|||
, m_downloaded(0xffffff)
|
||||
, m_last_scrape((std::numeric_limits<boost::int16_t>::min)())
|
||||
, m_progress_ppm(0)
|
||||
, m_last_active_change(0)
|
||||
, m_use_resume_save_path(p.flags & add_torrent_params::flag_use_resume_save_path)
|
||||
{
|
||||
if (m_pinned)
|
||||
|
|
Loading…
Reference in New Issue