modernize misc (#898)

modernize misc
This commit is contained in:
Arvid Norberg 2016-07-10 07:34:45 -04:00 committed by GitHub
parent eaea4a81cc
commit a740a49fd6
37 changed files with 64 additions and 117 deletions

View File

@ -75,7 +75,7 @@ namespace
typedef std::forward_iterator_tag iterator_category; typedef std::forward_iterator_tag iterator_category;
FileIter(file_storage const& fs, int i) : m_fs(&fs), m_i(i) {} FileIter(file_storage const& fs, int i) : m_fs(&fs), m_i(i) {}
FileIter(FileIter const& fi) : m_fs(fi.m_fs), m_i(fi.m_i) {} FileIter(FileIter const&) = default;
FileIter() : m_fs(nullptr), m_i(0) {} FileIter() : m_fs(nullptr), m_i(0) {}
libtorrent::file_entry operator*() const libtorrent::file_entry operator*() const
{ return m_fs->at(m_i); } { return m_fs->at(m_i); }
@ -92,12 +92,7 @@ namespace
return m_i - rhs.m_i; return m_i - rhs.m_i;
} }
FileIter& operator=(FileIter const& rhs) FileIter& operator=(FileIter const&) = default;
{
m_fs = rhs.m_fs;
m_i = rhs.m_i;
return *this;
}
file_storage const* m_fs; file_storage const* m_fs;
int m_i; int m_i;

View File

@ -33,6 +33,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include <cstdio> // for snprintf #include <cstdio> // for snprintf
#include <cstdlib> // for atoi #include <cstdlib> // for atoi
#include <cstring> #include <cstring>
#include <utility>
#include "libtorrent/config.hpp" #include "libtorrent/config.hpp"
@ -352,7 +353,7 @@ std::string print_endpoint(libtorrent::tcp::endpoint const& ep)
struct torrent_entry struct torrent_entry
{ {
torrent_entry(libtorrent::torrent_handle h) : handle(h) {} torrent_entry(libtorrent::torrent_handle h) : handle(std::move(h)) {}
libtorrent::torrent_handle handle; libtorrent::torrent_handle handle;
libtorrent::torrent_status status; libtorrent::torrent_status status;
}; };

View File

