From 585a760588b0928706130b0a1ec881c89f999d53 Mon Sep 17 00:00:00 2001 From: Alden Torres Date: Thu, 1 Sep 2016 15:04:58 -0400 Subject: [PATCH] headers cleanup (#1054) headers cleanup --- include/libtorrent/aux_/session_impl.hpp | 24 ++++++++++++++---------- include/libtorrent/disk_io_thread.hpp | 17 ++--------------- include/libtorrent/kademlia/put_data.hpp | 7 ------- include/libtorrent/ssl_stream.hpp | 8 -------- include/libtorrent/vector_utils.hpp | 1 - src/disk_io_thread.cpp | 9 ++------- src/kademlia/node.cpp | 6 ------ src/kademlia/put_data.cpp | 1 - src/session_impl.cpp | 12 ++++-------- src/torrent.cpp | 12 ++++++------ 10 files changed, 28 insertions(+), 69 deletions(-) diff --git a/include/libtorrent/aux_/session_impl.hpp b/include/libtorrent/aux_/session_impl.hpp index e6bc2f019..fe3125e94 100644 --- a/include/libtorrent/aux_/session_impl.hpp +++ b/include/libtorrent/aux_/session_impl.hpp @@ -42,16 +42,6 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/torrent_peer_allocator.hpp" #include "libtorrent/performance_counters.hpp" // for counters -#include -#include -#include -#include -#include -#include -#include -#include // for va_start, va_end -#include - #ifdef TORRENT_USE_OPENSSL #include "libtorrent/ssl_stream.hpp" #endif @@ -93,6 +83,20 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/peer_connection.hpp" #endif +#include +#include +#include +#include +#include +#include +#include +#include // for va_start, va_end +#include + +#include "libtorrent/aux_/disable_warnings_push.hpp" +#include +#include "libtorrent/aux_/disable_warnings_pop.hpp" + namespace libtorrent { diff --git a/include/libtorrent/disk_io_thread.hpp b/include/libtorrent/disk_io_thread.hpp index 6e6bacd9a..2820b33a8 100644 --- a/include/libtorrent/disk_io_thread.hpp +++ b/include/libtorrent/disk_io_thread.hpp @@ -47,30 +47,18 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/performance_counters.hpp" #include "libtorrent/aux_/session_settings.hpp" -#include "libtorrent/aux_/disable_warnings_push.hpp" - -#include -#include -#include -#include -#include #include #include -#ifndef TORRENT_DISABLE_POOL_ALLOCATOR -#include -#endif #include - -#include "libtorrent/aux_/disable_warnings_pop.hpp" - #include +#include namespace libtorrent { class alert; struct add_torrent_params; struct counters; - class alert_manager; + class alert_manager; struct cached_piece_info { @@ -647,4 +635,3 @@ namespace libtorrent } #endif - diff --git a/include/libtorrent/kademlia/put_data.hpp b/include/libtorrent/kademlia/put_data.hpp index b8c828272..40703b666 100644 --- a/include/libtorrent/kademlia/put_data.hpp +++ b/include/libtorrent/kademlia/put_data.hpp @@ -38,14 +38,8 @@ POSSIBILITY OF SUCH DAMAGE. #include #include -#include "libtorrent/aux_/disable_warnings_push.hpp" - -#include -#include #include -#include "libtorrent/aux_/disable_warnings_pop.hpp" - namespace libtorrent { namespace dht { struct msg; @@ -92,4 +86,3 @@ struct put_data_observer : traversal_observer } } // namespace libtorrent::dht #endif // TORRENT_PUT_DATA_HPP - diff --git a/include/libtorrent/ssl_stream.hpp b/include/libtorrent/ssl_stream.hpp index ba2e40920..9bf54369c 100644 --- a/include/libtorrent/ssl_stream.hpp +++ b/include/libtorrent/ssl_stream.hpp @@ -43,18 +43,10 @@ POSSIBILITY OF SUCH DAMAGE. #include #include "libtorrent/aux_/disable_warnings_push.hpp" - -#include #include - -// openssl seems to believe it owns -// this name in every single scope -#undef set_key - #if defined TORRENT_BUILD_SIMULATOR #include "simulator/simulator.hpp" #endif - #include "libtorrent/aux_/disable_warnings_pop.hpp" namespace libtorrent { diff --git a/include/libtorrent/vector_utils.hpp b/include/libtorrent/vector_utils.hpp index 42892e766..7ff1ba50f 100644 --- a/include/libtorrent/vector_utils.hpp +++ b/include/libtorrent/vector_utils.hpp @@ -67,4 +67,3 @@ namespace libtorrent { } #endif - diff --git a/src/disk_io_thread.cpp b/src/disk_io_thread.cpp index 53dd89194..87afca4ca 100644 --- a/src/disk_io_thread.cpp +++ b/src/disk_io_thread.cpp @@ -42,12 +42,6 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/file_pool.hpp" #include "libtorrent/torrent_info.hpp" #include "libtorrent/platform_util.hpp" - -#include -#include -#include -#include - #include "libtorrent/time.hpp" #include "libtorrent/disk_buffer_pool.hpp" #include "libtorrent/disk_io_job.hpp" @@ -55,9 +49,10 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/uncork_interface.hpp" #include "libtorrent/performance_counters.hpp" #include "libtorrent/alert_manager.hpp" - #include "libtorrent/debug.hpp" +#include + #if TORRENT_USE_RLIMIT #include #endif diff --git a/src/kademlia/node.cpp b/src/kademlia/node.cpp index f4bc44c4d..14614c747 100644 --- a/src/kademlia/node.cpp +++ b/src/kademlia/node.cpp @@ -35,13 +35,7 @@ POSSIBILITY OF SUCH DAMAGE. #include #include // for PRId64 et.al. #include - -#include "libtorrent/aux_/disable_warnings_push.hpp" - #include -#include - -#include "libtorrent/aux_/disable_warnings_pop.hpp" #ifndef TORRENT_DISABLE_LOGGING #include "libtorrent/hex.hpp" // to_hex diff --git a/src/kademlia/put_data.cpp b/src/kademlia/put_data.cpp index 659634d96..06306e00c 100644 --- a/src/kademlia/put_data.cpp +++ b/src/kademlia/put_data.cpp @@ -119,4 +119,3 @@ bool put_data::invoke(observer_ptr o) } } } // namespace libtorrent::dht - diff --git a/src/session_impl.cpp b/src/session_impl.cpp index 0a966cbf4..ea70c71fe 100644 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -46,7 +46,6 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/aux_/disable_warnings_push.hpp" -#include #include #if TORRENT_USE_RLIMIT @@ -4209,11 +4208,9 @@ namespace aux { torrent_map::const_iterator i = m_torrents.find(info_hash); #if TORRENT_USE_INVARIANT_CHECKS - for (torrent_map::const_iterator j - = m_torrents.begin(); j != m_torrents.end(); ++j) + for (auto const& te : m_torrents) { - torrent* p = boost::get_pointer(j->second); - TORRENT_ASSERT(p); + TORRENT_ASSERT(te.second); } #endif if (i != m_torrents.end()) return i->second; @@ -6833,10 +6830,9 @@ namespace aux { TORRENT_ASSERT_VAL(unchoked_counter == unchokes, unchokes); TORRENT_ASSERT_VAL(unchoked_counter_optimistic == num_optimistic, num_optimistic); - for (torrent_map::const_iterator j - = m_torrents.begin(); j != m_torrents.end(); ++j) + for (auto const& te : m_torrents) { - TORRENT_ASSERT(boost::get_pointer(j->second)); + TORRENT_ASSERT(te.second); } } #endif // TORRENT_USE_INVARIANT_CHECKS diff --git a/src/torrent.cpp b/src/torrent.cpp index e37182117..a7e3c4969 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -6205,7 +6205,7 @@ namespace libtorrent #endif #ifndef TORRENT_DISABLE_EXTENSIONS - for (auto& ext : m_extensions) + for (auto const& ext : m_extensions) { std::shared_ptr pp(ext->new_connection(peer_connection_handle(c->self()))); @@ -6217,7 +6217,7 @@ namespace libtorrent { TORRENT_ASSERT(!c->m_in_constructor); // add the newly connected peer to this torrent's peer list - sorted_insert(m_connections, boost::get_pointer(c)); + sorted_insert(m_connections, c.get()); update_want_peers(); update_want_tick(); m_ses.insert_peer(c); @@ -6903,7 +6903,7 @@ namespace libtorrent peerinfo->prev_amount_upload = 0; #ifndef TORRENT_DISABLE_EXTENSIONS - for (auto& ext : m_extensions) + for (auto const& ext : m_extensions) { TORRENT_TRY { std::shared_ptr pp(ext->new_connection( @@ -6914,7 +6914,7 @@ namespace libtorrent #endif // add the newly connected peer to this torrent's peer list - sorted_insert(m_connections, boost::get_pointer(c)); + sorted_insert(m_connections, c.get()); m_ses.insert_peer(c); need_peer_list(); m_peer_list->set_connection(peerinfo, c.get()); @@ -6931,7 +6931,7 @@ namespace libtorrent } TORRENT_CATCH (std::exception&) { - peer_iterator i = sorted_find(m_connections, boost::get_pointer(c)); + peer_iterator i = sorted_find(m_connections, c.get()); if (i != m_connections.end()) { m_connections.erase(i); @@ -7036,7 +7036,7 @@ namespace libtorrent return lhs->connected_time() > rhs->connected_time(); } - } // anonymous namespaec + } // anonymous namespace bool torrent::attach_peer(peer_connection* p) {