more code cleanup, typos, minor refactor in headers (#2795)
This commit is contained in:
parent
c50d6c9593
commit
6e5177beaf
|
@ -74,7 +74,6 @@ namespace libtorrent {
|
|||
|
||||
void close();
|
||||
int num_send_sockets() const { return int(m_unicast_sockets.size()); }
|
||||
void enable_ip_broadcast(bool e);
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
@ -247,9 +247,6 @@ namespace libtorrent {
|
|||
void write_share_mode();
|
||||
void write_holepunch_msg(int type, tcp::endpoint const& ep, int error);
|
||||
#endif
|
||||
void write_metadata(std::pair<int, int> req);
|
||||
void write_metadata_request(std::pair<int, int> req);
|
||||
|
||||
// DHT extension
|
||||
void write_dht_port(int listen_port);
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ public:
|
|||
: buffer(size)
|
||||
{
|
||||
TORRENT_ASSERT(initialize.size() <= size);
|
||||
if (initialize.size() > 0)
|
||||
if (!initialize.empty())
|
||||
{
|
||||
std::memcpy(m_begin, initialize.data(), (std::min)(initialize.size(), size));
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ namespace libtorrent {
|
|||
struct free_deleter
|
||||
{ void operator()(char* ptr) { return std::free(ptr); } };
|
||||
|
||||
inline std::size_t calculate_pad_bytes(char* inptr, std::size_t alignment)
|
||||
inline std::size_t calculate_pad_bytes(char const* inptr, std::size_t alignment)
|
||||
{
|
||||
std::uintptr_t const ptr = reinterpret_cast<std::uintptr_t>(inptr);
|
||||
std::uintptr_t const offset = ptr & (alignment - 1);
|
||||
|
@ -78,7 +78,7 @@ namespace libtorrent {
|
|||
std::size_t const pad_bytes = aux::calculate_pad_bytes(ptr + sizeof(header_t), alignof(U));
|
||||
|
||||
// pad_bytes is only 8 bits in the header, so types that need more than
|
||||
// 256 byte alignment may not be suppored
|
||||
// 256 byte alignment may not be supported
|
||||
static_assert(alignof(U) <= 256
|
||||
, "heterogeneous_queue does not support types with alignment requirements > 256");
|
||||
|
||||
|
@ -207,7 +207,7 @@ namespace libtorrent {
|
|||
static_cast<char*>(std::malloc(std::size_t(m_capacity + amount_to_grow)))
|
||||
, aux::free_deleter());
|
||||
|
||||
if (new_storage.get() == nullptr)
|
||||
if (!new_storage)
|
||||
aux::throw_ex<std::bad_alloc>();
|
||||
|
||||
char* src = m_storage.get();
|
||||
|
|
|
@ -1182,7 +1182,7 @@ namespace aux {
|
|||
|
||||
// pretend that there's an outstanding send operation already, to
|
||||
// prevent future calls to setup_send() from actually causing an
|
||||
// asyc_send() to be issued.
|
||||
// async_send() to be issued.
|
||||
m_pc.m_channel_state[peer_connection::upload_channel] |= peer_info::bw_network;
|
||||
m_need_uncork = true;
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ struct crypto_plugin;
|
|||
struct TORRENT_EXPORT peer_connection_handle
|
||||
{
|
||||
explicit peer_connection_handle(std::weak_ptr<peer_connection> impl)
|
||||
: m_connection(impl)
|
||||
: m_connection(std::move(impl))
|
||||
{}
|
||||
|
||||
connection_type type() const;
|
||||
|
@ -133,7 +133,7 @@ private:
|
|||
struct TORRENT_EXPORT bt_peer_connection_handle : peer_connection_handle
|
||||
{
|
||||
explicit bt_peer_connection_handle(peer_connection_handle pc)
|
||||
: peer_connection_handle(pc)
|
||||
: peer_connection_handle(std::move(pc))
|
||||
{}
|
||||
|
||||
bool packet_finished() const;
|
||||
|
|
|
@ -708,7 +708,7 @@ namespace libtorrent {
|
|||
|
||||
// this maps pieces to a range of blocks that are pad files and should not
|
||||
// be picked
|
||||
// TOOD: this could be a much more efficient data structure
|
||||
// TODO: this could be a much more efficient data structure
|
||||
std::set<piece_block> m_pad_blocks;
|
||||
|
||||
// the number of seeds. These are not added to
|
||||
|
|
|
@ -175,22 +175,6 @@ namespace libtorrent {
|
|||
|
||||
aux::session_settings const& m_sett;
|
||||
|
||||
// this is a copy of the routing table, used
|
||||
// to initialize MTU sizes of uTP sockets
|
||||
mutable std::vector<ip_route> m_routes;
|
||||
|
||||
// the timestamp for the last time we updated
|
||||
// the routing table
|
||||
mutable time_point m_last_route_update = min_time();
|
||||
|
||||
// cache of interfaces
|
||||
mutable std::vector<ip_interface> m_interfaces;
|
||||
mutable time_point m_last_if_update = min_time();
|
||||
|
||||
// the buffer size of the socket. This is used
|
||||
// to now lower the buffer size
|
||||
int m_sock_buf_size = 0;
|
||||
|
||||
// stats counters
|
||||
counters& m_counters;
|
||||
|
||||
|
|
|
@ -377,9 +377,6 @@ struct TORRENT_EXTRA_EXPORT utp_stream
|
|||
issue_read();
|
||||
}
|
||||
|
||||
void do_async_connect(endpoint_type const& ep
|
||||
, std::function<void(error_code const&)> const& handler);
|
||||
|
||||
template <class Protocol>
|
||||
void open(Protocol const&, error_code&)
|
||||
{ m_open = true; }
|
||||
|
|
Loading…
Reference in New Issue