@ -53,11 +53,12 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/aux_/max_path.hpp" // for TORRENT_MAX_PATH #include "libtorrent/aux_/max_path.hpp" // for TORRENT_MAX_PATH
#include <functional> #include <functional>
#include <utility>
namespace libtorrent { namespace libtorrent {
alert::alert() : m_timestamp(clock_type::now()) {} alert::alert() : m_timestamp(clock_type::now()) {}
alert::~alert() {} alert::~alert() = default;
time_point alert::timestamp() const { return m_timestamp; } time_point alert::timestamp() const { return m_timestamp; }
torrent_alert::torrent_alert(aux::stack_allocator& alloc torrent_alert::torrent_alert(aux::stack_allocator& alloc
@ -148,7 +149,7 @@ namespace libtorrent {
, torrent_handle const& h , torrent_handle const& h
, int p, boost::shared_array<char> d, int s) , int p, boost::shared_array<char> d, int s)
: torrent_alert(alloc, h) : torrent_alert(alloc, h)
, buffer(d) , buffer(std::move(d))
, piece(p) , piece(p)
, size(s) , size(s)
{} {}
@ -1591,7 +1592,7 @@ namespace libtorrent {
: target(nullptr) : target(nullptr)
, public_key(key) , public_key(key)
, signature(sig) , signature(sig)
, salt(s) , salt(std::move(s))
, seq(sequence_number) , seq(sequence_number)
, num_success(n) , num_success(n)
{} {}
@ -1633,7 +1634,7 @@ namespace libtorrent {
, udp::endpoint ep) , udp::endpoint ep)
: info_hash(ih) : info_hash(ih)
, obfuscated_info_hash(obfih) , obfuscated_info_hash(obfih)
, ip(ep) , ip(std::move(ep))
{} {}
std::string dht_outgoing_get_peers_alert::message() const std::string dht_outgoing_get_peers_alert::message() const
@ -1888,7 +1889,7 @@ namespace libtorrent {
dht_pkt_alert::dht_pkt_alert(aux::stack_allocator& alloc dht_pkt_alert::dht_pkt_alert(aux::stack_allocator& alloc
, char const* buf, int size, dht_pkt_alert::direction_t d, udp::endpoint ep) , char const* buf, int size, dht_pkt_alert::direction_t d, udp::endpoint ep)
: dir(d) : dir(d)
, node(ep) , node(std::move(ep))
, m_alloc(alloc) , m_alloc(alloc)
, m_msg_idx(alloc.copy_buffer(buf, size)) , m_msg_idx(alloc.copy_buffer(buf, size))
, m_size(size) , m_size(size)

View File

@ -47,7 +47,7 @@ namespace libtorrent
, m_generation(0) , m_generation(0)
{} {}
alert_manager::~alert_manager() {} alert_manager::~alert_manager() = default;
alert* alert_manager::wait_for_alert(time_duration max_wait) alert* alert_manager::wait_for_alert(time_duration max_wait)
{ {

View File

@ -83,7 +83,7 @@ namespace libtorrent
, triggered_manually(false) , triggered_manually(false)
{} {}
announce_entry::~announce_entry() {} announce_entry::~announce_entry() = default;
int announce_entry::next_announce_in() const int announce_entry::next_announce_in() const
{ return total_seconds(next_announce - aux::time_now()); } { return total_seconds(next_announce - aux::time_now()); }

View File

@ -186,9 +186,7 @@ namespace libtorrent
setup_receive(); setup_receive();
} }
bt_peer_connection::~bt_peer_connection() bt_peer_connection::~bt_peer_connection() = default;
{
}
#if !defined(TORRENT_DISABLE_ENCRYPTION) && !defined(TORRENT_DISABLE_EXTENSIONS) #if !defined(TORRENT_DISABLE_ENCRYPTION) && !defined(TORRENT_DISABLE_EXTENSIONS)
void bt_peer_connection::switch_send_crypto(boost::shared_ptr<crypto_plugin> crypto) void bt_peer_connection::switch_send_crypto(boost::shared_ptr<crypto_plugin> crypto)

View File

@ -315,7 +315,7 @@ namespace libtorrent
ios.run(ec); ios.run(ec);
} }
create_torrent::~create_torrent() {} create_torrent::~create_torrent() = default;
create_torrent::create_torrent(file_storage& fs, int piece_size create_torrent::create_torrent(file_storage& fs, int piece_size
, int pad_file_limit, int flags, int alignment) , int pad_file_limit, int flags, int alignment)

View File

@ -1285,7 +1285,7 @@ namespace libtorrent
} }
#ifndef INVALID_HANDLE_VALUE #ifndef INVALID_HANDLE_VALUE
#define INVALID_HANDLE_VALUE -1 #define INVALID_HANDLE_VALUE (-1)
#endif #endif
#ifdef TORRENT_WINDOWS #ifdef TORRENT_WINDOWS

View File

@ -52,9 +52,7 @@ namespace libtorrent
{ {
} }
file_pool::~file_pool() file_pool::~file_pool() = default;
{
}
#ifdef TORRENT_WINDOWS #ifdef TORRENT_WINDOWS
void set_low_priority(file_handle const& f) void set_low_priority(file_handle const& f)

View File

