use override and final keywords (unconditionally) (#668)

use override and final keywords instead of macros.
This commit is contained in:
Arvid Norberg 2016-04-30 11:05:54 -04:00
parent f856b6bbe3
commit 4e97bf556c
29 changed files with 591 additions and 505 deletions

View File

@ -163,6 +163,107 @@ dict session_stats_values(session_stats_alert const& alert)
return d; return d;
} }
namespace boost
{
// some older compilers (like msvc-12.0) end up using
// boost::is_polymorphic inside boost.python applied
// to alert types. This is problematic, since it appears
// to be implemented by deriving from the type, which
// yields a compiler error since most alerts are final.
// this just short-cuts the query to say that all these
// types are indeed polymorphic, no need to derive from
// them.
#define POLY(x) template<> \
struct is_polymorphic<libtorrent:: x > : boost::mpl::true_ {};
POLY(torrent_alert)
POLY(tracker_alert)
POLY(torrent_added_alert)
POLY(torrent_removed_alert)
POLY(read_piece_alert)
POLY(peer_alert)
POLY(tracker_error_alert)
POLY(tracker_warning_alert)
POLY(tracker_reply_alert)
POLY(tracker_announce_alert)
POLY(hash_failed_alert)
POLY(peer_ban_alert)
POLY(peer_error_alert)
POLY(invalid_request_alert)
POLY(torrent_error_alert)
POLY(torrent_finished_alert)
POLY(piece_finished_alert)
POLY(block_finished_alert)
POLY(block_downloading_alert)
POLY(storage_moved_alert)
POLY(storage_moved_failed_alert)
POLY(torrent_deleted_alert)
POLY(torrent_paused_alert)
POLY(torrent_checked_alert)
POLY(url_seed_alert)
POLY(file_error_alert)
POLY(metadata_failed_alert)
POLY(metadata_received_alert)
POLY(listen_failed_alert)
POLY(listen_succeeded_alert)
POLY(portmap_error_alert)
POLY(portmap_alert)
POLY(fastresume_rejected_alert)
POLY(peer_blocked_alert)
POLY(scrape_reply_alert)
POLY(scrape_failed_alert)
POLY(udp_error_alert)
POLY(external_ip_alert)
POLY(save_resume_data_alert)
POLY(file_completed_alert)
POLY(file_renamed_alert)
POLY(file_rename_failed_alert)
POLY(torrent_resumed_alert)
POLY(state_changed_alert)
POLY(state_update_alert)
POLY(i2p_alert)
POLY(dht_reply_alert)
POLY(dht_announce_alert)
POLY(dht_get_peers_alert)
POLY(peer_unsnubbed_alert)
POLY(peer_snubbed_alert)
POLY(peer_connect_alert)
POLY(peer_disconnected_alert)
POLY(request_dropped_alert)
POLY(block_timeout_alert)
POLY(unwanted_block_alert)
POLY(torrent_delete_failed_alert)
POLY(save_resume_data_failed_alert)
POLY(performance_alert)
POLY(stats_alert)
POLY(anonymous_mode_alert)
POLY(incoming_connection_alert)
POLY(torrent_need_cert_alert)
POLY(add_torrent_alert)
POLY(dht_outgoing_get_peers_alert)
POLY(lsd_error_alert)
POLY(dht_stats_alert)
POLY(dht_immutable_item_alert)
POLY(dht_mutable_item_alert)
POLY(dht_put_alert)
POLY(session_stats_alert)
POLY(dht_get_peers_reply_alert)
#ifndef TORRENT_NO_DEPRECATE
POLY(torrent_update_alert)
#endif
#ifndef TORRENT_DISABLE_LOGGING
POLY(portmap_log_alert)
POLY(log_alert)
POLY(torrent_log_alert)
POLY(peer_log_alert)
POLY(picker_log_alert)
#endif // TORRENT_DISABLE_LOGGING
#undef POLY
}
void bind_alert() void bind_alert()
{ {
using boost::noncopyable; using boost::noncopyable;

View File

@ -149,7 +149,6 @@ def is_visible(desc):
return True return True
def highlight_signature(s): def highlight_signature(s):
s = s.replace('TORRENT_OVERRIDE', 'override').replace('TORRENT_FINAL', 'final')
name = s.split('(', 1) name = s.split('(', 1)
name2 = name[0].split(' ') name2 = name[0].split(' ')
if len(name2[-1]) == 0: return s if len(name2[-1]) == 0: return s
@ -274,7 +273,6 @@ def parse_class(lno, lines, filename):
state = 'private' state = 'private'
class_type = 'class' class_type = 'class'
decl = decl.replace('TORRENT_FINAL', 'final')
name = decl.split(':')[0].replace('class ', '').replace('struct ', '').replace('final', '').strip() name = decl.split(':')[0].replace('class ', '').replace('struct ', '').replace('final', '').strip()

File diff suppressed because it is too large Load Diff

View File

@ -186,7 +186,7 @@ namespace libtorrent
// this is the link between the main thread and the // this is the link between the main thread and the
// thread started to run the main downloader loop // thread started to run the main downloader loop
struct TORRENT_EXTRA_EXPORT session_impl TORRENT_FINAL struct TORRENT_EXTRA_EXPORT session_impl final
: session_interface : session_interface
, dht::dht_observer , dht::dht_observer
, boost::noncopyable , boost::noncopyable
@ -224,10 +224,10 @@ namespace libtorrent
void add_ses_extension(boost::shared_ptr<plugin> ext); void add_ses_extension(boost::shared_ptr<plugin> ext);
#endif #endif
#if TORRENT_USE_ASSERTS #if TORRENT_USE_ASSERTS
bool has_peer(peer_connection const* p) const TORRENT_OVERRIDE; bool has_peer(peer_connection const* p) const override;
bool any_torrent_has_peer(peer_connection const* p) const TORRENT_OVERRIDE; bool any_torrent_has_peer(peer_connection const* p) const override;
bool is_single_thread() const TORRENT_OVERRIDE { return single_threaded::is_single_thread(); } bool is_single_thread() const override { return single_threaded::is_single_thread(); }
bool is_posting_torrent_updates() const TORRENT_OVERRIDE { return m_posting_torrent_updates; } bool is_posting_torrent_updates() const override { return m_posting_torrent_updates; }
// this is set while the session is building the // this is set while the session is building the
// torrent status update message // torrent status update message
bool m_posting_torrent_updates; bool m_posting_torrent_updates;
@ -235,15 +235,15 @@ namespace libtorrent
void reopen_listen_sockets(); void reopen_listen_sockets();
torrent_peer_allocator_interface* get_peer_allocator() TORRENT_OVERRIDE torrent_peer_allocator_interface* get_peer_allocator() override
{ return &m_peer_allocator; } { return &m_peer_allocator; }
io_service& get_io_service() TORRENT_OVERRIDE { return m_io_service; } io_service& get_io_service() override { return m_io_service; }
resolver_interface& get_resolver() TORRENT_OVERRIDE { return m_host_resolver; } resolver_interface& get_resolver() override { return m_host_resolver; }
void async_resolve(std::string const& host, int flags void async_resolve(std::string const& host, int flags
, callback_t const& h) TORRENT_OVERRIDE; , callback_t const& h) override;
std::vector<torrent*>& torrent_list(int i) TORRENT_OVERRIDE std::vector<torrent*>& torrent_list(int i) override
{ {
TORRENT_ASSERT(i >= 0); TORRENT_ASSERT(i >= 0);
TORRENT_ASSERT(i < session_interface::num_torrent_lists); TORRENT_ASSERT(i < session_interface::num_torrent_lists);
@ -254,10 +254,10 @@ namespace libtorrent
// attempts, because this torrent needs more peers. // attempts, because this torrent needs more peers.
// this is typically done when a torrent starts out and // this is typically done when a torrent starts out and
// need the initial push to connect peers // need the initial push to connect peers
void prioritize_connections(boost::weak_ptr<torrent> t) TORRENT_OVERRIDE; void prioritize_connections(boost::weak_ptr<torrent> t) override;
tcp::endpoint get_ipv6_interface() const TORRENT_OVERRIDE; tcp::endpoint get_ipv6_interface() const override;
tcp::endpoint get_ipv4_interface() const TORRENT_OVERRIDE; tcp::endpoint get_ipv4_interface() const override;
void async_accept(boost::shared_ptr<tcp::acceptor> const& listener, bool ssl); void async_accept(boost::shared_ptr<tcp::acceptor> const& listener, bool ssl);
void on_accept_connection(boost::shared_ptr<socket_type> const& s void on_accept_connection(boost::shared_ptr<socket_type> const& s
@ -267,49 +267,49 @@ namespace libtorrent
void incoming_connection(boost::shared_ptr<socket_type> const& s); void incoming_connection(boost::shared_ptr<socket_type> const& s);
boost::weak_ptr<torrent> find_torrent(sha1_hash const& info_hash) const TORRENT_OVERRIDE; boost::weak_ptr<torrent> find_torrent(sha1_hash const& info_hash) const override;
#ifndef TORRENT_NO_DEPRECATE #ifndef TORRENT_NO_DEPRECATE
//deprecated in 1.2 //deprecated in 1.2
boost::weak_ptr<torrent> find_torrent(std::string const& uuid) const; boost::weak_ptr<torrent> find_torrent(std::string const& uuid) const;
#endif #endif
#ifndef TORRENT_DISABLE_MUTABLE_TORRENTS #ifndef TORRENT_DISABLE_MUTABLE_TORRENTS
std::vector<boost::shared_ptr<torrent> > find_collection( std::vector<boost::shared_ptr<torrent> > find_collection(
std::string const& collection) const TORRENT_OVERRIDE; std::string const& collection) const override;
#endif #endif
boost::weak_ptr<torrent> find_disconnect_candidate_torrent() const TORRENT_OVERRIDE; boost::weak_ptr<torrent> find_disconnect_candidate_torrent() const override;
int num_torrents() const TORRENT_OVERRIDE { return int(m_torrents.size()); } int num_torrents() const override { 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) TORRENT_OVERRIDE; , std::string uuid) override;
#ifndef TORRENT_NO_DEPRECATE #ifndef TORRENT_NO_DEPRECATE
//deprecated in 1.2 //deprecated in 1.2
void insert_uuid_torrent(std::string uuid, boost::shared_ptr<torrent> const& t) TORRENT_OVERRIDE void insert_uuid_torrent(std::string uuid, boost::shared_ptr<torrent> const& t) override
{ m_uuids.insert(std::make_pair(uuid, t)); } { m_uuids.insert(std::make_pair(uuid, t)); }
#endif #endif
boost::shared_ptr<torrent> delay_load_torrent(sha1_hash const& info_hash boost::shared_ptr<torrent> delay_load_torrent(sha1_hash const& info_hash
, peer_connection* pc) TORRENT_OVERRIDE; , peer_connection* pc) override;
void set_queue_position(torrent* t, int p) TORRENT_OVERRIDE; void set_queue_position(torrent* t, int p) override;
peer_id const& get_peer_id() const TORRENT_OVERRIDE { return m_peer_id; } peer_id const& get_peer_id() const override { return m_peer_id; }
void close_connection(peer_connection* p, error_code const& ec) TORRENT_OVERRIDE; void close_connection(peer_connection* p, error_code const& ec) override;
#ifndef TORRENT_NO_DEPRECATE #ifndef TORRENT_NO_DEPRECATE
void set_settings(libtorrent::session_settings const& s); void set_settings(libtorrent::session_settings const& s);
libtorrent::session_settings deprecated_settings() const; libtorrent::session_settings deprecated_settings() const;
#endif #endif
void apply_settings_pack(boost::shared_ptr<settings_pack> pack) TORRENT_OVERRIDE; void apply_settings_pack(boost::shared_ptr<settings_pack> pack) override;
void apply_settings_pack_impl(settings_pack const& pack); void apply_settings_pack_impl(settings_pack const& pack);
session_settings const& settings() const TORRENT_OVERRIDE { return m_settings; } session_settings const& settings() const override { return m_settings; }
settings_pack get_settings() const; settings_pack get_settings() const;
#ifndef TORRENT_DISABLE_DHT #ifndef TORRENT_DISABLE_DHT
dht::dht_tracker* dht() TORRENT_OVERRIDE { return m_dht.get(); } dht::dht_tracker* dht() override { return m_dht.get(); }
bool announce_dht() const TORRENT_OVERRIDE { return !m_listen_sockets.empty(); } bool announce_dht() const override { return !m_listen_sockets.empty(); }
void add_dht_node_name(std::pair<std::string, int> const& node); void add_dht_node_name(std::pair<std::string, int> const& node);
void add_dht_node(udp::endpoint n) TORRENT_OVERRIDE; void add_dht_node(udp::endpoint n) override;
void add_dht_router(std::pair<std::string, int> const& node); void add_dht_router(std::pair<std::string, int> const& node);
void set_dht_settings(dht_settings const& s); void set_dht_settings(dht_settings const& s);
dht_settings const& get_dht_settings() const { return m_dht_settings; } dht_settings const& get_dht_settings() const { return m_dht_settings; }
@ -317,12 +317,12 @@ namespace libtorrent
void start_dht(); void start_dht();
void stop_dht(); void stop_dht();
void start_dht(entry const& startup_state); void start_dht(entry const& startup_state);
bool has_dht() const TORRENT_OVERRIDE; bool has_dht() const override;
// this is called for torrents when they are started // this is called for torrents when they are started
// it will prioritize them for announcing to // it will prioritize them for announcing to
// the DHT, to get the initial peers quickly // the DHT, to get the initial peers quickly
void prioritize_dht(boost::weak_ptr<torrent> t) TORRENT_OVERRIDE; void prioritize_dht(boost::weak_ptr<torrent> t) override;
void get_immutable_callback(sha1_hash target void get_immutable_callback(sha1_hash target
, dht::item const& i); , dht::item const& i);
@ -358,9 +358,9 @@ namespace libtorrent
#if !defined(TORRENT_DISABLE_ENCRYPTION) && !defined(TORRENT_DISABLE_EXTENSIONS) #if !defined(TORRENT_DISABLE_ENCRYPTION) && !defined(TORRENT_DISABLE_EXTENSIONS)
torrent const* find_encrypted_torrent( torrent const* find_encrypted_torrent(
sha1_hash const& info_hash, sha1_hash const& xor_mask) TORRENT_OVERRIDE; sha1_hash const& info_hash, sha1_hash const& xor_mask) override;
void add_obfuscated_hash(sha1_hash const& obfuscated, boost::weak_ptr<torrent> const& t) TORRENT_OVERRIDE; void add_obfuscated_hash(sha1_hash const& obfuscated, boost::weak_ptr<torrent> const& t) override;
#endif #endif
void on_port_map_log(char const* msg, int map_transport); void on_port_map_log(char const* msg, int map_transport);
@ -375,8 +375,8 @@ namespace libtorrent
void on_port_mapping(int mapping, address const& ip, int port void on_port_mapping(int mapping, address const& ip, int port
, int protocol, error_code const& ec, int nat_transport); , int protocol, error_code const& ec, int nat_transport);
bool is_aborted() const TORRENT_OVERRIDE { return m_abort; } bool is_aborted() const override { return m_abort; }
bool is_paused() const TORRENT_OVERRIDE { return m_paused; } bool is_paused() const override { return m_paused; }
void pause(); void pause();
void resume(); void resume();
@ -385,22 +385,22 @@ namespace libtorrent
ip_filter const& get_ip_filter(); ip_filter const& get_ip_filter();
void set_port_filter(port_filter const& f); void set_port_filter(port_filter const& f);
port_filter const& get_port_filter() const TORRENT_OVERRIDE; port_filter const& get_port_filter() const override;
void ban_ip(address addr) TORRENT_OVERRIDE; void ban_ip(address addr) override;
void queue_tracker_request(tracker_request& req void queue_tracker_request(tracker_request& req
, boost::weak_ptr<request_callback> c) TORRENT_OVERRIDE; , boost::weak_ptr<request_callback> c) override;
// ==== peer class operations ==== // ==== peer class operations ====
// implements session_interface // implements session_interface
void set_peer_classes(peer_class_set* s, address const& a, int st) TORRENT_OVERRIDE; void set_peer_classes(peer_class_set* s, address const& a, int st) override;
peer_class_pool const& peer_classes() const TORRENT_OVERRIDE { return m_classes; } peer_class_pool const& peer_classes() const override { return m_classes; }
peer_class_pool& peer_classes() TORRENT_OVERRIDE { return m_classes; } peer_class_pool& peer_classes() override { return m_classes; }
bool ignore_unchoke_slots_set(peer_class_set const& set) const TORRENT_OVERRIDE; bool ignore_unchoke_slots_set(peer_class_set const& set) const override;
int copy_pertinent_channels(peer_class_set const& set int copy_pertinent_channels(peer_class_set const& set
, int channel, bandwidth_channel** dst, int max) TORRENT_OVERRIDE; , int channel, bandwidth_channel** dst, int max) override;
int use_quota_overhead(peer_class_set& set, int amount_down, int amount_up) TORRENT_OVERRIDE; int use_quota_overhead(peer_class_set& set, int amount_down, int amount_up) override;
bool use_quota_overhead(bandwidth_channel* ch, int amount); bool use_quota_overhead(bandwidth_channel* ch, int amount);
int create_peer_class(char const* name); int create_peer_class(char const* name);
@ -426,8 +426,8 @@ namespace libtorrent
void async_add_torrent(add_torrent_params* params); void async_add_torrent(add_torrent_params* params);
void on_async_load_torrent(disk_io_job const* j); void on_async_load_torrent(disk_io_job const* j);
void remove_torrent(torrent_handle const& h, int options) TORRENT_OVERRIDE; void remove_torrent(torrent_handle const& h, int options) override;
void remove_torrent_impl(boost::shared_ptr<torrent> tptr, int options) TORRENT_OVERRIDE; void remove_torrent_impl(boost::shared_ptr<torrent> tptr, int options) override;
void get_torrent_status(std::vector<torrent_status>* ret void get_torrent_status(std::vector<torrent_status>* ret
, boost::function<bool(torrent_status const&)> const& pred , boost::function<bool(torrent_status const&)> const& pred
@ -464,7 +464,7 @@ namespace libtorrent
int max_uploads() const; int max_uploads() const;
#endif #endif
bandwidth_manager* get_bandwidth_manager(int channel) TORRENT_OVERRIDE; bandwidth_manager* get_bandwidth_manager(int channel) override;
int upload_rate_limit(peer_class_t c) const; int upload_rate_limit(peer_class_t c) const;
int download_rate_limit(peer_class_t c) const; int download_rate_limit(peer_class_t c) const;
@ -474,19 +474,19 @@ namespace libtorrent
void set_rate_limit(peer_class_t c, int channel, int limit); void set_rate_limit(peer_class_t c, int channel, int limit);
int rate_limit(peer_class_t c, int channel) const; int rate_limit(peer_class_t c, int channel) const;
bool preemptive_unchoke() const TORRENT_OVERRIDE; bool preemptive_unchoke() const override;
int num_uploads() const TORRENT_OVERRIDE int num_uploads() const override
{ return int(m_stats_counters[counters::num_peers_up_unchoked]); } { return int(m_stats_counters[counters::num_peers_up_unchoked]); }
int num_connections() const TORRENT_OVERRIDE { return int(m_connections.size()); } int num_connections() const override { return int(m_connections.size()); }
int peak_up_rate() const { return m_peak_up_rate; } int peak_up_rate() const { return m_peak_up_rate; }
void trigger_unchoke() TORRENT_OVERRIDE void trigger_unchoke() override
{ {
TORRENT_ASSERT(is_single_thread()); TORRENT_ASSERT(is_single_thread());
m_unchoke_time_scaler = 0; m_unchoke_time_scaler = 0;
} }
void trigger_optimistic_unchoke() TORRENT_OVERRIDE void trigger_optimistic_unchoke() override
{ {
TORRENT_ASSERT(is_single_thread()); TORRENT_ASSERT(is_single_thread());
m_optimistic_unchoke_time_scaler = 0; m_optimistic_unchoke_time_scaler = 0;
@ -499,30 +499,30 @@ namespace libtorrent
void set_peer_id(peer_id const& id); void set_peer_id(peer_id const& id);
void set_key(int key); void set_key(int key);
address listen_address() const; address listen_address() const;
boost::uint16_t listen_port() const TORRENT_OVERRIDE; boost::uint16_t listen_port() const override;
boost::uint16_t ssl_listen_port() const TORRENT_OVERRIDE; boost::uint16_t ssl_listen_port() const override;
alert_manager& alerts() TORRENT_OVERRIDE { return m_alerts; } alert_manager& alerts() override { return m_alerts; }
disk_interface& disk_thread() TORRENT_OVERRIDE { return m_disk_thread; } disk_interface& disk_thread() override { return m_disk_thread; }
void abort(); void abort();
void abort_stage2(); void abort_stage2();
torrent_handle find_torrent_handle(sha1_hash const& info_hash); torrent_handle find_torrent_handle(sha1_hash const& info_hash);
void announce_lsd(sha1_hash const& ih, int port, bool broadcast = false) TORRENT_OVERRIDE; void announce_lsd(sha1_hash const& ih, int port, bool broadcast = false) override;
void save_state(entry* e, boost::uint32_t flags) const; void save_state(entry* e, boost::uint32_t flags) const;
void load_state(bdecode_node const* e, boost::uint32_t flags); void load_state(bdecode_node const* e, boost::uint32_t flags);
bool has_connection(peer_connection* p) const TORRENT_OVERRIDE; bool has_connection(peer_connection* p) const override;
void insert_peer(boost::shared_ptr<peer_connection> const& c) TORRENT_OVERRIDE; void insert_peer(boost::shared_ptr<peer_connection> const& c) override;
proxy_settings proxy() const TORRENT_OVERRIDE; proxy_settings proxy() const override;
#ifndef TORRENT_DISABLE_DHT #ifndef TORRENT_DISABLE_DHT
bool is_dht_running() const { return (m_dht.get() != NULL); } bool is_dht_running() const { return (m_dht.get() != NULL); }
int external_udp_port() const TORRENT_OVERRIDE int external_udp_port() const override
{ {
for (std::list<listen_socket_t>::const_iterator i = m_listen_sockets.begin() for (std::list<listen_socket_t>::const_iterator i = m_listen_sockets.begin()
, end(m_listen_sockets.end()); i != end; ++i) , end(m_listen_sockets.end()); i != end; ++i)
@ -534,8 +534,8 @@ namespace libtorrent
#endif #endif
#if TORRENT_USE_I2P #if TORRENT_USE_I2P
char const* i2p_session() const TORRENT_OVERRIDE { return m_i2p_conn.session_id(); } char const* i2p_session() const override { return m_i2p_conn.session_id(); }
proxy_settings i2p_proxy() const TORRENT_OVERRIDE; proxy_settings i2p_proxy() const override;
void on_i2p_open(error_code const& ec); void on_i2p_open(error_code const& ec);
void open_new_incoming_i2p_connection(); void open_new_incoming_i2p_connection();
@ -562,57 +562,57 @@ namespace libtorrent
// t is the least recently used, then the next least recently // t is the least recently used, then the next least recently
// used is picked // used is picked
// returns true if the torrent was loaded successfully // returns true if the torrent was loaded successfully
bool load_torrent(torrent* t) TORRENT_OVERRIDE; bool load_torrent(torrent* t) override;
// bump t to the top of the list of least recently used. i.e. // bump t to the top of the list of least recently used. i.e.
// make it the most recently used. This is done every time // make it the most recently used. This is done every time
// an action is performed that required the torrent to be // an action is performed that required the torrent to be
// loaded, indicating activity // loaded, indicating activity
void bump_torrent(torrent* t, bool back = true) TORRENT_OVERRIDE; void bump_torrent(torrent* t, bool back = true) override;
// evict torrents until there's space for one new torrent, // evict torrents until there's space for one new torrent,
void evict_torrents_except(torrent* ignore); void evict_torrents_except(torrent* ignore);
void evict_torrent(torrent* t) TORRENT_OVERRIDE; void evict_torrent(torrent* t) override;
void deferred_submit_jobs() TORRENT_OVERRIDE; void deferred_submit_jobs() override;
char* allocate_buffer() TORRENT_OVERRIDE; char* allocate_buffer() override;
torrent_peer* allocate_peer_entry(int type); torrent_peer* allocate_peer_entry(int type);
void free_peer_entry(torrent_peer* p); void free_peer_entry(torrent_peer* p);
void free_buffer(char* buf) TORRENT_OVERRIDE; void free_buffer(char* buf) override;
int send_buffer_size() const TORRENT_OVERRIDE { return send_buffer_size_impl; } int send_buffer_size() const override { return send_buffer_size_impl; }
// implements buffer_allocator_interface // implements buffer_allocator_interface
void free_disk_buffer(char* buf) TORRENT_OVERRIDE; void free_disk_buffer(char* buf) override;
char* allocate_disk_buffer(char const* category) TORRENT_OVERRIDE; char* allocate_disk_buffer(char const* category) override;
char* allocate_disk_buffer(bool& exceeded char* allocate_disk_buffer(bool& exceeded
, boost::shared_ptr<disk_observer> o , boost::shared_ptr<disk_observer> o
, char const* category) TORRENT_OVERRIDE; , char const* category) override;
void reclaim_block(block_cache_reference ref) TORRENT_OVERRIDE; void reclaim_block(block_cache_reference ref) override;
bool exceeded_cache_use() const bool exceeded_cache_use() const
{ return m_disk_thread.exceeded_cache_use(); } { return m_disk_thread.exceeded_cache_use(); }
// implements dht_observer // implements dht_observer
virtual void set_external_address(address const& ip virtual void set_external_address(address const& ip
, address const& source) TORRENT_OVERRIDE; , address const& source) override;
virtual address external_address(udp proto) TORRENT_OVERRIDE; virtual address external_address(udp proto) override;
virtual void get_peers(sha1_hash const& ih) TORRENT_OVERRIDE; virtual void get_peers(sha1_hash const& ih) override;
virtual void announce(sha1_hash const& ih, address const& addr, int port) TORRENT_OVERRIDE; virtual void announce(sha1_hash const& ih, address const& addr, int port) override;
virtual void outgoing_get_peers(sha1_hash const& target virtual void outgoing_get_peers(sha1_hash const& target
, sha1_hash const& sent_target, udp::endpoint const& ep) TORRENT_OVERRIDE; , sha1_hash const& sent_target, udp::endpoint const& ep) override;
virtual void log(libtorrent::dht::dht_logger::module_t m, char const* fmt, ...) virtual void log(libtorrent::dht::dht_logger::module_t m, char const* fmt, ...)
TORRENT_OVERRIDE TORRENT_FORMAT(3,4); override TORRENT_FORMAT(3,4);
virtual void log_packet(message_direction_t dir, char const* pkt, int len virtual void log_packet(message_direction_t dir, char const* pkt, int len
, udp::endpoint node) TORRENT_OVERRIDE; , udp::endpoint node) override;
virtual bool on_dht_request(char const* query, int query_len virtual bool on_dht_request(char const* query, int query_len
, dht::msg const& request, entry& response) TORRENT_OVERRIDE; , dht::msg const& request, entry& response) override;
void set_external_address(address const& ip void set_external_address(address const& ip
, int source_type, address const& source) TORRENT_OVERRIDE; , int source_type, address const& source) override;
virtual external_ip const& external_address() const TORRENT_OVERRIDE; virtual external_ip const& external_address() const override;
// used when posting synchronous function // used when posting synchronous function
// calls to session_impl and torrent objects // calls to session_impl and torrent objects
@ -621,32 +621,32 @@ namespace libtorrent
// cork a peer and schedule a delayed uncork // cork a peer and schedule a delayed uncork
// does nothing if the peer is already corked // does nothing if the peer is already corked
void cork_burst(peer_connection* p) TORRENT_OVERRIDE; void cork_burst(peer_connection* p) override;
// uncork all peers added to the delayed uncork queue // uncork all peers added to the delayed uncork queue
// implements uncork_interface // implements uncork_interface
virtual void do_delayed_uncork() TORRENT_OVERRIDE; virtual void do_delayed_uncork() override;
void post_socket_job(socket_job& j) TORRENT_OVERRIDE; void post_socket_job(socket_job& j) override;
// implements session_interface // implements session_interface
virtual tcp::endpoint bind_outgoing_socket(socket_type& s, address virtual tcp::endpoint bind_outgoing_socket(socket_type& s, address
const& remote_address, error_code& ec) const TORRENT_OVERRIDE; const& remote_address, error_code& ec) const override;
virtual bool verify_bound_address(address const& addr, bool utp virtual bool verify_bound_address(address const& addr, bool utp
, error_code& ec) TORRENT_OVERRIDE; , error_code& ec) override;
bool has_lsd() const TORRENT_OVERRIDE { return m_lsd.get() != NULL; } bool has_lsd() const override { return m_lsd.get() != NULL; }
std::vector<block_info>& block_info_storage() TORRENT_OVERRIDE { return m_block_info_storage; } std::vector<block_info>& block_info_storage() override { return m_block_info_storage; }
libtorrent::utp_socket_manager* utp_socket_manager() TORRENT_OVERRIDE libtorrent::utp_socket_manager* utp_socket_manager() override
{ return &m_utp_socket_manager; } { return &m_utp_socket_manager; }
#ifdef TORRENT_USE_OPENSSL #ifdef TORRENT_USE_OPENSSL
libtorrent::utp_socket_manager* ssl_utp_socket_manager() TORRENT_OVERRIDE libtorrent::utp_socket_manager* ssl_utp_socket_manager() override
{ return &m_ssl_utp_socket_manager; } { return &m_ssl_utp_socket_manager; }
#endif #endif
void inc_boost_connections() TORRENT_OVERRIDE { ++m_boost_connections; } void inc_boost_connections() override { ++m_boost_connections; }
#ifndef TORRENT_NO_DEPRECATE #ifndef TORRENT_NO_DEPRECATE
void update_ssl_listen(); void update_ssl_listen();
@ -691,7 +691,7 @@ namespace libtorrent
void update_connections_limit(); void update_connections_limit();
void update_alert_mask(); void update_alert_mask();
void trigger_auto_manage() TORRENT_OVERRIDE; void trigger_auto_manage() override;
private: private:
@ -710,7 +710,7 @@ namespace libtorrent
void on_trigger_auto_manage(); void on_trigger_auto_manage();
void on_lsd_peer(tcp::endpoint peer, sha1_hash const& ih); void on_lsd_peer(tcp::endpoint peer, sha1_hash const& ih);
void setup_socket_buffers(socket_type& s) TORRENT_OVERRIDE; void setup_socket_buffers(socket_type& s) override;
// the settings for the client // the settings for the client
aux::session_settings m_settings; aux::session_settings m_settings;
@ -954,11 +954,11 @@ namespace libtorrent
stat m_stat; stat m_stat;
// implements session_interface // implements session_interface
virtual void sent_bytes(int bytes_payload, int bytes_protocol) TORRENT_OVERRIDE; virtual void sent_bytes(int bytes_payload, int bytes_protocol) override;
virtual void received_bytes(int bytes_payload, int bytes_protocol) TORRENT_OVERRIDE; virtual void received_bytes(int bytes_payload, int bytes_protocol) override;
virtual void trancieve_ip_packet(int bytes, bool ipv6) TORRENT_OVERRIDE; virtual void trancieve_ip_packet(int bytes, bool ipv6) override;
virtual void sent_syn(bool ipv6) TORRENT_OVERRIDE; virtual void sent_syn(bool ipv6) override;
virtual void received_synack(bool ipv6) TORRENT_OVERRIDE; virtual void received_synack(bool ipv6) override;
int m_peak_up_rate; int m_peak_up_rate;
int m_peak_down_rate; int m_peak_down_rate;
@ -976,7 +976,7 @@ namespace libtorrent
void recalculate_optimistic_unchoke_slots(); void recalculate_optimistic_unchoke_slots();
time_point m_created; time_point m_created;
boost::uint16_t session_time() const TORRENT_OVERRIDE boost::uint16_t session_time() const override
{ {
// +1 is here to make it possible to distinguish uninitialized (to // +1 is here to make it possible to distinguish uninitialized (to
// 0) timestamps and timestamps of things that happened during the // 0) timestamps and timestamps of things that happened during the
@ -1054,7 +1054,6 @@ namespace libtorrent
#ifdef TORRENT_USE_OPENSSL #ifdef TORRENT_USE_OPENSSL
// used for uTP connections over SSL // used for uTP connections over SSL
udp_socket m_ssl_udp_socket;
libtorrent::utp_socket_manager m_ssl_utp_socket_manager; libtorrent::utp_socket_manager m_ssl_utp_socket_manager;
#endif #endif
@ -1146,10 +1145,10 @@ namespace libtorrent
void check_invariant() const; void check_invariant() const;
#endif #endif
counters& stats_counters() TORRENT_OVERRIDE { return m_stats_counters; } counters& stats_counters() override { return m_stats_counters; }
void received_buffer(int size) TORRENT_OVERRIDE; void received_buffer(int size) override;
void sent_buffer(int size) TORRENT_OVERRIDE; void sent_buffer(int size) override;
// each second tick the timer takes a little // each second tick the timer takes a little
// bit longer than one second to trigger. The // bit longer than one second to trigger. The
@ -1162,8 +1161,8 @@ namespace libtorrent
boost::uint16_t m_tick_residual; boost::uint16_t m_tick_residual;
#ifndef TORRENT_DISABLE_LOGGING #ifndef TORRENT_DISABLE_LOGGING
virtual void session_log(char const* fmt, ...) const TORRENT_OVERRIDE TORRENT_FORMAT(2,3); virtual void session_log(char const* fmt, ...) const override TORRENT_FORMAT(2,3);
virtual void session_vlog(char const* fmt, va_list& va) const TORRENT_OVERRIDE TORRENT_FORMAT(2,0); virtual void session_vlog(char const* fmt, va_list& va) const override TORRENT_FORMAT(2,0);
// this list of tracker loggers serves as tracker_callbacks when // this list of tracker loggers serves as tracker_callbacks when
// shutting down. This list is just here to keep them alive during // shutting down. This list is just here to keep them alive during

View File

@ -98,7 +98,7 @@ namespace libtorrent
{ {
// hidden // hidden
virtual const char* what() const TORRENT_EXCEPTION_THROW_SPECIFIER virtual const char* what() const TORRENT_EXCEPTION_THROW_SPECIFIER
TORRENT_OVERRIDE TORRENT_FINAL override final
{ return "invalid bencoding"; } { return "invalid bencoding"; }
}; };
#endif #endif

View File

@ -79,7 +79,7 @@ namespace libtorrent
bt_peer_connection(peer_connection_args const& pack bt_peer_connection(peer_connection_args const& pack
, peer_id const& pid); , peer_id const& pid);
virtual void start() TORRENT_OVERRIDE; virtual void start() override;
enum enum
{ {
@ -105,7 +105,7 @@ namespace libtorrent
void switch_recv_crypto(boost::shared_ptr<crypto_plugin> crypto); void switch_recv_crypto(boost::shared_ptr<crypto_plugin> crypto);
#endif #endif
virtual int type() const TORRENT_OVERRIDE virtual int type() const override
{ return peer_connection::bittorrent_connection; } { return peer_connection::bittorrent_connection; }
enum message_type enum message_type
@ -153,17 +153,17 @@ namespace libtorrent
// work to do. // work to do.
void on_sent(error_code const& error void on_sent(error_code const& error
, std::size_t bytes_transferred) TORRENT_OVERRIDE; , std::size_t bytes_transferred) override;
void on_receive(error_code const& error void on_receive(error_code const& error
, std::size_t bytes_transferred) TORRENT_OVERRIDE; , std::size_t bytes_transferred) override;
void on_receive_impl(std::size_t bytes_transferred); void on_receive_impl(std::size_t bytes_transferred);
#if !defined(TORRENT_DISABLE_ENCRYPTION) && !defined(TORRENT_DISABLE_EXTENSIONS) #if !defined(TORRENT_DISABLE_ENCRYPTION) && !defined(TORRENT_DISABLE_EXTENSIONS)
virtual int hit_send_barrier(std::vector<boost::asio::mutable_buffer>& iovec) TORRENT_OVERRIDE; virtual int hit_send_barrier(std::vector<boost::asio::mutable_buffer>& iovec) override;
#endif #endif
virtual void get_specific_peer_info(peer_info& p) const TORRENT_OVERRIDE; virtual void get_specific_peer_info(peer_info& p) const override;
virtual bool in_handshake() const TORRENT_OVERRIDE; virtual bool in_handshake() const override;
bool packet_finished() const { return m_recv_buffer.packet_finished(); } bool packet_finished() const { return m_recv_buffer.packet_finished(); }
#ifndef TORRENT_DISABLE_EXTENSIONS #ifndef TORRENT_DISABLE_EXTENSIONS
@ -212,17 +212,17 @@ namespace libtorrent
// the following functions appends messages // the following functions appends messages
// to the send buffer // to the send buffer
void write_choke() TORRENT_OVERRIDE; void write_choke() override;
void write_unchoke() TORRENT_OVERRIDE; void write_unchoke() override;
void write_interested() TORRENT_OVERRIDE; void write_interested() override;
void write_not_interested() TORRENT_OVERRIDE; void write_not_interested() override;
void write_request(peer_request const& r) TORRENT_OVERRIDE; void write_request(peer_request const& r) override;
void write_cancel(peer_request const& r) TORRENT_OVERRIDE; void write_cancel(peer_request const& r) override;
void write_bitfield() TORRENT_OVERRIDE; void write_bitfield() override;
void write_have(int index) TORRENT_OVERRIDE; void write_have(int index) override;
void write_dont_have(int index) TORRENT_OVERRIDE; void write_dont_have(int index) override;
void write_piece(peer_request const& r, disk_buffer_holder& buffer) TORRENT_OVERRIDE; void write_piece(peer_request const& r, disk_buffer_holder& buffer) override;
void write_keepalive() TORRENT_OVERRIDE; void write_keepalive() override;
void write_handshake(bool plain_handshake = false); void write_handshake(bool plain_handshake = false);
#ifndef TORRENT_DISABLE_EXTENSIONS #ifndef TORRENT_DISABLE_EXTENSIONS
void write_extensions(); void write_extensions();
@ -239,12 +239,12 @@ namespace libtorrent
// FAST extension // FAST extension
void write_have_all(); void write_have_all();
void write_have_none(); void write_have_none();
void write_reject_request(peer_request const&) TORRENT_OVERRIDE; void write_reject_request(peer_request const&) override;
void write_allow_fast(int piece) TORRENT_OVERRIDE; void write_allow_fast(int piece) override;
void write_suggest(int piece) TORRENT_OVERRIDE; void write_suggest(int piece) override;
void on_connected() TORRENT_OVERRIDE; void on_connected() override;
void on_metadata() TORRENT_OVERRIDE; void on_metadata() override;
#if TORRENT_USE_INVARIANT_CHECKS #if TORRENT_USE_INVARIANT_CHECKS
void check_invariant() const; void check_invariant() const;
@ -259,7 +259,7 @@ namespace libtorrent
// block. If the peer isn't downloading // block. If the peer isn't downloading
// a piece for the moment, the boost::optional // a piece for the moment, the boost::optional
// will be invalid. // will be invalid.
boost::optional<piece_block_progress> downloading_piece_progress() const TORRENT_OVERRIDE; boost::optional<piece_block_progress> downloading_piece_progress() const override;
#if !defined(TORRENT_DISABLE_ENCRYPTION) && !defined(TORRENT_DISABLE_EXTENSIONS) #if !defined(TORRENT_DISABLE_ENCRYPTION) && !defined(TORRENT_DISABLE_EXTENSIONS)
@ -301,7 +301,7 @@ public:
virtual void append_const_send_buffer(char const* buffer, int size virtual void append_const_send_buffer(char const* buffer, int size
, chained_buffer::free_buffer_fun destructor = &nop , chained_buffer::free_buffer_fun destructor = &nop
, void* userdata = NULL, block_cache_reference ref , void* userdata = NULL, block_cache_reference ref
= block_cache_reference()) TORRENT_OVERRIDE; = block_cache_reference()) override;
private: private:

View File

@ -438,18 +438,6 @@ int snprintf(char* buf, int len, char const* fmt, ...)
#endif #endif
#endif // __GLIBC__ #endif // __GLIBC__
#if __cplusplus <= 199711L || defined BOOST_NO_CXX11_FINAL
#define TORRENT_FINAL
#else
#define TORRENT_FINAL final
#endif
#if __cplusplus <= 199711L || defined BOOST_NO_CXX11_FINAL
#define TORRENT_OVERRIDE
#else
#define TORRENT_OVERRIDE override
#endif
#ifndef TORRENT_ICONV_ARG #ifndef TORRENT_ICONV_ARG
#define TORRENT_ICONV_ARG (char**) #define TORRENT_ICONV_ARG (char**)
#endif #endif

View File

@ -281,7 +281,7 @@ namespace libtorrent
// this is a singleton consisting of the thread and a queue // this is a singleton consisting of the thread and a queue
// of disk io jobs // of disk io jobs
struct TORRENT_EXTRA_EXPORT disk_io_thread TORRENT_FINAL struct TORRENT_EXTRA_EXPORT disk_io_thread final
: disk_job_pool : disk_job_pool
, disk_interface , disk_interface
, buffer_allocator_interface , buffer_allocator_interface
@ -299,60 +299,60 @@ namespace libtorrent
void async_read(piece_manager* storage, peer_request const& r 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
, int flags = 0) TORRENT_OVERRIDE; , int flags = 0) override;
void async_write(piece_manager* storage, peer_request const& r void async_write(piece_manager* storage, peer_request const& r
, disk_buffer_holder& buffer , disk_buffer_holder& buffer
, boost::function<void(disk_io_job const*)> const& handler , boost::function<void(disk_io_job const*)> const& handler
, int flags = 0) TORRENT_OVERRIDE; , int flags = 0) override;
void async_hash(piece_manager* storage, int piece, int flags void async_hash(piece_manager* storage, int piece, int flags
, boost::function<void(disk_io_job const*)> const& handler, void* requester) TORRENT_OVERRIDE; , boost::function<void(disk_io_job const*)> const& handler, void* requester) override;
void async_move_storage(piece_manager* storage, std::string const& p, int flags void async_move_storage(piece_manager* storage, std::string const& p, int flags
, boost::function<void(disk_io_job const*)> const& handler) TORRENT_OVERRIDE; , boost::function<void(disk_io_job const*)> const& handler) override;
void async_release_files(piece_manager* storage void async_release_files(piece_manager* storage
, boost::function<void(disk_io_job const*)> const& handler , boost::function<void(disk_io_job const*)> const& handler
= boost::function<void(disk_io_job const*)>()) TORRENT_OVERRIDE; = boost::function<void(disk_io_job const*)>()) override;
void async_delete_files(piece_manager* storage, int options void async_delete_files(piece_manager* storage, int options
, boost::function<void(disk_io_job const*)> const& handler) TORRENT_OVERRIDE; , boost::function<void(disk_io_job const*)> const& handler) override;
void async_check_files(piece_manager* storage void async_check_files(piece_manager* storage
, add_torrent_params const* resume_data , add_torrent_params const* resume_data
, std::vector<std::string>& links , std::vector<std::string>& links
, boost::function<void(disk_io_job const*)> const& handler) TORRENT_OVERRIDE; , boost::function<void(disk_io_job const*)> const& handler) override;
void async_rename_file(piece_manager* storage, int index, std::string const& name void async_rename_file(piece_manager* storage, int index, std::string const& name
, boost::function<void(disk_io_job const*)> const& handler) TORRENT_OVERRIDE; , boost::function<void(disk_io_job const*)> const& handler) override;
void async_stop_torrent(piece_manager* storage void async_stop_torrent(piece_manager* storage
, boost::function<void(disk_io_job const*)> const& handler) TORRENT_OVERRIDE; , boost::function<void(disk_io_job const*)> const& handler) override;
#ifndef TORRENT_NO_DEPRECATE #ifndef TORRENT_NO_DEPRECATE
void async_cache_piece(piece_manager* storage, int piece void async_cache_piece(piece_manager* storage, int piece
, boost::function<void(disk_io_job const*)> const& handler) TORRENT_OVERRIDE; , boost::function<void(disk_io_job const*)> const& handler) override;
void async_finalize_file(piece_manager* storage, int file void async_finalize_file(piece_manager* storage, int file
, boost::function<void(disk_io_job const*)> const& handler , boost::function<void(disk_io_job const*)> const& handler
= boost::function<void(disk_io_job const*)>()) TORRENT_OVERRIDE; = boost::function<void(disk_io_job const*)>()) override;
#endif #endif
void async_flush_piece(piece_manager* storage, int piece void async_flush_piece(piece_manager* storage, int piece
, boost::function<void(disk_io_job const*)> const& handler , boost::function<void(disk_io_job const*)> const& handler
= boost::function<void(disk_io_job const*)>()) TORRENT_OVERRIDE; = boost::function<void(disk_io_job const*)>()) override;
void async_set_file_priority(piece_manager* storage void async_set_file_priority(piece_manager* storage
, std::vector<boost::uint8_t> const& prio , std::vector<boost::uint8_t> const& prio
, boost::function<void(disk_io_job const*)> const& handler) TORRENT_OVERRIDE; , boost::function<void(disk_io_job const*)> const& handler) override;
void async_load_torrent(add_torrent_params* params void async_load_torrent(add_torrent_params* params
, boost::function<void(disk_io_job const*)> const& handler) TORRENT_OVERRIDE; , boost::function<void(disk_io_job const*)> const& handler) override;
void async_tick_torrent(piece_manager* storage void async_tick_torrent(piece_manager* storage
, boost::function<void(disk_io_job const*)> const& handler) TORRENT_OVERRIDE; , boost::function<void(disk_io_job const*)> const& handler) override;
void clear_read_cache(piece_manager* storage) TORRENT_OVERRIDE; void clear_read_cache(piece_manager* storage) override;
void async_clear_piece(piece_manager* storage, int index void async_clear_piece(piece_manager* storage, int index
, boost::function<void(disk_io_job const*)> const& handler) TORRENT_OVERRIDE; , boost::function<void(disk_io_job const*)> const& handler) override;
// this is not asynchronous and requires that the piece does not // this is not asynchronous and requires that the piece does not
// have any pending buffers. It's meant to be used for pieces that // have any pending buffers. It's meant to be used for pieces that
// were just read and hashed and failed the hash check. // were just read and hashed and failed the hash check.
// there should be no read-operations left, and all buffers should // there should be no read-operations left, and all buffers should
// be discardable // be discardable
void clear_piece(piece_manager* storage, int index) TORRENT_OVERRIDE; void clear_piece(piece_manager* storage, int index) override;
// implements buffer_allocator_interface // implements buffer_allocator_interface
void reclaim_block(block_cache_reference ref) TORRENT_OVERRIDE; void reclaim_block(block_cache_reference ref) override;
void free_disk_buffer(char* buf) TORRENT_OVERRIDE { m_disk_cache.free_buffer(buf); } void free_disk_buffer(char* buf) override { m_disk_cache.free_buffer(buf); }
char* allocate_disk_buffer(char const* category) TORRENT_OVERRIDE char* allocate_disk_buffer(char const* category) override
{ {
bool exceed = false; bool exceed = false;
return allocate_disk_buffer(exceed, boost::shared_ptr<disk_observer>(), category); return allocate_disk_buffer(exceed, boost::shared_ptr<disk_observer>(), category);
@ -360,14 +360,14 @@ namespace libtorrent
void trigger_cache_trim(); void trigger_cache_trim();
char* allocate_disk_buffer(bool& exceeded, boost::shared_ptr<disk_observer> o char* allocate_disk_buffer(bool& exceeded, boost::shared_ptr<disk_observer> o
, char const* category) TORRENT_OVERRIDE; , char const* category) override;
bool exceeded_cache_use() const bool exceeded_cache_use() const
{ return m_disk_cache.exceeded_max_size(); } { return m_disk_cache.exceeded_max_size(); }
void update_stats_counters(counters& c) const TORRENT_OVERRIDE; void update_stats_counters(counters& c) const override;
void get_cache_info(cache_status* ret, bool no_pieces = true void get_cache_info(cache_status* ret, bool no_pieces = true
, piece_manager const* storage = 0) const TORRENT_OVERRIDE; , piece_manager const* storage = 0) const override;
// this submits all queued up jobs to the thread // this submits all queued up jobs to the thread
void submit_jobs(); void submit_jobs();
@ -375,7 +375,7 @@ namespace libtorrent
block_cache* cache() { return &m_disk_cache; } block_cache* cache() { return &m_disk_cache; }
#if TORRENT_USE_ASSERTS #if TORRENT_USE_ASSERTS
bool is_disk_buffer(char* buffer) const TORRENT_OVERRIDE bool is_disk_buffer(char* buffer) const override
{ return m_disk_cache.is_disk_buffer(buffer); } { return m_disk_cache.is_disk_buffer(buffer); }
#endif #endif
@ -387,7 +387,7 @@ namespace libtorrent
void thread_fun(int thread_id, thread_type_t type void thread_fun(int thread_id, thread_type_t type
, boost::shared_ptr<io_service::work> w); , boost::shared_ptr<io_service::work> w);
virtual file_pool& files() TORRENT_OVERRIDE { return m_file_pool; } virtual file_pool& files() override { return m_file_pool; }
io_service& get_io_service() { return m_ios; } io_service& get_io_service() { return m_ios; }

View File

@ -80,20 +80,20 @@ namespace libtorrent
http_seed_connection(peer_connection_args const& pack http_seed_connection(peer_connection_args const& pack
, web_seed_t& web); , web_seed_t& web);
virtual int type() const TORRENT_OVERRIDE virtual int type() const override
{ return peer_connection::http_seed_connection; } { return peer_connection::http_seed_connection; }
// called from the main loop when this connection has any // called from the main loop when this connection has any
// work to do. // work to do.
virtual void on_receive(error_code const& error virtual void on_receive(error_code const& error
, std::size_t bytes_transferred) TORRENT_OVERRIDE; , std::size_t bytes_transferred) override;
std::string const& url() const TORRENT_OVERRIDE { return m_url; } std::string const& url() const override { return m_url; }
virtual void get_specific_peer_info(peer_info& p) const TORRENT_OVERRIDE; virtual void get_specific_peer_info(peer_info& p) const override;
virtual void disconnect(error_code const& ec, operation_t op, int error = 0) TORRENT_OVERRIDE; virtual void disconnect(error_code const& ec, operation_t op, int error = 0) override;
virtual void write_request(peer_request const& r) TORRENT_OVERRIDE; virtual void write_request(peer_request const& r) override;
private: private:
@ -102,7 +102,7 @@ namespace libtorrent
// block. If the peer isn't downloading // block. If the peer isn't downloading
// a piece for the moment, the boost::optional // a piece for the moment, the boost::optional
// will be invalid. // will be invalid.
boost::optional<piece_block_progress> downloading_piece_progress() const TORRENT_OVERRIDE; boost::optional<piece_block_progress> downloading_piece_progress() const override;
// this is const since it's used as a key in the web seed list in the torrent // this is const since it's used as a key in the web seed list in the torrent
// if it's changed referencing back into that list will fail // if it's changed referencing back into that list will fail

View File

@ -67,7 +67,7 @@ namespace libtorrent { namespace dht
{ {
struct dht_tracker; struct dht_tracker;
struct TORRENT_EXTRA_EXPORT dht_tracker TORRENT_FINAL struct TORRENT_EXTRA_EXPORT dht_tracker final
: udp_socket_interface : udp_socket_interface
, boost::enable_shared_from_this<dht_tracker> , boost::enable_shared_from_this<dht_tracker>
{ {
@ -147,8 +147,8 @@ namespace libtorrent { namespace dht
void refresh_key(error_code const& e); void refresh_key(error_code const& e);
// implements udp_socket_interface // implements udp_socket_interface
virtual bool has_quota() TORRENT_OVERRIDE; virtual bool has_quota() override;
virtual bool send_packet(libtorrent::entry& e, udp::endpoint const& addr) TORRENT_OVERRIDE; virtual bool send_packet(libtorrent::entry& e, udp::endpoint const& addr) override;
// this is the bdecode_node DHT messages are parsed into. It's a member // this is the bdecode_node DHT messages are parsed into. It's a member
// in order to avoid having to deallocate and re-allocate it for every // in order to avoid having to deallocate and re-allocate it for every

View File

@ -57,8 +57,8 @@ struct put_data: traversal_algorithm
put_data(node& node, put_callback const& callback); put_data(node& node, put_callback const& callback);
virtual char const* name() const TORRENT_OVERRIDE; virtual char const* name() const override;
virtual void start() TORRENT_OVERRIDE; virtual void start() override;
void set_data(item const& data) { m_data = data; } void set_data(item const& data) { m_data = data; }
@ -66,8 +66,8 @@ struct put_data: traversal_algorithm
protected: protected:
virtual void done() TORRENT_OVERRIDE; virtual void done() override;
virtual bool invoke(observer_ptr o) TORRENT_OVERRIDE; virtual bool invoke(observer_ptr o) override;
put_callback m_put_callback; put_callback m_put_callback;
item m_data; item m_data;

View File

@ -128,14 +128,14 @@ namespace libtorrent
rc4_handler(); rc4_handler();
// Input keys must be 20 bytes // Input keys must be 20 bytes
void set_incoming_key(unsigned char const* key, int len) TORRENT_OVERRIDE; void set_incoming_key(unsigned char const* key, int len) override;
void set_outgoing_key(unsigned char const* key, int len) TORRENT_OVERRIDE; void set_outgoing_key(unsigned char const* key, int len) override;
int encrypt(std::vector<boost::asio::mutable_buffer>& buf) TORRENT_OVERRIDE; int encrypt(std::vector<boost::asio::mutable_buffer>& buf) override;
void decrypt(std::vector<boost::asio::mutable_buffer>& buf void decrypt(std::vector<boost::asio::mutable_buffer>& buf
, int& consume , int& consume
, int& produce , int& produce
, int& packet_size) TORRENT_OVERRIDE; , int& packet_size) override;
private: private:
rc4 m_rc4_incoming; rc4 m_rc4_incoming;

View File

@ -52,14 +52,14 @@ POSSIBILITY OF SUCH DAMAGE.
namespace libtorrent namespace libtorrent
{ {
struct TORRENT_EXTRA_EXPORT resolver TORRENT_FINAL : resolver_interface struct TORRENT_EXTRA_EXPORT resolver final : resolver_interface
{ {
resolver(io_service& ios); resolver(io_service& ios);
virtual void async_resolve(std::string const& host, int flags virtual void async_resolve(std::string const& host, int flags
, callback_t const& h) TORRENT_OVERRIDE; , callback_t const& h) override;
virtual void abort() TORRENT_OVERRIDE; virtual void abort() override;
private: private:

View File

@ -399,27 +399,27 @@ namespace libtorrent
~default_storage(); ~default_storage();
#ifndef TORRENT_NO_DEPRECATE #ifndef TORRENT_NO_DEPRECATE
void finalize_file(int file, storage_error& ec) TORRENT_OVERRIDE; void finalize_file(int file, storage_error& ec) override;
#endif #endif
virtual bool has_any_file(storage_error& ec) TORRENT_OVERRIDE; virtual bool has_any_file(storage_error& ec) override;
virtual void set_file_priority(std::vector<boost::uint8_t> const& prio virtual void set_file_priority(std::vector<boost::uint8_t> const& prio
, storage_error& ec) TORRENT_OVERRIDE; , storage_error& ec) override;
virtual void rename_file(int index, std::string const& new_filename virtual void rename_file(int index, std::string const& new_filename
, storage_error& ec) TORRENT_OVERRIDE; , storage_error& ec) override;
virtual void release_files(storage_error& ec) TORRENT_OVERRIDE; virtual void release_files(storage_error& ec) override;
virtual void delete_files(int options, storage_error& ec) TORRENT_OVERRIDE; virtual void delete_files(int options, storage_error& ec) override;
virtual void initialize(storage_error& ec) TORRENT_OVERRIDE; virtual void initialize(storage_error& ec) override;
virtual int move_storage(std::string const& save_path, int flags virtual int move_storage(std::string const& save_path, int flags
, storage_error& ec) TORRENT_OVERRIDE; , storage_error& ec) override;
virtual bool verify_resume_data(add_torrent_params const& rd virtual bool verify_resume_data(add_torrent_params const& rd
, std::vector<std::string> const* links , std::vector<std::string> const* links
, storage_error& error) TORRENT_OVERRIDE; , storage_error& error) override;
virtual bool tick() TORRENT_OVERRIDE; virtual bool tick() override;
int readv(file::iovec_t const* bufs, int num_bufs int readv(file::iovec_t const* bufs, int num_bufs
, int piece, int offset, int flags, storage_error& ec) TORRENT_OVERRIDE; , int piece, int offset, int flags, storage_error& ec) override;
int writev(file::iovec_t const* bufs, int num_bufs int writev(file::iovec_t const* bufs, int num_bufs
, int piece, int offset, int flags, storage_error& ec) TORRENT_OVERRIDE; , int piece, int offset, int flags, storage_error& ec) override;
// if the files in this storage are mapped, returns the mapped // if the files in this storage are mapped, returns the mapped
// file_storage, otherwise returns the original file_storage object. // file_storage, otherwise returns the original file_storage object.
@ -478,52 +478,52 @@ 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 TORRENT_FINAL : public storage_interface, boost::noncopyable class disabled_storage final : public storage_interface, boost::noncopyable
{ {
public: public:
virtual bool has_any_file(storage_error&) TORRENT_OVERRIDE { return false; } virtual bool has_any_file(storage_error&) 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&) override {}
virtual void rename_file(int, std::string const&, storage_error&) TORRENT_OVERRIDE {} virtual void rename_file(int, std::string const&, storage_error&) override {}
virtual void release_files(storage_error&) TORRENT_OVERRIDE {} virtual void release_files(storage_error&) override {}
virtual void delete_files(int, storage_error&) TORRENT_OVERRIDE {} virtual void delete_files(int, storage_error&) override {}
virtual void initialize(storage_error&) TORRENT_OVERRIDE {} virtual void initialize(storage_error&) override {}
virtual int move_storage(std::string const&, int, storage_error&) TORRENT_OVERRIDE { return 0; } virtual int move_storage(std::string const&, int, storage_error&) override { return 0; }
virtual int readv(file::iovec_t const* bufs, int num_bufs, int piece virtual int readv(file::iovec_t const* bufs, int num_bufs, int piece
, int offset, int flags, storage_error& ec) TORRENT_OVERRIDE; , int offset, int flags, storage_error& ec) override;
virtual int writev(file::iovec_t const* bufs, int num_bufs, int piece virtual int writev(file::iovec_t const* bufs, int num_bufs, int piece
, int offset, int flags, storage_error& ec) TORRENT_OVERRIDE; , int offset, int flags, storage_error& ec) override;
virtual bool verify_resume_data(add_torrent_params const& virtual bool verify_resume_data(add_torrent_params const&
, std::vector<std::string> const* , std::vector<std::string> const*
, storage_error&) TORRENT_OVERRIDE { return false; } , storage_error&) override { return false; }
}; };
// 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 TORRENT_FINAL : storage_interface struct zero_storage final : storage_interface
{ {
virtual void initialize(storage_error&) TORRENT_OVERRIDE {} virtual void initialize(storage_error&) override {}
virtual int readv(file::iovec_t const* bufs, int num_bufs virtual int readv(file::iovec_t const* bufs, int num_bufs
, int piece, int offset, int flags, storage_error& ec) TORRENT_OVERRIDE; , int piece, int offset, int flags, storage_error& ec) override;
virtual int writev(file::iovec_t const* bufs, int num_bufs virtual int writev(file::iovec_t const* bufs, int num_bufs
, int piece, int offset, int flags, storage_error& ec) TORRENT_OVERRIDE; , int piece, int offset, int flags, storage_error& ec) override;
virtual bool has_any_file(storage_error&) TORRENT_OVERRIDE { return false; } virtual bool has_any_file(storage_error&) override { return false; }
virtual void set_file_priority(std::vector<boost::uint8_t> const& /* prio */ virtual void set_file_priority(std::vector<boost::uint8_t> const& /* prio */
, storage_error&) TORRENT_OVERRIDE {} , storage_error&) override {}
virtual int move_storage(std::string const& /* save_path */ virtual int move_storage(std::string const& /* save_path */
, int /* flags */, storage_error&) TORRENT_OVERRIDE { return 0; } , int /* flags */, storage_error&) override { return 0; }
virtual bool verify_resume_data(add_torrent_params const& /* rd */ virtual bool verify_resume_data(add_torrent_params const& /* rd */
, std::vector<std::string> const* /* links */ , std::vector<std::string> const* /* links */
, storage_error&) TORRENT_OVERRIDE , storage_error&) override
{ return false; } { return false; }
virtual void release_files(storage_error&) TORRENT_OVERRIDE {} virtual void release_files(storage_error&) override {}
virtual void rename_file(int /* index */ virtual void rename_file(int /* index */
, std::string const& /* new_filenamem */, storage_error&) TORRENT_OVERRIDE {} , std::string const& /* new_filenamem */, storage_error&) override {}
virtual void delete_files(int, storage_error&) TORRENT_OVERRIDE {} virtual void delete_files(int, storage_error&) override {}
}; };
struct disk_io_thread; struct disk_io_thread;

View File

@ -673,14 +673,14 @@ namespace libtorrent
tracker_request const& r tracker_request const& r
, address const& tracker_ip , address const& tracker_ip
, std::list<address> const& ip_list , std::list<address> const& ip_list
, struct tracker_response const& resp) TORRENT_OVERRIDE; , struct tracker_response const& resp) override;
virtual void tracker_request_error(tracker_request const& r virtual void tracker_request_error(tracker_request const& r
, int response_code, error_code const& ec, const std::string& msg , int response_code, error_code const& ec, const std::string& msg
, int retry_interval) TORRENT_OVERRIDE; , int retry_interval) override;
virtual void tracker_warning(tracker_request const& req virtual void tracker_warning(tracker_request const& req
, std::string const& msg) TORRENT_OVERRIDE; , std::string const& msg) override;
virtual void tracker_scrape_response(tracker_request const& req virtual void tracker_scrape_response(tracker_request const& req
, int complete, int incomplete, int downloaded, int downloaders) TORRENT_OVERRIDE; , int complete, int incomplete, int downloaded, int downloaders) override;
void update_scrape_state(); void update_scrape_state();
@ -983,7 +983,7 @@ namespace libtorrent
// LOGGING // LOGGING
#ifndef TORRENT_DISABLE_LOGGING #ifndef TORRENT_DISABLE_LOGGING
virtual void debug_log(const char* fmt, ...) const TORRENT_OVERRIDE TORRENT_FORMAT(2,3); virtual void debug_log(const char* fmt, ...) const override TORRENT_FORMAT(2,3);
void log_to_all_peers(char const* message); void log_to_all_peers(char const* message);
time_point m_dht_start_time; time_point m_dht_start_time;

View File

@ -60,7 +60,7 @@ namespace libtorrent
~torrent_peer_allocator_interface() {} ~torrent_peer_allocator_interface() {}
}; };
struct TORRENT_EXTRA_EXPORT torrent_peer_allocator TORRENT_FINAL struct TORRENT_EXTRA_EXPORT torrent_peer_allocator final
: torrent_peer_allocator_interface : torrent_peer_allocator_interface
{ {
torrent_peer_allocator(); torrent_peer_allocator();

View File

@ -336,7 +336,7 @@ namespace libtorrent
tracker_manager& m_man; tracker_manager& m_man;
}; };
class TORRENT_EXTRA_EXPORT tracker_manager TORRENT_FINAL class TORRENT_EXTRA_EXPORT tracker_manager final
: boost::noncopyable : boost::noncopyable
{ {
public: public:

View File

@ -53,7 +53,7 @@ namespace libtorrent
struct utp_socket_impl; struct utp_socket_impl;
struct counters; struct counters;
struct utp_socket_manager TORRENT_FINAL struct utp_socket_manager final
{ {
typedef boost::function<void(udp::endpoint const& typedef boost::function<void(udp::endpoint const&
, aux::array_view<char const> , aux::array_view<char const>

View File

@ -74,25 +74,25 @@ namespace libtorrent
web_peer_connection(peer_connection_args const& pack web_peer_connection(peer_connection_args const& pack
, web_seed_t& web); , web_seed_t& web);
virtual void on_connected() TORRENT_OVERRIDE; virtual void on_connected() override;
virtual int type() const TORRENT_OVERRIDE virtual int type() const override
{ return peer_connection::url_seed_connection; } { return peer_connection::url_seed_connection; }
// called from the main loop when this connection has any // called from the main loop when this connection has any
// work to do. // work to do.
virtual void on_receive(error_code const& error virtual void on_receive(error_code const& error
, std::size_t bytes_transferred) TORRENT_OVERRIDE; , std::size_t bytes_transferred) override;
std::string const& url() const TORRENT_OVERRIDE { return m_url; } std::string const& url() const override { return m_url; }
virtual void get_specific_peer_info(peer_info& p) const TORRENT_OVERRIDE; virtual void get_specific_peer_info(peer_info& p) const override;
virtual void disconnect(error_code const& ec virtual void disconnect(error_code const& ec
, operation_t op, int error = 0) TORRENT_OVERRIDE; , operation_t op, int error = 0) override;
virtual void write_request(peer_request const& r) TORRENT_OVERRIDE; virtual void write_request(peer_request const& r) override;
virtual bool received_invalid_data(int index, bool single_peer) TORRENT_OVERRIDE; virtual bool received_invalid_data(int index, bool single_peer) override;
private: private:
@ -108,7 +108,7 @@ namespace libtorrent
// block. If the peer isn't downloading // block. If the peer isn't downloading
// a piece for the moment, the boost::optional // a piece for the moment, the boost::optional
// will be invalid. // will be invalid.
boost::optional<piece_block_progress> downloading_piece_progress() const TORRENT_OVERRIDE; boost::optional<piece_block_progress> downloading_piece_progress() const override;
void handle_padfile(); void handle_padfile();

View File

@ -54,20 +54,20 @@ using namespace sim;
struct obs : dht::dht_observer struct obs : dht::dht_observer
{ {
virtual void set_external_address(address const& addr virtual void set_external_address(address const& addr
, address const& source) TORRENT_OVERRIDE , address const& source) override
{} {}
virtual address external_address(udp proto) TORRENT_OVERRIDE virtual address external_address(udp proto) override
{ {
if (proto == udp::v4()) if (proto == udp::v4())
return address_v4::from_string("40.30.20.10"); return address_v4::from_string("40.30.20.10");
else else
return address_v6(); return address_v6();
} }
virtual void get_peers(sha1_hash const& ih) TORRENT_OVERRIDE {} virtual void get_peers(sha1_hash const& ih) override {}
virtual void outgoing_get_peers(sha1_hash const& target virtual void outgoing_get_peers(sha1_hash const& target
, sha1_hash const& sent_target, udp::endpoint const& ep) TORRENT_OVERRIDE {} , sha1_hash const& sent_target, udp::endpoint const& ep) override {}
virtual void announce(sha1_hash const& ih, address const& addr, int port) TORRENT_OVERRIDE {} virtual void announce(sha1_hash const& ih, address const& addr, int port) override {}
virtual void log(dht_logger::module_t l, char const* fmt, ...) TORRENT_OVERRIDE virtual void log(dht_logger::module_t l, char const* fmt, ...) override
{ {
va_list v; va_list v;
va_start(v, fmt); va_start(v, fmt);
@ -76,9 +76,9 @@ struct obs : dht::dht_observer
puts("\n"); puts("\n");
} }
virtual void log_packet(message_direction_t dir, char const* pkt, int len virtual void log_packet(message_direction_t dir, char const* pkt, int len
, udp::endpoint node) TORRENT_OVERRIDE {} , udp::endpoint node) override {}
virtual bool on_dht_request(char const* query, int query_len virtual bool on_dht_request(char const* query, int query_len
, dht::msg const& request, entry& response) TORRENT_OVERRIDE { return false; } , dht::msg const& request, entry& response) override { return false; }
}; };
#endif // #if !defined TORRENT_DISABLE_DHT #endif // #if !defined TORRENT_DISABLE_DHT

View File

@ -183,7 +183,7 @@ namespace
node_id const& m_our_id; node_id const& m_our_id;
}; };
class dht_default_storage TORRENT_FINAL : public dht_storage_interface, boost::noncopyable class dht_default_storage final : public dht_storage_interface, boost::noncopyable
{ {
typedef std::map<node_id, torrent_entry> table_t; typedef std::map<node_id, torrent_entry> table_t;
typedef std::map<node_id, dht_immutable_item> dht_immutable_table_t; typedef std::map<node_id, dht_immutable_item> dht_immutable_table_t;
@ -201,8 +201,8 @@ namespace
~dht_default_storage() {} ~dht_default_storage() {}
#ifndef TORRENT_NO_DEPRECATE #ifndef TORRENT_NO_DEPRECATE
size_t num_torrents() const TORRENT_OVERRIDE { return m_map.size(); } size_t num_torrents() const override { return m_map.size(); }
size_t num_peers() const TORRENT_OVERRIDE size_t num_peers() const override
{ {
int ret = 0; int ret = 0;
std::for_each(m_map.begin(), m_map.end(), count_peers(&ret)); std::for_each(m_map.begin(), m_map.end(), count_peers(&ret));
@ -212,7 +212,7 @@ namespace
bool get_peers(sha1_hash const& info_hash bool get_peers(sha1_hash const& info_hash
, bool noseed, bool scrape , bool noseed, bool scrape
, entry& peers) const TORRENT_OVERRIDE , entry& peers) const override
{ {
table_t::const_iterator i = m_map.lower_bound(info_hash); table_t::const_iterator i = m_map.lower_bound(info_hash);
if (i == m_map.end()) return false; if (i == m_map.end()) return false;
@ -270,7 +270,7 @@ namespace
void announce_peer(sha1_hash const& info_hash void announce_peer(sha1_hash const& info_hash
, tcp::endpoint const& endp , tcp::endpoint const& endp
, std::string const& name, bool seed) TORRENT_OVERRIDE , std::string const& name, bool seed) override
{ {
table_t::iterator ti = m_map.find(info_hash); table_t::iterator ti = m_map.find(info_hash);
torrent_entry* v; torrent_entry* v;
@ -338,7 +338,7 @@ namespace
} }
bool get_immutable_item(sha1_hash const& target bool get_immutable_item(sha1_hash const& target
, entry& item) const TORRENT_OVERRIDE , entry& item) const override
{ {
dht_immutable_table_t::const_iterator i = m_immutable_table.find(target); dht_immutable_table_t::const_iterator i = m_immutable_table.find(target);
if (i == m_immutable_table.end()) return false; if (i == m_immutable_table.end()) return false;
@ -349,7 +349,7 @@ namespace
void put_immutable_item(sha1_hash const& target void put_immutable_item(sha1_hash const& target
, char const* buf, int size , char const* buf, int size
, address const& addr) TORRENT_OVERRIDE , address const& addr) override
{ {
dht_immutable_table_t::iterator i = m_immutable_table.find(target); dht_immutable_table_t::iterator i = m_immutable_table.find(target);
if (i == m_immutable_table.end()) if (i == m_immutable_table.end())
@ -385,7 +385,7 @@ namespace
} }
bool get_mutable_item_seq(sha1_hash const& target bool get_mutable_item_seq(sha1_hash const& target
, boost::int64_t& seq) const TORRENT_OVERRIDE , boost::int64_t& seq) const override
{ {
dht_mutable_table_t::const_iterator i = m_mutable_table.find(target); dht_mutable_table_t::const_iterator i = m_mutable_table.find(target);
if (i == m_mutable_table.end()) return false; if (i == m_mutable_table.end()) return false;
@ -396,7 +396,7 @@ namespace
bool get_mutable_item(sha1_hash const& target bool get_mutable_item(sha1_hash const& target
, boost::int64_t seq, bool force_fill , boost::int64_t seq, bool force_fill
, entry& item) const TORRENT_OVERRIDE , entry& item) const override
{ {
dht_mutable_table_t::const_iterator i = m_mutable_table.find(target); dht_mutable_table_t::const_iterator i = m_mutable_table.find(target);
if (i == m_mutable_table.end()) return false; if (i == m_mutable_table.end()) return false;
@ -418,7 +418,7 @@ namespace
, boost::int64_t seq , boost::int64_t seq
, char const* pk , char const* pk
, char const* salt, int salt_size , char const* salt, int salt_size
, address const& addr) TORRENT_OVERRIDE , address const& addr) override
{ {
dht_mutable_table_t::iterator i = m_mutable_table.find(target); dht_mutable_table_t::iterator i = m_mutable_table.find(target);
if (i == m_mutable_table.end()) if (i == m_mutable_table.end())
@ -486,7 +486,7 @@ namespace
touch_item(&i->second, addr); touch_item(&i->second, addr);
} }
void tick() TORRENT_OVERRIDE void tick() override
{ {
time_point now(aux::time_now()); time_point now(aux::time_now());
@ -541,7 +541,7 @@ namespace
} }
} }
virtual dht_storage_counters counters() const TORRENT_OVERRIDE virtual dht_storage_counters counters() const override
{ {
return m_counters; return m_counters;
} }

View File

@ -97,7 +97,7 @@ namespace libtorrent { namespace
return ret; return ret;
} }
struct metadata_plugin TORRENT_FINAL struct metadata_plugin final
: torrent_plugin : torrent_plugin
{ {
metadata_plugin(torrent& t) metadata_plugin(torrent& t)
@ -112,19 +112,19 @@ namespace libtorrent { namespace
bool need_loaded() bool need_loaded()
{ return m_torrent.need_loaded(); } { return m_torrent.need_loaded(); }
*/ */
virtual void on_unload() TORRENT_OVERRIDE virtual void on_unload() override
{ {
m_metadata.reset(); m_metadata.reset();
} }
virtual void on_load() TORRENT_OVERRIDE virtual void on_load() override
{ {
// initialize m_metadata_size // initialize m_metadata_size
TORRENT_ASSERT(m_torrent.is_loaded()); TORRENT_ASSERT(m_torrent.is_loaded());
metadata(); metadata();
} }
virtual void on_files_checked() TORRENT_OVERRIDE virtual void on_files_checked() override
{ {
// if the torrent is a seed, make a reference to // if the torrent is a seed, make a reference to
// the metadata from the torrent before it is deallocated // the metadata from the torrent before it is deallocated
@ -132,7 +132,7 @@ namespace libtorrent { namespace
} }
virtual boost::shared_ptr<peer_plugin> new_connection( virtual boost::shared_ptr<peer_plugin> new_connection(
peer_connection_handle const& pc) TORRENT_OVERRIDE; peer_connection_handle const& pc) override;
buffer::const_interval metadata() const buffer::const_interval metadata() const
{ {
@ -219,7 +219,7 @@ namespace libtorrent { namespace
m_torrent.set_progress_ppm(boost::int64_t(m_metadata_progress) * 1000000 / m_metadata_size); m_torrent.set_progress_ppm(boost::int64_t(m_metadata_progress) * 1000000 / m_metadata_size);
} }
void on_piece_pass(int) TORRENT_OVERRIDE void on_piece_pass(int) override
{ {
// if we became a seed, copy the metadata from // if we became a seed, copy the metadata from
// the torrent before it is deallocated // the torrent before it is deallocated
@ -257,7 +257,7 @@ namespace libtorrent { namespace
metadata_plugin& operator=(metadata_plugin const&); metadata_plugin& operator=(metadata_plugin const&);
}; };
struct metadata_peer_plugin TORRENT_FINAL struct metadata_peer_plugin final
: peer_plugin : peer_plugin
{ {
metadata_peer_plugin(torrent& t, peer_connection& pc metadata_peer_plugin(torrent& t, peer_connection& pc
@ -272,17 +272,17 @@ namespace libtorrent { namespace
, m_tp(tp) , m_tp(tp)
{} {}
virtual char const* type() const TORRENT_OVERRIDE { return "LT_metadata"; } virtual char const* type() const override { return "LT_metadata"; }
// can add entries to the extension handshake // can add entries to the extension handshake
virtual void add_handshake(entry& h) TORRENT_OVERRIDE virtual void add_handshake(entry& h) override
{ {
entry& messages = h["m"]; entry& messages = h["m"];
messages["LT_metadata"] = 14; messages["LT_metadata"] = 14;
} }
// called when the extension handshake from the other end is received // called when the extension handshake from the other end is received
virtual bool on_extension_handshake(bdecode_node const& h) TORRENT_OVERRIDE virtual bool on_extension_handshake(bdecode_node const& h) override
{ {
m_message_index = 0; m_message_index = 0;
if (h.type() != bdecode_node::dict_t) return false; if (h.type() != bdecode_node::dict_t) return false;
@ -389,7 +389,7 @@ namespace libtorrent { namespace
} }
virtual bool on_extended(int length virtual bool on_extended(int length
, int msg, buffer::const_interval body) TORRENT_OVERRIDE , int msg, buffer::const_interval body) override
{ {
if (msg != 14) return false; if (msg != 14) return false;
if (m_message_index == 0) return false; if (m_message_index == 0) return false;
@ -491,7 +491,7 @@ namespace libtorrent { namespace
return true; return true;
} }
virtual void tick() TORRENT_OVERRIDE virtual void tick() override
{ {
if (m_pc.is_disconnecting()) return; if (m_pc.is_disconnecting()) return;

View File

@ -118,7 +118,7 @@ namespace libtorrent {
namespace namespace
{ {
struct smart_ban_plugin TORRENT_FINAL struct smart_ban_plugin final
: torrent_plugin : torrent_plugin
, boost::enable_shared_from_this<smart_ban_plugin> , boost::enable_shared_from_this<smart_ban_plugin>
{ {
@ -136,7 +136,7 @@ namespace
{ fclose(m_log_file); } { fclose(m_log_file); }
#endif #endif
virtual void on_piece_pass(int p) TORRENT_OVERRIDE virtual void on_piece_pass(int p) override
{ {
#ifndef TORRENT_DISABLE_LOGGING #ifndef TORRENT_DISABLE_LOGGING
m_torrent.debug_log(" PIECE PASS [ p: %d | block_hash_size: %d ]" m_torrent.debug_log(" PIECE PASS [ p: %d | block_hash_size: %d ]"
@ -188,7 +188,7 @@ namespace
} }
} }
virtual void on_piece_failed(int p) TORRENT_OVERRIDE virtual void on_piece_failed(int p) override
{ {
// The piece failed the hash check. Record // The piece failed the hash check. Record
// the CRC and origin peer of every block // the CRC and origin peer of every block

View File

@ -234,7 +234,7 @@ namespace libtorrent
, boost::int64_t const file_offset , boost::int64_t const file_offset
, int const size , int const size
, file::iovec_t const* bufs, storage_error& ec) , file::iovec_t const* bufs, storage_error& ec)
TORRENT_OVERRIDE TORRENT_FINAL override final
{ {
if (m_storage.files().pad_file_at(file_index)) if (m_storage.files().pad_file_at(file_index))
{ {
@ -325,7 +325,7 @@ namespace libtorrent
, boost::int64_t const file_offset , boost::int64_t const file_offset
, int const size , int const size
, file::iovec_t const* bufs, storage_error& ec) , file::iovec_t const* bufs, storage_error& ec)
TORRENT_OVERRIDE TORRENT_FINAL override final
{ {
int num_bufs = count_bufs(bufs, size); int num_bufs = count_bufs(bufs, size);

View File

@ -90,7 +90,7 @@ namespace libtorrent { namespace
struct ut_metadata_peer_plugin; struct ut_metadata_peer_plugin;
struct ut_metadata_plugin TORRENT_FINAL struct ut_metadata_plugin final
: torrent_plugin : torrent_plugin
{ {
ut_metadata_plugin(torrent& t) ut_metadata_plugin(torrent& t)
@ -106,19 +106,19 @@ namespace libtorrent { namespace
bool need_loaded() bool need_loaded()
{ return m_torrent.need_loaded(); } { return m_torrent.need_loaded(); }
virtual void on_unload() TORRENT_OVERRIDE virtual void on_unload() override
{ {
m_metadata.reset(); m_metadata.reset();
} }
virtual void on_load() TORRENT_OVERRIDE virtual void on_load() override
{ {
// initialize m_metadata_size // initialize m_metadata_size
TORRENT_ASSERT(m_torrent.is_loaded()); TORRENT_ASSERT(m_torrent.is_loaded());
metadata(); metadata();
} }
virtual void on_files_checked() TORRENT_OVERRIDE virtual void on_files_checked() override
{ {
// TODO: 2 if we were to initialize m_metadata_size lazily instead, // TODO: 2 if we were to initialize m_metadata_size lazily instead,
// we would probably be more efficient // we would probably be more efficient
@ -127,7 +127,7 @@ namespace libtorrent { namespace
} }
virtual boost::shared_ptr<peer_plugin> new_connection( virtual boost::shared_ptr<peer_plugin> new_connection(
peer_connection_handle const& pc) TORRENT_OVERRIDE; peer_connection_handle const& pc) override;
int get_metadata_size() const int get_metadata_size() const
{ {
@ -167,7 +167,7 @@ namespace libtorrent { namespace
m_torrent.set_progress_ppm(boost::int64_t(m_metadata_progress) * 1000000 / m_metadata_size); m_torrent.set_progress_ppm(boost::int64_t(m_metadata_progress) * 1000000 / m_metadata_size);
} }
*/ */
void on_piece_pass(int) TORRENT_OVERRIDE void on_piece_pass(int) override
{ {
// if we became a seed, copy the metadata from // if we became a seed, copy the metadata from
// the torrent before it is deallocated // the torrent before it is deallocated
@ -215,7 +215,7 @@ namespace libtorrent { namespace
}; };
struct ut_metadata_peer_plugin TORRENT_FINAL struct ut_metadata_peer_plugin final
: peer_plugin, boost::enable_shared_from_this<ut_metadata_peer_plugin> : peer_plugin, boost::enable_shared_from_this<ut_metadata_peer_plugin>
{ {
friend struct ut_metadata_plugin; friend struct ut_metadata_plugin;
@ -229,10 +229,10 @@ namespace libtorrent { namespace
, m_tp(tp) , m_tp(tp)
{} {}
virtual char const* type() const TORRENT_OVERRIDE { return "ut_metadata"; } virtual char const* type() const override { return "ut_metadata"; }
// can add entries to the extension handshake // can add entries to the extension handshake
virtual void add_handshake(entry& h) TORRENT_OVERRIDE virtual void add_handshake(entry& h) override
{ {
entry& messages = h["m"]; entry& messages = h["m"];
messages["ut_metadata"] = 2; messages["ut_metadata"] = 2;
@ -241,7 +241,7 @@ namespace libtorrent { namespace
} }
// called when the extension handshake from the other end is received // called when the extension handshake from the other end is received
virtual bool on_extension_handshake(bdecode_node const& h) TORRENT_OVERRIDE virtual bool on_extension_handshake(bdecode_node const& h) override
{ {
m_message_index = 0; m_message_index = 0;
if (h.type() != bdecode_node::dict_t) return false; if (h.type() != bdecode_node::dict_t) return false;
@ -327,7 +327,7 @@ namespace libtorrent { namespace
} }
virtual bool on_extended(int length virtual bool on_extended(int length
, int extended_msg, buffer::const_interval body) TORRENT_OVERRIDE , int extended_msg, buffer::const_interval body) override
{ {
if (extended_msg != 2) return false; if (extended_msg != 2) return false;
if (m_message_index == 0) return false; if (m_message_index == 0) return false;
@ -443,7 +443,7 @@ namespace libtorrent { namespace
return true; return true;
} }
virtual void tick() TORRENT_OVERRIDE virtual void tick() override
{ {
maybe_send_request(); maybe_send_request();
while (!m_incoming_requests.empty() while (!m_incoming_requests.empty()

View File

@ -81,7 +81,7 @@ namespace libtorrent { namespace
return true; return true;
} }
struct ut_pex_plugin TORRENT_FINAL struct ut_pex_plugin final
: torrent_plugin : torrent_plugin
{ {
// randomize when we rebuild the pex message // randomize when we rebuild the pex message
@ -94,7 +94,7 @@ namespace libtorrent { namespace
, m_peers_in_message(0) {} , m_peers_in_message(0) {}
virtual boost::shared_ptr<peer_plugin> new_connection( virtual boost::shared_ptr<peer_plugin> new_connection(
peer_connection_handle const& pc) TORRENT_OVERRIDE; peer_connection_handle const& pc) override;
std::vector<char>& get_ut_pex_msg() std::vector<char>& get_ut_pex_msg()
{ {
@ -111,7 +111,7 @@ namespace libtorrent { namespace
// are calculated here and the pex message is created // are calculated here and the pex message is created
// each peer connection will use this message // each peer connection will use this message
// max_peer_entries limits the packet size // max_peer_entries limits the packet size
virtual void tick() TORRENT_OVERRIDE virtual void tick() override
{ {
time_point now = aux::time_now(); time_point now = aux::time_now();
if (now - seconds(60) < m_last_msg) return; if (now - seconds(60) < m_last_msg) return;
@ -241,7 +241,7 @@ namespace libtorrent { namespace
ut_pex_plugin& operator=(ut_pex_plugin const&); ut_pex_plugin& operator=(ut_pex_plugin const&);
}; };
struct ut_pex_peer_plugin TORRENT_FINAL struct ut_pex_peer_plugin final
: peer_plugin : peer_plugin
{ {
ut_pex_peer_plugin(torrent& t, peer_connection& pc, ut_pex_plugin& tp) ut_pex_peer_plugin(torrent& t, peer_connection& pc, ut_pex_plugin& tp)
@ -259,15 +259,15 @@ namespace libtorrent { namespace
} }
} }
virtual char const* type() const TORRENT_OVERRIDE { return "ut_pex"; } virtual char const* type() const override { return "ut_pex"; }
virtual void add_handshake(entry& h) TORRENT_OVERRIDE virtual void add_handshake(entry& h) override
{ {
entry& messages = h["m"]; entry& messages = h["m"];
messages[extension_name] = extension_index; messages[extension_name] = extension_index;
} }
virtual bool on_extension_handshake(bdecode_node const& h) TORRENT_OVERRIDE virtual bool on_extension_handshake(bdecode_node const& h) override
{ {
m_message_index = 0; m_message_index = 0;
if (h.type() != bdecode_node::dict_t) return false; if (h.type() != bdecode_node::dict_t) return false;
@ -280,7 +280,7 @@ namespace libtorrent { namespace
return true; return true;
} }
virtual bool on_extended(int length, int msg, buffer::const_interval body) TORRENT_OVERRIDE virtual bool on_extended(int length, int msg, buffer::const_interval body) override
{ {
if (msg != extension_index) return false; if (msg != extension_index) return false;
if (m_message_index == 0) return false; if (m_message_index == 0) return false;
@ -433,7 +433,7 @@ namespace libtorrent { namespace
// the peers second tick // the peers second tick
// every minute we send a pex message // every minute we send a pex message
virtual void tick() TORRENT_OVERRIDE virtual void tick() override
{ {
// no handshake yet // no handshake yet
if (!m_message_index) return; if (!m_message_index) return;

View File

@ -47,33 +47,33 @@ using namespace libtorrent;
struct test_storage_impl : storage_interface struct test_storage_impl : storage_interface
{ {
virtual void initialize(storage_error& ec) TORRENT_OVERRIDE {} virtual void initialize(storage_error& ec) override {}
virtual int readv(file::iovec_t const* bufs, int num_bufs virtual int readv(file::iovec_t const* bufs, int num_bufs
, int piece, int offset, int flags, storage_error& ec) TORRENT_OVERRIDE , int piece, int offset, int flags, storage_error& ec) override
{ {
return bufs_size(bufs, num_bufs); return bufs_size(bufs, num_bufs);
} }
virtual int writev(file::iovec_t const* bufs, int num_bufs virtual int writev(file::iovec_t const* bufs, int num_bufs
, int piece, int offset, int flags, storage_error& ec) TORRENT_OVERRIDE , int piece, int offset, int flags, storage_error& ec) override
{ {
return bufs_size(bufs, num_bufs); return bufs_size(bufs, num_bufs);
} }
virtual bool has_any_file(storage_error& ec) TORRENT_OVERRIDE { return false; } virtual bool has_any_file(storage_error& ec) override { return false; }
virtual void set_file_priority(std::vector<boost::uint8_t> const& prio virtual void set_file_priority(std::vector<boost::uint8_t> const& prio
, storage_error& ec) TORRENT_OVERRIDE {} , storage_error& ec) override {}
virtual int move_storage(std::string const& save_path, int flags virtual int move_storage(std::string const& save_path, int flags
, storage_error& ec) TORRENT_OVERRIDE { return 0; } , storage_error& ec) override { return 0; }
virtual bool verify_resume_data(add_torrent_params const& rd virtual bool verify_resume_data(add_torrent_params const& rd
, std::vector<std::string> const* links , std::vector<std::string> const* links
, storage_error& ec) TORRENT_OVERRIDE { return true; } , storage_error& ec) override { return true; }
virtual void release_files(storage_error& ec) TORRENT_OVERRIDE {} virtual void release_files(storage_error& ec) override {}
virtual void rename_file(int index, std::string const& new_filenamem virtual void rename_file(int index, std::string const& new_filenamem
, storage_error& ec) TORRENT_OVERRIDE {} , storage_error& ec) override {}
virtual void delete_files(int, storage_error& ec) TORRENT_OVERRIDE {} virtual void delete_files(int, storage_error& ec) override {}
#ifndef TORRENT_NO_DEPRECATE #ifndef TORRENT_NO_DEPRECATE
virtual void finalize_file(int, storage_error&) TORRENT_OVERRIDE {} virtual void finalize_file(int, storage_error&) override {}
#endif #endif
}; };

View File

@ -95,10 +95,10 @@ static void nop(void* userdata, libtorrent::dht::node_entry const& n) {}
std::list<std::pair<udp::endpoint, entry> > g_sent_packets; std::list<std::pair<udp::endpoint, entry> > g_sent_packets;
struct mock_socket TORRENT_FINAL : udp_socket_interface struct mock_socket final : udp_socket_interface
{ {
bool has_quota() TORRENT_OVERRIDE { return true; } bool has_quota() override { return true; }
bool send_packet(entry& msg, udp::endpoint const& ep) TORRENT_OVERRIDE bool send_packet(entry& msg, udp::endpoint const& ep) override
{ {
// TODO: ideally the mock_socket would contain this queue of packets, to // TODO: ideally the mock_socket would contain this queue of packets, to
// make tests independent // make tests independent
@ -476,18 +476,18 @@ void put_immutable_item_cb(int num, int expect)
struct obs : dht::dht_observer struct obs : dht::dht_observer
{ {
virtual void set_external_address(address const& addr virtual void set_external_address(address const& addr
, address const& source) TORRENT_OVERRIDE , address const& source) override
{} {}
virtual address external_address(udp proto) TORRENT_OVERRIDE virtual address external_address(udp proto) override
{ {
return address_v4::from_string("236.0.0.1"); return address_v4::from_string("236.0.0.1");
} }
virtual void get_peers(sha1_hash const& ih) TORRENT_OVERRIDE {} virtual void get_peers(sha1_hash const& ih) override {}
virtual void outgoing_get_peers(sha1_hash const& target virtual void outgoing_get_peers(sha1_hash const& target
, sha1_hash const& sent_target, udp::endpoint const& ep) TORRENT_OVERRIDE {} , sha1_hash const& sent_target, udp::endpoint const& ep) override {}
virtual void announce(sha1_hash const& ih, address const& addr, int port) TORRENT_OVERRIDE {} virtual void announce(sha1_hash const& ih, address const& addr, int port) override {}
virtual void log(dht_logger::module_t l, char const* fmt, ...) TORRENT_OVERRIDE virtual void log(dht_logger::module_t l, char const* fmt, ...) override
{ {
va_list v; va_list v;
va_start(v, fmt); va_start(v, fmt);
@ -497,9 +497,9 @@ struct obs : dht::dht_observer
m_log.push_back(buf); m_log.push_back(buf);
} }
virtual void log_packet(message_direction_t dir, char const* pkt, int len virtual void log_packet(message_direction_t dir, char const* pkt, int len
, udp::endpoint node) TORRENT_OVERRIDE {} , udp::endpoint node) override {}
virtual bool on_dht_request(char const* query, int query_len virtual bool on_dht_request(char const* query, int query_len
, dht::msg const& request, entry& response) TORRENT_OVERRIDE { return false; } , dht::msg const& request, entry& response) override { return false; }
std::vector<std::string> m_log; std::vector<std::string> m_log;
}; };

View File

@ -45,7 +45,7 @@ using namespace libtorrent;
struct log_t : libtorrent::dht::dht_logger struct log_t : libtorrent::dht::dht_logger
{ {
virtual void log(dht_logger::module_t m, char const* fmt, ...) virtual void log(dht_logger::module_t m, char const* fmt, ...)
TORRENT_OVERRIDE TORRENT_FORMAT(3, 4) override TORRENT_FORMAT(3, 4)
{ {
va_list v; va_list v;
va_start(v, fmt); va_start(v, fmt);
@ -54,7 +54,7 @@ struct log_t : libtorrent::dht::dht_logger
} }
virtual void log_packet(message_direction_t dir, char const* pkt, int len virtual void log_packet(message_direction_t dir, char const* pkt, int len
, udp::endpoint node) TORRENT_OVERRIDE , udp::endpoint node) override
{ {
libtorrent::bdecode_node print; libtorrent::bdecode_node print;
libtorrent::error_code ec; libtorrent::error_code ec;