diff --git a/include/libtorrent/add_torrent_params.hpp b/include/libtorrent/add_torrent_params.hpp index 04699f495..6e1d7246d 100644 --- a/include/libtorrent/add_torrent_params.hpp +++ b/include/libtorrent/add_torrent_params.hpp @@ -301,6 +301,7 @@ namespace libtorrent // a list of hostname and port pairs, representing DHT nodes to be added // to the session (if DHT is enabled). The hostname may be an IP address. std::vector> dht_nodes; + std::string name; // the path where the torrent is or will be stored. diff --git a/include/libtorrent/aux_/openssl.hpp b/include/libtorrent/aux_/openssl.hpp index 6280d3c11..563dee23a 100644 --- a/include/libtorrent/aux_/openssl.hpp +++ b/include/libtorrent/aux_/openssl.hpp @@ -57,7 +57,6 @@ inline void openssl_set_tlsext_hostname(SSL* s, char const* name) #endif } -#if BOOST_VERSION >= 104700 #if OPENSSL_VERSION_NUMBER >= 0x90812f inline void openssl_set_tlsext_servername_callback(SSL_CTX* ctx @@ -82,7 +81,6 @@ inline GENERAL_NAME* openssl_general_name_value(GENERAL_NAMES* gens, int i) } #endif // OPENSSL_VERSION_NUMBER -#endif // BOOST_VERSION } } @@ -92,4 +90,3 @@ inline GENERAL_NAME* openssl_general_name_value(GENERAL_NAMES* gens, int i) #endif // TORRENT_USE_OPENSSL #endif // TORRENT_OPENSSL_HPP_INCLUDED - diff --git a/include/libtorrent/broadcast_socket.hpp b/include/libtorrent/broadcast_socket.hpp index 1b4d1e098..81c0517b2 100644 --- a/include/libtorrent/broadcast_socket.hpp +++ b/include/libtorrent/broadcast_socket.hpp @@ -40,13 +40,11 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/error_code.hpp" #include "libtorrent/aux_/disable_warnings_push.hpp" - #include -#include -#include - #include "libtorrent/aux_/disable_warnings_pop.hpp" +#include + namespace libtorrent { diff --git a/include/libtorrent/chained_buffer.hpp b/include/libtorrent/chained_buffer.hpp index 55bf47d40..39147f441 100644 --- a/include/libtorrent/chained_buffer.hpp +++ b/include/libtorrent/chained_buffer.hpp @@ -38,14 +38,11 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/debug.hpp" #include "libtorrent/buffer.hpp" -#include "libtorrent/aux_/disable_warnings_push.hpp" - -#include -#include #include #include -#include // for memcpy +#include "libtorrent/aux_/disable_warnings_push.hpp" +#include #include "libtorrent/aux_/disable_warnings_pop.hpp" namespace libtorrent diff --git a/include/libtorrent/hex.hpp b/include/libtorrent/hex.hpp index f97dfbbc3..0377b895b 100644 --- a/include/libtorrent/hex.hpp +++ b/include/libtorrent/hex.hpp @@ -38,7 +38,6 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/span.hpp" #include -#include namespace libtorrent { @@ -80,4 +79,3 @@ namespace libtorrent } #endif // TORRENT_HEX_HPP_INCLUDED - diff --git a/include/libtorrent/http_seed_connection.hpp b/include/libtorrent/http_seed_connection.hpp index 63b180024..c574fa1b4 100644 --- a/include/libtorrent/http_seed_connection.hpp +++ b/include/libtorrent/http_seed_connection.hpp @@ -51,11 +51,6 @@ namespace libtorrent class torrent; struct peer_request; - namespace detail - { - struct session_impl; - } - class TORRENT_EXTRA_EXPORT http_seed_connection : public web_connection_base { diff --git a/include/libtorrent/kademlia/find_data.hpp b/include/libtorrent/kademlia/find_data.hpp index 6762adc88..e095bda3b 100644 --- a/include/libtorrent/kademlia/find_data.hpp +++ b/include/libtorrent/kademlia/find_data.hpp @@ -40,15 +40,11 @@ POSSIBILITY OF SUCH DAMAGE. #include #include -#include "libtorrent/aux_/disable_warnings_push.hpp" - #include #include -#include -#include -#include - +#include "libtorrent/aux_/disable_warnings_push.hpp" +#include #include "libtorrent/aux_/disable_warnings_pop.hpp" namespace libtorrent { namespace dht @@ -101,4 +97,3 @@ struct find_data_observer : traversal_observer } } // namespace libtorrent::dht #endif // FIND_DATA_050323_HPP - diff --git a/include/libtorrent/kademlia/item.hpp b/include/libtorrent/kademlia/item.hpp index 0b3ae7cb4..51da64e90 100644 --- a/include/libtorrent/kademlia/item.hpp +++ b/include/libtorrent/kademlia/item.hpp @@ -39,10 +39,6 @@ POSSIBILITY OF SUCH DAMAGE. #include #include -#include -#include -#include - namespace libtorrent { namespace dht { diff --git a/include/libtorrent/kademlia/observer.hpp b/include/libtorrent/kademlia/observer.hpp index 875128976..4e2026101 100644 --- a/include/libtorrent/kademlia/observer.hpp +++ b/include/libtorrent/kademlia/observer.hpp @@ -39,10 +39,7 @@ POSSIBILITY OF SUCH DAMAGE. #include #include "libtorrent/aux_/disable_warnings_push.hpp" - -#include #include - #include "libtorrent/aux_/disable_warnings_pop.hpp" namespace libtorrent { @@ -177,4 +174,3 @@ typedef boost::intrusive_ptr observer_ptr; } } #endif - diff --git a/include/libtorrent/kademlia/routing_table.hpp b/include/libtorrent/kademlia/routing_table.hpp index 62caf3f90..5df4137a0 100644 --- a/include/libtorrent/kademlia/routing_table.hpp +++ b/include/libtorrent/kademlia/routing_table.hpp @@ -40,10 +40,6 @@ POSSIBILITY OF SUCH DAMAGE. #include #include -#include "libtorrent/aux_/disable_warnings_push.hpp" -//#include -#include "libtorrent/aux_/disable_warnings_pop.hpp" - #include #include #include @@ -336,4 +332,3 @@ private: } } // namespace libtorrent::dht #endif // ROUTING_TABLE_HPP - diff --git a/include/libtorrent/kademlia/traversal_algorithm.hpp b/include/libtorrent/kademlia/traversal_algorithm.hpp index ccbb34494..73734c37a 100644 --- a/include/libtorrent/kademlia/traversal_algorithm.hpp +++ b/include/libtorrent/kademlia/traversal_algorithm.hpp @@ -42,12 +42,8 @@ POSSIBILITY OF SUCH DAMAGE. #include #include "libtorrent/aux_/disable_warnings_push.hpp" - #include #include -#include -#include - #include "libtorrent/aux_/disable_warnings_pop.hpp" namespace libtorrent { struct dht_lookup; } diff --git a/include/libtorrent/piece_picker.hpp b/include/libtorrent/piece_picker.hpp index 0cc4f3e41..513356c41 100644 --- a/include/libtorrent/piece_picker.hpp +++ b/include/libtorrent/piece_picker.hpp @@ -39,7 +39,6 @@ POSSIBILITY OF SUCH DAMAGE. #include #include -#include #include #include #include diff --git a/include/libtorrent/read_resume_data.hpp b/include/libtorrent/read_resume_data.hpp index da9010aa4..cd1958f6e 100644 --- a/include/libtorrent/read_resume_data.hpp +++ b/include/libtorrent/read_resume_data.hpp @@ -56,4 +56,3 @@ namespace libtorrent } #endif - diff --git a/include/libtorrent/session_stats.hpp b/include/libtorrent/session_stats.hpp index e3921edf4..c2e8a91a8 100644 --- a/include/libtorrent/session_stats.hpp +++ b/include/libtorrent/session_stats.hpp @@ -65,4 +65,3 @@ namespace libtorrent } #endif - diff --git a/include/libtorrent/socket_type.hpp b/include/libtorrent/socket_type.hpp index 5a97a1db8..5657650c0 100644 --- a/include/libtorrent/socket_type.hpp +++ b/include/libtorrent/socket_type.hpp @@ -44,12 +44,6 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/io_service.hpp" #include "libtorrent/assert.hpp" -#include "libtorrent/aux_/disable_warnings_push.hpp" - -#include - -#include "libtorrent/aux_/disable_warnings_pop.hpp" - #ifdef TORRENT_USE_OPENSSL #include "libtorrent/ssl_stream.hpp" #endif diff --git a/include/libtorrent/torrent.hpp b/include/libtorrent/torrent.hpp index 9c1e15b10..c627da0f1 100644 --- a/include/libtorrent/torrent.hpp +++ b/include/libtorrent/torrent.hpp @@ -45,7 +45,6 @@ POSSIBILITY OF SUCH DAMAGE. #include #include -#include #include "libtorrent/aux_/disable_warnings_pop.hpp" @@ -99,12 +98,6 @@ namespace libtorrent class bt_peer_connection; struct listen_socket_t; - - namespace aux - { - struct piece_checker_data; - } - struct time_critical_piece { // when this piece was first requested @@ -1189,9 +1182,7 @@ namespace libtorrent #ifdef TORRENT_USE_OPENSSL boost::shared_ptr m_ssl_ctx; -#if BOOST_VERSION >= 104700 bool verify_peer_cert(bool preverified, boost::asio::ssl::verify_context& ctx); -#endif void init_ssl(std::string const& cert); #endif diff --git a/include/libtorrent/torrent_info.hpp b/include/libtorrent/torrent_info.hpp index ee272cc29..a4c94fb8a 100644 --- a/include/libtorrent/torrent_info.hpp +++ b/include/libtorrent/torrent_info.hpp @@ -414,7 +414,7 @@ namespace libtorrent // for the piece. Note that the string is not 0-terminated. int piece_size(int index) const { return m_files.piece_size(index); } sha1_hash hash_for_piece(int index) const; - char const* hash_for_piece_ptr(int index) const + char const* hash_for_piece_ptr(int const index) const { TORRENT_ASSERT(index >= 0); TORRENT_ASSERT(index < m_files.num_pieces()); @@ -430,7 +430,7 @@ namespace libtorrent TORRENT_ASSERT(m_piece_hashes >= m_info_section.get()); TORRENT_ASSERT(m_piece_hashes < m_info_section.get() + m_info_section_size); TORRENT_ASSERT(index < int(m_info_section_size / 20)); - return &m_piece_hashes[index*20]; + return &m_piece_hashes[index * 20]; } } diff --git a/include/libtorrent/torrent_status.hpp b/include/libtorrent/torrent_status.hpp index 2e8b43223..d490a29d0 100644 --- a/include/libtorrent/torrent_status.hpp +++ b/include/libtorrent/torrent_status.hpp @@ -336,7 +336,7 @@ namespace libtorrent // piece(s). Divide this number by 1000 to get the fraction. // // For example, if ``distributed_full_copies`` is 2 and - // ``distrbuted_fraction`` is 500, it means that the rarest pieces have + // ``distributed_fraction`` is 500, it means that the rarest pieces have // only 2 copies among the peers this torrent is connected to, and that // 50% of all the pieces have more than two copies. // diff --git a/src/broadcast_socket.cpp b/src/broadcast_socket.cpp index 0dc5d63bd..196cb89c7 100644 --- a/src/broadcast_socket.cpp +++ b/src/broadcast_socket.cpp @@ -30,8 +30,6 @@ POSSIBILITY OF SUCH DAMAGE. */ -#include - #include "libtorrent/config.hpp" #include "libtorrent/aux_/disable_warnings_push.hpp" @@ -40,16 +38,13 @@ POSSIBILITY OF SUCH DAMAGE. #include #endif -#include #include -#include "libtorrent/aux_/disable_warnings_pop.hpp" - #ifdef TORRENT_WINDOWS #include // for if_nametoindex #endif -#include +#include "libtorrent/aux_/disable_warnings_pop.hpp" #include "libtorrent/socket.hpp" #include "libtorrent/enum_net.hpp" diff --git a/src/chained_buffer.cpp b/src/chained_buffer.cpp index 398ee1f16..de1f2b945 100644 --- a/src/chained_buffer.cpp +++ b/src/chained_buffer.cpp @@ -33,6 +33,8 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/chained_buffer.hpp" #include "libtorrent/assert.hpp" +#include // for memcpy + namespace libtorrent { void chained_buffer::pop_front(int bytes_to_pop) @@ -123,7 +125,7 @@ namespace libtorrent TORRENT_ASSERT(is_single_thread()); char* insert = allocate_appendix(s); if (insert == nullptr) return nullptr; - memcpy(insert, buf, s); + std::memcpy(insert, buf, s); return insert; } diff --git a/src/kademlia/find_data.cpp b/src/kademlia/find_data.cpp index 652e127a5..2da5969dd 100644 --- a/src/kademlia/find_data.cpp +++ b/src/kademlia/find_data.cpp @@ -41,8 +41,6 @@ POSSIBILITY OF SUCH DAMAGE. #include // to_hex #endif -#include - namespace libtorrent { namespace dht { @@ -178,4 +176,3 @@ void find_data::done() } } } // namespace libtorrent::dht - diff --git a/src/kademlia/item.cpp b/src/kademlia/item.cpp index aeddc4cf7..6e749a1e2 100644 --- a/src/kademlia/item.cpp +++ b/src/kademlia/item.cpp @@ -222,4 +222,3 @@ void item::assign(entry v, span salt } } } // namespace libtorrent::dht - diff --git a/src/read_resume_data.cpp b/src/read_resume_data.cpp index fb1791c8f..c0d28681e 100644 --- a/src/read_resume_data.cpp +++ b/src/read_resume_data.cpp @@ -32,14 +32,9 @@ POSSIBILITY OF SUCH DAMAGE. #include -#include "libtorrent/aux_/disable_warnings_push.hpp" -#include -#include "libtorrent/aux_/disable_warnings_pop.hpp" - #include "libtorrent/bdecode.hpp" #include "libtorrent/read_resume_data.hpp" #include "libtorrent/add_torrent_params.hpp" -#include "libtorrent/announce_entry.hpp" #include "libtorrent/socket_io.hpp" // for read_*_endpoint() #include "libtorrent/hasher.hpp" #include "libtorrent/torrent_info.hpp" @@ -340,4 +335,3 @@ namespace libtorrent return read_resume_data(rd, ec); } } - diff --git a/src/session_impl.cpp b/src/session_impl.cpp index 1ac0ac001..9ff26eb2f 100644 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -257,7 +257,7 @@ namespace aux { #endif } -#if defined TORRENT_USE_OPENSSL && BOOST_VERSION >= 104700 && OPENSSL_VERSION_NUMBER >= 0x90812f +#if defined TORRENT_USE_OPENSSL && OPENSSL_VERSION_NUMBER >= 0x90812f namespace { // when running bittorrent over SSL, the SNI (server name indication) // extension is used to know which torrent the incoming connection is @@ -415,13 +415,11 @@ namespace aux { error_code ec; #ifdef TORRENT_USE_OPENSSL m_ssl_ctx.set_verify_mode(boost::asio::ssl::context::verify_none, ec); -#if BOOST_VERSION >= 104700 #if OPENSSL_VERSION_NUMBER >= 0x90812f aux::openssl_set_tlsext_servername_callback(m_ssl_ctx.native_handle() , servername_callback); aux::openssl_set_tlsext_servername_arg(m_ssl_ctx.native_handle(), this); #endif // OPENSSL_VERSION_NUMBER -#endif // BOOST_VERSION #endif #ifndef TORRENT_DISABLE_DHT diff --git a/src/session_stats.cpp b/src/session_stats.cpp index fef2d48b9..43f68d14b 100644 --- a/src/session_stats.cpp +++ b/src/session_stats.cpp @@ -176,7 +176,7 @@ namespace libtorrent METRIC(net, recv_tracker_bytes) // the number of sockets currently waiting for upload and download - // bandwidht from the rate limiter. + // bandwidth from the rate limiter. METRIC(net, limiter_up_queue) METRIC(net, limiter_down_queue) diff --git a/src/torrent.cpp b/src/torrent.cpp index eec2a79db..ac312053c 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -54,10 +54,7 @@ POSSIBILITY OF SUCH DAMAGE. #ifdef TORRENT_USE_OPENSSL #include "libtorrent/ssl_stream.hpp" #include -#include -#if BOOST_VERSION >= 104700 #include -#endif // BOOST_VERSION #endif // TORRENT_USE_OPENSSL #include "libtorrent/aux_/disable_warnings_pop.hpp" @@ -1481,7 +1478,6 @@ namespace libtorrent #ifdef TORRENT_USE_OPENSSL -#if BOOST_VERSION >= 104700 bool torrent::verify_peer_cert(bool preverified, boost::asio::ssl::verify_context& ctx) { // if the cert wasn't signed by the correct CA, fail the verification @@ -1573,7 +1569,6 @@ namespace libtorrent return false; #endif } -#endif // BOOST_VERSION void torrent::init_ssl(std::string const& cert) { @@ -1590,7 +1585,6 @@ namespace libtorrent TORRENT_ASSERT(RAND_status() == 1); -#if BOOST_VERSION >= 104700 // create the SSL context for this torrent. We need to // inject the root certificate, and no other, to // verify other peers against @@ -1683,10 +1677,6 @@ namespace libtorrent m_ssl_ctx = ctx; // tell the client we need a cert for this torrent alerts().emplace_alert(get_handle()); -#else - set_error(boost::asio::error::operation_not_supported, torrent_status::error_file_ssl_ctx); - pause(); -#endif } #endif // TORRENT_OPENSSL @@ -5694,11 +5684,6 @@ namespace libtorrent { if (!m_ssl_ctx) return; -#if BOOST_VERSION < 105400 - if (alerts().should_post()) - alerts().emplace_alert(get_handle() - , error_code(boost::system::errc::not_supported, generic_category()), "[certificate]"); -#else boost::asio::const_buffer certificate_buf(certificate.c_str(), certificate.size()); using boost::asio::ssl::context; @@ -5725,7 +5710,6 @@ namespace libtorrent if (alerts().should_post()) alerts().emplace_alert(get_handle(), ec, "[dh params]"); } -#endif // BOOST_VERSION } #endif @@ -6905,14 +6889,14 @@ namespace libtorrent (void)ret; TORRENT_ASSERT(ret); -#if defined TORRENT_USE_OPENSSL && BOOST_VERSION >= 104700 +#if defined TORRENT_USE_OPENSSL if (is_ssl_torrent()) { // for ssl sockets, set the hostname std::string host_name = aux::to_hex(m_torrent_file->info_hash()); -#define CASE(t) case socket_type_int_impl >::value: \ - s->get >()->set_host_name(host_name); break; +#define CASE(t) case socket_type_int_impl>::value: \ + s->get>()->set_host_name(host_name); break; switch (s->type()) { @@ -7096,15 +7080,14 @@ namespace libtorrent // INVARIANT_CHECK; #ifdef TORRENT_USE_OPENSSL -#if BOOST_VERSION >= 104700 if (is_ssl_torrent()) { // if this is an SSL torrent, don't allow non SSL peers on it boost::shared_ptr s = p->get_socket(); // -#define SSL(t) socket_type_int_impl >::value: \ - ssl_conn = s->get >()->native_handle(); \ +#define SSL(t) socket_type_int_impl>::value: \ + ssl_conn = s->get>()->native_handle(); \ break; SSL* ssl_conn = nullptr; @@ -7144,13 +7127,6 @@ namespace libtorrent return false; } } -#else // BOOST_VERSION - if (is_ssl_torrent()) - { - p->disconnect(boost::asio::error::operation_not_supported, op_bittorrent); - return false; - } -#endif #else // TORRENT_USE_OPENSSL if (is_ssl_torrent()) { diff --git a/src/torrent_info.cpp b/src/torrent_info.cpp index 06f56828c..1ac04f822 100644 --- a/src/torrent_info.cpp +++ b/src/torrent_info.cpp @@ -1075,7 +1075,7 @@ namespace libtorrent } bool torrent_info::parse_info_section(bdecode_node const& info - , error_code& ec, int flags) + , error_code& ec, int const flags) { TORRENT_UNUSED(flags); if (info.type() != bdecode_node::dict_t) @@ -1129,7 +1129,7 @@ namespace libtorrent if (name.empty()) name = aux::to_hex(m_info_hash); // extract file list - bdecode_node files_node = info.dict_find_list("files"); + bdecode_node const files_node = info.dict_find_list("files"); if (!files_node) { // if there's no list of files, there has to be a length @@ -1264,13 +1264,12 @@ namespace libtorrent bool torrent_info::add_merkle_nodes(std::map const& subtree - , int piece) + , int const piece) { INVARIANT_CHECK; int n = m_merkle_first_leaf + piece; - typedef std::map::const_iterator iter; - iter it = subtree.find(n); + auto const it = subtree.find(n); if (it == subtree.end()) return false; sha1_hash h = it->second; @@ -1282,7 +1281,7 @@ namespace libtorrent { int const sibling = merkle_get_sibling(n); int const parent = merkle_get_parent(n); - iter const sibling_hash = subtree.find(sibling); + auto const sibling_hash = subtree.find(sibling); if (sibling_hash == subtree.end()) return false; to_add[n] = h; @@ -1306,17 +1305,16 @@ namespace libtorrent // the nodes and piece hash matched the root-hash // insert them into our tree - for (std::map::iterator i = to_add.begin() - , end(to_add.end()); i != end; ++i) + for (auto const& i : to_add) { - m_merkle_tree[i->first] = i->second; + m_merkle_tree[i.first] = i.second; } return true; } // builds a list of nodes that are required to verify // the given piece - std::map torrent_info::build_merkle_list(int piece) const + std::map torrent_info::build_merkle_list(int const piece) const { INVARIANT_CHECK; @@ -1338,7 +1336,7 @@ namespace libtorrent } bool torrent_info::parse_torrent_file(bdecode_node const& torrent_file - , error_code& ec, int flags) + , error_code& ec, int const flags) { if (torrent_file.type() != bdecode_node::dict_t) {