@ -62,46 +62,14 @@ namespace libtorrent
, m_num_files(0) , m_num_files(0)
{} {}
file_storage::~file_storage() {} file_storage::~file_storage() = default;
// even though this copy constructor and the copy assignment // even though this copy constructor and the copy assignment
// operator are identical to what the compiler would have // operator are identical to what the compiler would have
// generated, they are put here to explicitly make them part // generated, they are put here to explicitly make them part
// of libtorrent and properly exported by the .dll. // of libtorrent and properly exported by the .dll.
file_storage::file_storage(file_storage const& f) file_storage::file_storage(file_storage const&) = default;
: m_piece_length(f.m_piece_length) file_storage& file_storage::operator=(file_storage const&) = default;
, m_num_pieces(f.m_num_pieces)
, m_files(f.m_files)
, m_file_hashes(f.m_file_hashes)
, m_symlinks(f.m_symlinks)
, m_mtime(f.m_mtime)
#ifndef TORRENT_NO_DEPRECATE
, m_file_base(f.m_file_base)
#endif
, m_paths(f.m_paths)
, m_name(f.m_name)
, m_total_size(f.m_total_size)
, m_num_files(f.m_num_files)
{
}
file_storage& file_storage::operator=(file_storage const& f)
{
m_piece_length = f.m_piece_length;
m_num_pieces = f.m_num_pieces;
m_files = f.m_files;
m_file_hashes = f.m_file_hashes;
m_symlinks = f.m_symlinks;
m_mtime = f.m_mtime;
#ifndef TORRENT_NO_DEPRECATE
m_file_base = f.m_file_base;
#endif
m_paths = f.m_paths;
m_name = f.m_name;
m_total_size = f.m_total_size;
m_num_files = f.m_num_files;
return *this;
}
void file_storage::reserve(int num_files) void file_storage::reserve(int num_files)
{ {
@ -227,7 +195,7 @@ namespace libtorrent
, symlink_attribute(false) , symlink_attribute(false)
{} {}
file_entry::~file_entry() {} file_entry::~file_entry() = default;
#endif // TORRENT_NO_DEPRECATE #endif // TORRENT_NO_DEPRECATE
internal_file_entry::~internal_file_entry() internal_file_entry::~internal_file_entry()

View File

@ -130,7 +130,7 @@ namespace libtorrent
return url; return url;
} }
http_parser::~http_parser() {} http_parser::~http_parser() = default;
http_parser::http_parser(int flags) http_parser::http_parser(int flags)
: m_recv_pos(0) : m_recv_pos(0)

View File

