more lint oriented code refactor/cleanup

This commit is contained in:
Alden Torres 2018-06-28 19:40:54 -04:00 committed by Arvid Norberg
parent ab56bf964f
commit 2c5da2778a
6 changed files with 9 additions and 16 deletions

View File

@ -176,7 +176,7 @@ TORRENT_VERSION_NAMESPACE_2
{
// the tracker was part of the .torrent file
source_torrent = 1,
// the tracker was added programatically via the add_tracker() function
// the tracker was added programmatically via the add_tracker() function
source_client = 2,
// the tracker was part of a magnet link
source_magnet_link = 4,

View File

@ -45,13 +45,14 @@ namespace libtorrent { namespace aux {
{
friend struct session_impl;
listen_socket_handle() {}
listen_socket_handle() = default;
listen_socket_handle(std::shared_ptr<listen_socket_t> s) // NOLINT
: m_sock(s)
{}
listen_socket_handle(listen_socket_handle const& o) = default;
listen_socket_handle& operator=(listen_socket_handle const& o) = default;
explicit operator bool() const { return !m_sock.expired(); }
@ -73,12 +74,6 @@ namespace libtorrent { namespace aux {
bool operator<(listen_socket_handle const& o) const
{ return m_sock.owner_before(o.m_sock); }
listen_socket_handle& operator=(listen_socket_handle const& o)
{
m_sock = o.m_sock;
return *this;
}
listen_socket_t* get() const;
private:

View File

@ -297,9 +297,10 @@ namespace aux {
return reinterpret_cast<S const*>(&m_data);
}
private:
// explicitly disallow assignment, to silence msvc warning
socket_type& operator=(socket_type const&);
socket_type& operator=(socket_type const&) = delete;
private:
void destruct();
void construct(int type, void* userdata);

View File

@ -429,4 +429,3 @@ namespace aux {
} // aux
} // libtorrent

View File

@ -65,7 +65,6 @@ namespace libtorrent {
if (m_external_addresses.empty()) return false;
// if there's just one vote, go with that
std::vector<external_ip_t>::iterator i;
if (m_external_addresses.size() == 1)
{
// avoid flapping. We need more votes to change our mind on the
@ -84,7 +83,7 @@ namespace libtorrent {
return false;
}
i = m_external_addresses.begin();
auto const i = m_external_addresses.begin();
bool ret = m_external_address != i->addr;
m_external_address = i->addr;

View File

@ -1015,7 +1015,7 @@ namespace aux {
peer_class_info session_impl::get_peer_class(peer_class_t const cid) const
{
peer_class_info ret;
peer_class_info ret{};
peer_class const* pc = m_classes.at(cid);
// if you hit this assert, you're passing in an invalid cid
TORRENT_ASSERT_PRECOND(pc);
@ -6785,8 +6785,7 @@ namespace aux {
auto i = iface.m_sock.lock();
TORRENT_ASSERT(i);
if (!i) return;
set_external_address(std::static_pointer_cast<listen_socket_t>(i), ip
, source_dht, source);
set_external_address(i, ip, source_dht, source);
}
void session_impl::get_peers(sha1_hash const& ih)