@ -51,7 +51,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/hex.hpp" // for is_hex #include "libtorrent/hex.hpp" // for is_hex
using boost::shared_ptr; using boost::shared_ptr;
using libtorrent::aux::session_impl;
namespace libtorrent namespace libtorrent
{ {

View File

@ -98,8 +98,7 @@ namespace libtorrent
, m_io_service(ios) , m_io_service(ios)
{} {}
i2p_connection::~i2p_connection() i2p_connection::~i2p_connection() = default;
{}
void i2p_connection::close(error_code& e) void i2p_connection::close(error_code& e)
{ {

View File

@ -148,8 +148,7 @@ namespace
struct immutable_item_comparator struct immutable_item_comparator
{ {
immutable_item_comparator(std::vector<node_id> const& node_ids) : m_node_ids(node_ids) {} immutable_item_comparator(std::vector<node_id> const& node_ids) : m_node_ids(node_ids) {}
immutable_item_comparator(immutable_item_comparator const& c) immutable_item_comparator(immutable_item_comparator const&) = default;
: m_node_ids(c.m_node_ids) {}
bool operator() (std::pair<node_id, dht_immutable_item> const& lhs bool operator() (std::pair<node_id, dht_immutable_item> const& lhs
, std::pair<node_id, dht_immutable_item> const& rhs) const , std::pair<node_id, dht_immutable_item> const& rhs) const
@ -200,7 +199,7 @@ namespace
m_counters.reset(); m_counters.reset();
} }
~dht_default_storage() override {} ~dht_default_storage() override = default;
#ifndef TORRENT_NO_DEPRECATE #ifndef TORRENT_NO_DEPRECATE
size_t num_torrents() const override { return m_map.size(); } size_t num_torrents() const override { return m_map.size(); }

View File

@ -153,7 +153,7 @@ namespace libtorrent { namespace dht
#endif #endif
} }
dht_tracker::~dht_tracker() {} dht_tracker::~dht_tracker() = default;
void dht_tracker::update_node_id() void dht_tracker::update_node_id()
{ {
@ -673,7 +673,6 @@ namespace libtorrent { namespace dht
bool dht_tracker::send_packet(libtorrent::entry& e, udp::endpoint const& addr) bool dht_tracker::send_packet(libtorrent::entry& e, udp::endpoint const& addr)
{ {
using libtorrent::bencode; using libtorrent::bencode;
using libtorrent::entry;
static char const version_str[] = {'L', 'T' static char const version_str[] = {'L', 'T'
, LIBTORRENT_VERSION_MAJOR, LIBTORRENT_VERSION_MINOR}; , LIBTORRENT_VERSION_MAJOR, LIBTORRENT_VERSION_MINOR};

View File

@ -46,12 +46,6 @@ POSSIBILITY OF SUCH DAMAGE.
namespace libtorrent { namespace dht namespace libtorrent { namespace dht
{ {
using detail::read_endpoint_list;
using detail::read_v4_endpoint;
#if TORRENT_USE_IPV6
using detail::read_v6_endpoint;
#endif
void find_data_observer::reply(msg const& m) void find_data_observer::reply(msg const& m)
{ {
bdecode_node r = m.message.dict_find_dict("r"); bdecode_node r = m.message.dict_find_dict("r");

View File

@ -45,9 +45,6 @@ namespace libtorrent { namespace dht
using detail::read_endpoint_list; using detail::read_endpoint_list;
using detail::read_v4_endpoint; using detail::read_v4_endpoint;
#if TORRENT_USE_IPV6
using detail::read_v6_endpoint;
#endif
void get_peers_observer::reply(msg const& m) void get_peers_observer::reply(msg const& m)
{ {

View File

@ -121,7 +121,7 @@ node::node(udp proto, udp_socket_interface* sock
m_secret[1] = random(); m_secret[1] = random();
} }
node::~node() {} node::~node() = default;
void node::update_node_id() void node::update_node_id()
{ {

View File

@ -125,7 +125,7 @@ void lsd::start(error_code& ec)
#endif #endif
} }
lsd::~lsd() {} lsd::~lsd() = default;
void lsd::announce(sha1_hash const& ih, int listen_port, bool broadcast) void lsd::announce(sha1_hash const& ih, int listen_port, bool broadcast)
{ {

View File

@ -41,7 +41,7 @@ namespace libtorrent
, m_resolver(io_service) , m_resolver(io_service)
{} {}
proxy_base::~proxy_base() {} proxy_base::~proxy_base() = default;
bool proxy_base::handle_error(error_code const& e, boost::shared_ptr<handler_type> const& h) bool proxy_base::handle_error(error_code const& e, boost::shared_ptr<handler_type> const& h)
{ {

View File

@ -41,6 +41,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include <memory> #include <memory>
#include <thread> #include <thread>
#include <functional> #include <functional>
#include <utility>
#include "libtorrent/extensions/ut_pex.hpp" #include "libtorrent/extensions/ut_pex.hpp"
#include "libtorrent/extensions/ut_metadata.hpp" #include "libtorrent/extensions/ut_metadata.hpp"
@ -70,7 +71,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/aux_/session_call.hpp" #include "libtorrent/aux_/session_call.hpp"
using boost::shared_ptr; using boost::shared_ptr;
using boost::weak_ptr;
using libtorrent::aux::session_impl; using libtorrent::aux::session_impl;
namespace libtorrent namespace libtorrent
@ -395,14 +395,14 @@ namespace libtorrent
load_struct_from_settings(def, *this); load_struct_from_settings(def, *this);
} }
session_settings::~session_settings() {} session_settings::~session_settings() = default;
#endif // TORRENT_NO_DEPRECATE #endif // TORRENT_NO_DEPRECATE
session_proxy::session_proxy() = default; session_proxy::session_proxy() = default;
session_proxy::session_proxy(boost::shared_ptr<io_service> ios session_proxy::session_proxy(boost::shared_ptr<io_service> ios
, std::shared_ptr<std::thread> t , std::shared_ptr<std::thread> t
, boost::shared_ptr<aux::session_impl> impl) , boost::shared_ptr<aux::session_impl> impl)
: m_io_service(ios) : m_io_service(std::move(ios))
, m_thread(t) , m_thread(t)
, m_impl(impl) , m_impl(impl)
{} {}

View File

@ -63,15 +63,15 @@ namespace
#pragma clang diagnostic pop #pragma clang diagnostic pop
#endif #endif
#define blk(i) (block->l[i&15] = rol(block->l[(i+13)&15]^block->l[(i+8)&15] \ #define blk(i) (block->l[(i)&15] = rol(block->l[((i)+13)&15]^block->l[((i)+8)&15] \
^block->l[(i+2)&15]^block->l[i&15],1)) ^block->l[((i)+2)&15]^block->l[(i)&15],1))
// (R0+R1), R2, R3, R4 are the different operations used in SHA1 // (R0+R1), R2, R3, R4 are the different operations used in SHA1
#define R0(v,w,x,y,z,i) z+=((w&(x^y))^y)+BlkFun::apply(block, i)+0x5A827999+rol(v,5);w=rol(w,30); #define R0(v,w,x,y,z,i) z+=(((w)&((x)^(y)))^(y))+BlkFun::apply(block, i)+0x5A827999+rol(v,5);(w)=rol(w,30);
#define R1(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk(i)+0x5A827999+rol(v,5);w=rol(w,30); #define R1(v,w,x,y,z,i) z+=(((w)&((x)^(y)))^(y))+blk(i)+0x5A827999+rol(v,5);(w)=rol(w,30);
#define R2(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0x6ED9EBA1+rol(v,5);w=rol(w,30); #define R2(v,w,x,y,z,i) z+=((w)^(x)^(y))+blk(i)+0x6ED9EBA1+rol(v,5);(w)=rol(w,30);
#define R3(v,w,x,y,z,i) z+=(((w|x)&y)|(w&x))+blk(i)+0x8F1BBCDC+rol(v,5);w=rol(w,30); #define R3(v,w,x,y,z,i) z+=((((w)|(x))&(y))|((w)&(x)))+blk(i)+0x8F1BBCDC+rol(v,5);(w)=rol(w,30);
#define R4(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0xCA62C1D6+rol(v,5);w=rol(w,30); #define R4(v,w,x,y,z,i) z+=((w)^(x)^(y))+blk(i)+0xCA62C1D6+rol(v,5);(w)=rol(w,30);
// Hash a single 512-bit block. This is the core of the algorithm. // Hash a single 512-bit block. This is the core of the algorithm.
template <class BlkFun> template <class BlkFun>

View File

@ -42,7 +42,7 @@ namespace libtorrent
class file_storage; class file_storage;
stat_cache::stat_cache() {} stat_cache::stat_cache() {}
stat_cache::~stat_cache() {} stat_cache::~stat_cache() = default;
void stat_cache::set_cache(int i, std::int64_t size) void stat_cache::set_cache(int i, std::int64_t size)
{ {

View File

@ -1486,8 +1486,7 @@ namespace libtorrent
{ {
} }
piece_manager::~piece_manager() piece_manager::~piece_manager() = default;
{}
#if TORRENT_USE_ASSERTS #if TORRENT_USE_ASSERTS
void piece_manager::assert_torrent_refcount() const void piece_manager::assert_torrent_refcount() const

View File

@ -6032,10 +6032,10 @@ namespace libtorrent
tcp::endpoint a(addrs[0], port); tcp::endpoint a(addrs[0], port);
using std::ignore;
std::string hostname; std::string hostname;
error_code ec; error_code ec;
std::string protocol; std::string protocol;
using std::ignore;
std::tie(protocol, ignore, hostname, port, ignore) std::tie(protocol, ignore, hostname, port, ignore)
= parse_url_components(web->url, ec); = parse_url_components(web->url, ec);
if (port == -1) port = protocol == "http" ? 80 : 443; if (port == -1) port = protocol == "http" ? 80 : 443;
@ -6174,9 +6174,9 @@ namespace libtorrent
s->get<http_stream>()->set_no_connect(true); s->get<http_stream>()->set_no_connect(true);
} }
using std::ignore;
std::string hostname; std::string hostname;
error_code ec; error_code ec;
using std::ignore;
std::tie(ignore, ignore, hostname, ignore, ignore) std::tie(ignore, ignore, hostname, ignore, ignore)
= parse_url_components(web->url, ec); = parse_url_components(web->url, ec);
if (ec) if (ec)

View File

@ -957,8 +957,7 @@ namespace libtorrent
TORRENT_UNUSED(flags); TORRENT_UNUSED(flags);
} }
torrent_info::~torrent_info() torrent_info::~torrent_info() = default;
{}
void torrent_info::load(char const* buffer, int size, error_code& ec) void torrent_info::load(char const* buffer, int size, error_code& ec)
{ {

View File

@ -244,8 +244,7 @@ namespace libtorrent
#endif #endif
} }
ipv4_peer::ipv4_peer(ipv4_peer const& p) ipv4_peer::ipv4_peer(ipv4_peer const&) = default;
: torrent_peer(p), addr(p.addr) {}
#if TORRENT_USE_I2P #if TORRENT_USE_I2P
i2p_peer::i2p_peer(char const* dest, bool connectable, int src) i2p_peer::i2p_peer(char const* dest, bool connectable, int src)

View File

@ -108,7 +108,7 @@ namespace libtorrent
, info_hash(nullptr) , info_hash(nullptr)
{} {}
torrent_status::~torrent_status() {} torrent_status::~torrent_status() = default;
} }

View File

@ -32,6 +32,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/aux_/disable_warnings_push.hpp" #include "libtorrent/aux_/disable_warnings_push.hpp"
#include <utility>
#include <vector> #include <vector>
#include <cctype> #include <cctype>
@ -153,7 +154,7 @@ namespace libtorrent
, boost::weak_ptr<request_callback> r) , boost::weak_ptr<request_callback> r)
: timeout_handler(ios) : timeout_handler(ios)
, m_req(req) , m_req(req)
, m_requester(r) , m_requester(std::move(r))
, m_man(man) , m_man(man)
{} {}

View File

@ -108,7 +108,7 @@ void upnp::start()
m_mappings.reserve(10); m_mappings.reserve(10);
} }
upnp::~upnp() {} upnp::~upnp() = default;
void upnp::discover_device() void upnp::discover_device()
{ {

View File

@ -118,14 +118,13 @@ namespace libtorrent
peer_connection::start(); peer_connection::start();
} }
web_connection_base::~web_connection_base() web_connection_base::~web_connection_base() = default;
{}
void web_connection_base::on_connected() void web_connection_base::on_connected()
{ {
boost::shared_ptr<torrent> t = associated_torrent().lock(); boost::shared_ptr<torrent> t = associated_torrent().lock();
TORRENT_ASSERT(t); TORRENT_ASSERT(t);
// this is always a seed // this is always a seed
incoming_have_all(); incoming_have_all();

View File

@ -41,6 +41,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include <cstdlib> #include <cstdlib>
#include <functional> #include <functional>
#include <utility>
using namespace libtorrent; using namespace libtorrent;
using namespace std::placeholders; using namespace std::placeholders;
@ -54,7 +55,7 @@ peer_conn::peer_conn(io_service& ios
, m_mode(mode) , m_mode(mode)
, m_ti(ti) , m_ti(ti)
, read_pos(0) , read_pos(0)
, m_on_msg(on_msg) , m_on_msg(std::move(on_msg))
, state(handshaking) , state(handshaking)
, choked(true) , choked(true)
, current_piece(-1) , current_piece(-1)

View File

@ -48,6 +48,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include <cmath> #include <cmath>
#include <functional> #include <functional>
#include <iostream> #include <iostream>
#include <utility>
struct torrent; struct torrent;
struct peer_connection; struct peer_connection;
@ -69,7 +70,7 @@ struct peer_connection: bandwidth_socket, boost::enable_shared_from_this<peer_co
, m_torrent_bandwidth_channel(torrent_bwc) , m_torrent_bandwidth_channel(torrent_bwc)
, m_priority(prio) , m_priority(prio)
, m_ignore_limits(ignore_limits) , m_ignore_limits(ignore_limits)
, m_name(name) , m_name(std::move(name))
, m_quota(0) , m_quota(0)
{} {}

View File

@ -121,7 +121,7 @@ static void nop() {}
#define WRITE_BLOCK(p, b) \ #define WRITE_BLOCK(p, b) \
wj.flags = disk_io_job::in_progress; \ wj.flags = disk_io_job::in_progress; \
wj.action = disk_io_job::write; \ wj.action = disk_io_job::write; \
wj.d.io.offset = b * 0x4000; \ wj.d.io.offset = (b) * 0x4000; \
wj.d.io.buffer_size = 0x4000; \ wj.d.io.buffer_size = 0x4000; \
wj.piece = p; \ wj.piece = p; \
wj.buffer.disk_block = bc.allocate_buffer("write-test"); \ wj.buffer.disk_block = bc.allocate_buffer("write-test"); \
@ -129,11 +129,11 @@ static void nop() {}
#define READ_BLOCK(p, b, r) \ #define READ_BLOCK(p, b, r) \
rj.action = disk_io_job::read; \ rj.action = disk_io_job::read; \
rj.d.io.offset = b * 0x4000; \ rj.d.io.offset = (b) * 0x4000; \
rj.d.io.buffer_size = 0x4000; \ rj.d.io.buffer_size = 0x4000; \
rj.piece = p; \ rj.piece = p; \
rj.storage = pm; \ rj.storage = pm; \
rj.requester = (void*)r; \ rj.requester = (void*)(r); \
rj.buffer.disk_block = 0; \ rj.buffer.disk_block = 0; \
ret = bc.try_read(&rj) ret = bc.try_read(&rj)
@ -143,12 +143,12 @@ static void nop() {}
rj.d.io.ref.storage = 0 rj.d.io.ref.storage = 0
#define FLUSH(flushing) \ #define FLUSH(flushing) \
for (int i = 0; i < int(sizeof(flushing)/sizeof(flushing[0])); ++i) \ for (int i = 0; i < int(sizeof(flushing)/sizeof((flushing)[0])); ++i) \
{ \ { \
pe->blocks[flushing[i]].pending = true; \ pe->blocks[(flushing)[i]].pending = true; \
bc.inc_block_refcount(pe, 0, block_cache::ref_flushing); \ bc.inc_block_refcount(pe, 0, block_cache::ref_flushing); \
} \ } \
bc.blocks_flushed(pe, flushing, sizeof(flushing)/sizeof(flushing[0])) bc.blocks_flushed(pe, flushing, sizeof(flushing)/sizeof((flushing)[0]))
#define INSERT(p, b) \ #define INSERT(p, b) \
wj.piece = p; \ wj.piece = p; \

View File

@ -38,7 +38,7 @@ struct A
int a; int a;
explicit A(int a_) : a(a_) {} explicit A(int a_) : a(a_) {}
virtual int type() = 0; virtual int type() = 0;
virtual ~A() {} virtual ~A() = default;
}; };
struct B : A struct B : A

View File

@ -67,7 +67,7 @@ struct mock_peer_connection
for (int i = 0; i < 20; ++i) m_id[i] = rand(); for (int i = 0; i < 20; ++i) m_id[i] = rand();
} }
virtual ~mock_peer_connection() {} virtual ~mock_peer_connection() = default;
#if !defined TORRENT_DISABLE_LOGGING #if !defined TORRENT_DISABLE_LOGGING
void peer_log(peer_log_alert::direction_t dir, char const* event void peer_log(peer_log_alert::direction_t dir, char const* event
@ -114,7 +114,7 @@ struct mock_peer_connection
struct mock_torrent struct mock_torrent
{ {
mock_torrent(torrent_state* st) : m_p(nullptr), m_state(st) {} mock_torrent(torrent_state* st) : m_p(nullptr), m_state(st) {}
virtual ~mock_torrent() {} virtual ~mock_torrent() = default;
bool connect_to_peer(torrent_peer* peerinfo, bool ignore_limit = false) bool connect_to_peer(torrent_peer* peerinfo, bool ignore_limit = false)
{ {

View File

@ -110,7 +110,7 @@ struct test_storage : default_storage
return default_storage::writev(bufs, num_bufs, piece_index, offset, flags, se); return default_storage::writev(bufs, num_bufs, piece_index, offset, flags, se);
} }
~test_storage() override {} ~test_storage() override = default;
int m_written; int m_written;
int m_limit; int m_limit;