diff --git a/.travis.yml b/.travis.yml index 751c809a7..5c405bc0e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -79,7 +79,7 @@ install: - 'if [[ $toolset == "gcc-arm" ]]; then echo "using gcc : arm : ccache armv8l-linux-gnueabihf-g++ : \"-std=c++11 -fsigned-char -march=armv8-a+crc -mfpu=crypto-neon-fp-armv8 -DTORRENT_FORCE_ARM_CRC32\" -lm ;" >> ~/user-config.jam; fi;' - - 'echo "using darwin : : ccache clang++ : -std=c11 -std=c++11 -Wno-deprecated-declarations ;" >> ~/user-config.jam' + - 'echo "using darwin : : ccache clang++ : -std=c11 -std=c++11 ;" >> ~/user-config.jam' - 'echo "using python : 2.7 ;" >> ~/user-config.jam' - if [ "$docs" == "1" ]; then rst2html.py --version; fi diff --git a/include/libtorrent/aux_/openssl.hpp b/include/libtorrent/aux_/openssl.hpp index 563dee23a..59b23bcf6 100644 --- a/include/libtorrent/aux_/openssl.hpp +++ b/include/libtorrent/aux_/openssl.hpp @@ -33,6 +33,22 @@ POSSIBILITY OF SUCH DAMAGE. #ifndef TORRENT_OPENSSL_HPP_INCLUDED #define TORRENT_OPENSSL_HPP_INCLUDED +#ifdef TORRENT_USE_LIBCRYPTO + +#include "libtorrent/config.hpp" + +#include "libtorrent/aux_/disable_warnings_push.hpp" +#include // for OPENSSL_VERSION_NUMBER +#include "libtorrent/aux_/disable_warnings_pop.hpp" + +#if defined __APPLE__ \ + && MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 \ + && OPENSSL_VERSION_NUMBER <= 0x009081dfL +#define TORRENT_MACOS_DEPRECATED_LIBCRYPTO 1 +#endif + +#endif // TORRENT_USE_LIBCRYPTO + #ifdef TORRENT_USE_OPENSSL // all of OpenSSL causes warnings, so we just have to disable them diff --git a/include/libtorrent/broadcast_socket.hpp b/include/libtorrent/broadcast_socket.hpp index b3b471230..f34f29892 100644 --- a/include/libtorrent/broadcast_socket.hpp +++ b/include/libtorrent/broadcast_socket.hpp @@ -105,11 +105,7 @@ namespace libtorrent address_v4 broadcast_address() const { error_code ec; -#if BOOST_VERSION < 104700 - return address_v4(socket->local_endpoint(ec).address().to_v4().to_ulong() | ((~netmask.to_ulong()) & 0xffffffff)); -#else return address_v4::broadcast(socket->local_endpoint(ec).address().to_v4(), netmask); -#endif } }; diff --git a/include/libtorrent/config.hpp b/include/libtorrent/config.hpp index 40aa3c529..7fbc20e92 100644 --- a/include/libtorrent/config.hpp +++ b/include/libtorrent/config.hpp @@ -39,7 +39,6 @@ POSSIBILITY OF SUCH DAMAGE. #include #include -#include #include "libtorrent/aux_/disable_warnings_pop.hpp" diff --git a/include/libtorrent/debug.hpp b/include/libtorrent/debug.hpp index 68dbffc96..1cab2ecf3 100644 --- a/include/libtorrent/debug.hpp +++ b/include/libtorrent/debug.hpp @@ -211,4 +211,3 @@ namespace libtorrent } #endif // TORRENT_DEBUG_HPP_INCLUDED - diff --git a/include/libtorrent/instantiate_connection.hpp b/include/libtorrent/instantiate_connection.hpp index 3998344b3..6bd3b6ee3 100644 --- a/include/libtorrent/instantiate_connection.hpp +++ b/include/libtorrent/instantiate_connection.hpp @@ -54,4 +54,3 @@ namespace libtorrent } #endif - diff --git a/include/libtorrent/part_file.hpp b/include/libtorrent/part_file.hpp index d4f0897ac..388ddcb88 100644 --- a/include/libtorrent/part_file.hpp +++ b/include/libtorrent/part_file.hpp @@ -111,4 +111,3 @@ namespace libtorrent file m_file; }; } - diff --git a/include/libtorrent/socket_type.hpp b/include/libtorrent/socket_type.hpp index b6ece5624..890deeec5 100644 --- a/include/libtorrent/socket_type.hpp +++ b/include/libtorrent/socket_type.hpp @@ -85,11 +85,11 @@ POSSIBILITY OF SUCH DAMAGE. #define TORRENT_SOCKTYPE_SSL_FORWARD_RET(x, def) \ case socket_type_int_impl>::value: \ - return get >()->x; \ + return get>()->x; \ case socket_type_int_impl>::value: \ - return get >()->x; \ + return get>()->x; \ case socket_type_int_impl>::value: \ - return get >()->x; \ + return get>()->x; \ case socket_type_int_impl>::value: \ return get>()->x; diff --git a/simulation/make_proxy_settings.hpp b/simulation/make_proxy_settings.hpp index 44b709e32..bb71f8726 100644 --- a/simulation/make_proxy_settings.hpp +++ b/simulation/make_proxy_settings.hpp @@ -41,7 +41,7 @@ inline libtorrent::aux::proxy_settings make_proxy_settings( using namespace libtorrent; aux::proxy_settings ps; - ps.type = boost::uint8_t(proxy_type); + ps.type = std::uint8_t(proxy_type); ps.proxy_hostnames = false; // this IP and ports are specific to test_http_connection.cpp if (proxy_type != settings_pack::none) @@ -55,4 +55,3 @@ inline libtorrent::aux::proxy_settings make_proxy_settings( } #endif - diff --git a/simulation/test_optimistic_unchoke.cpp b/simulation/test_optimistic_unchoke.cpp index 3a0d47035..5853afbab 100644 --- a/simulation/test_optimistic_unchoke.cpp +++ b/simulation/test_optimistic_unchoke.cpp @@ -85,8 +85,8 @@ TORRENT_TEST(optimistic_unchoke) auto ses = std::make_shared(std::ref(pack), std::ref(ios)); ses->async_add_torrent(atp); - std::vector > io_service; - std::vector > peers; + std::vector> io_service; + std::vector> peers; print_alerts(*ses); @@ -129,7 +129,7 @@ TORRENT_TEST(optimistic_unchoke) char const* msg_str[] = {"choke", "unchoke"}; lt::time_duration d = lt::clock_type::now() - start_time; - std::uint32_t const millis = boost::uint32_t( + std::uint32_t const millis = std::uint32_t( lt::duration_cast(d).count()); printf("\x1b[35m%4d.%03d: [%d] %s (%d ms)\x1b[0m\n" , millis / 1000, millis % 1000, i, msg_str[msg] @@ -168,4 +168,3 @@ TORRENT_TEST(optimistic_unchoke) TEST_CHECK(std::abs(unchoke_duration - average_unchoke_time) < 1500); } } - diff --git a/simulation/utils.cpp b/simulation/utils.cpp index a31b25f69..1b47c5b42 100644 --- a/simulation/utils.cpp +++ b/simulation/utils.cpp @@ -84,7 +84,7 @@ int get_cache_size(lt::session& ses) ses.post_session_stats(); std::vector alerts; ses.pop_alerts(&alerts); - boost::int64_t cache_size = -1; + std::int64_t cache_size = -1; for (auto const a : alerts) { if (auto const* st = alert_cast(a)) @@ -146,4 +146,3 @@ std::unique_ptr make_io_service(sim::simulation& sim, int return std::unique_ptr(new sim::asio::io_service( sim, lt::address_v4::from_string(ep))); } - diff --git a/src/broadcast_socket.cpp b/src/broadcast_socket.cpp index 88a399c92..11f27287e 100644 --- a/src/broadcast_socket.cpp +++ b/src/broadcast_socket.cpp @@ -258,27 +258,27 @@ namespace libtorrent ++m_outstanding_operations; } - void broadcast_socket::send(char const* buffer, int size, error_code& ec, int flags) + void broadcast_socket::send(char const* buffer, int const size + , error_code& ec, int const flags) { bool all_fail = true; error_code e; - for (std::list::iterator i = m_unicast_sockets.begin() - , end(m_unicast_sockets.end()); i != end; ++i) + for (auto& s : m_unicast_sockets) { - if (!i->socket) continue; - i->socket->send_to(boost::asio::buffer(buffer, size), m_multicast_endpoint, 0, e); + if (!s.socket) continue; + s.socket->send_to(boost::asio::buffer(buffer, size), m_multicast_endpoint, 0, e); // if the user specified the broadcast flag, send one to the broadcast // address as well - if ((flags & broadcast_socket::flag_broadcast) && i->can_broadcast()) - i->socket->send_to(boost::asio::buffer(buffer, size) - , udp::endpoint(i->broadcast_address(), m_multicast_endpoint.port()), 0, e); + if ((flags & broadcast_socket::flag_broadcast) && s.can_broadcast()) + s.socket->send_to(boost::asio::buffer(buffer, size) + , udp::endpoint(s.broadcast_address(), m_multicast_endpoint.port()), 0, e); if (e) { - i->socket->close(e); - i->socket.reset(); + s.socket->close(e); + s.socket.reset(); } else { @@ -286,15 +286,14 @@ namespace libtorrent } } - for (std::list::iterator i = m_sockets.begin() - , end(m_sockets.end()); i != end; ++i) + for (auto& s : m_sockets) { - if (!i->socket) continue; - i->socket->send_to(boost::asio::buffer(buffer, size), m_multicast_endpoint, 0, e); + if (!s.socket) continue; + s.socket->send_to(boost::asio::buffer(buffer, size), m_multicast_endpoint, 0, e); if (e) { - i->socket->close(e); - i->socket.reset(); + s.socket->close(e); + s.socket.reset(); } else { diff --git a/src/hasher.cpp b/src/hasher.cpp index 594149937..f2f782cb3 100644 --- a/src/hasher.cpp +++ b/src/hasher.cpp @@ -33,6 +33,7 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/hasher.hpp" #include "libtorrent/error_code.hpp" #include "libtorrent/assert.hpp" +#include "libtorrent/aux_/openssl.hpp" #if TORRENT_USE_CRYPTOAPI namespace @@ -64,6 +65,11 @@ namespace namespace libtorrent { +#ifdef TORRENT_MACOS_DEPRECATED_LIBCRYPTO +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" +#endif + hasher::hasher() { #ifdef TORRENT_USE_LIBGCRYPT @@ -233,4 +239,8 @@ namespace libtorrent gcry_md_close(m_context); #endif } + +#ifdef TORRENT_MACOS_DEPRECATED_LIBCRYPTO +#pragma clang diagnostic pop +#endif } diff --git a/src/hasher512.cpp b/src/hasher512.cpp index d0f4aca43..25fc260cc 100644 --- a/src/hasher512.cpp +++ b/src/hasher512.cpp @@ -33,6 +33,7 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/hasher512.hpp" #include "libtorrent/error_code.hpp" #include "libtorrent/assert.hpp" +#include "libtorrent/aux_/openssl.hpp" #if TORRENT_USE_CRYPTOAPI namespace @@ -64,6 +65,11 @@ namespace namespace libtorrent { +#ifdef TORRENT_MACOS_DEPRECATED_LIBCRYPTO +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" +#endif + hasher512::hasher512() { #ifdef TORRENT_USE_LIBGCRYPT @@ -221,4 +227,8 @@ namespace libtorrent gcry_md_close(m_context); #endif } + +#ifdef TORRENT_MACOS_DEPRECATED_LIBCRYPTO +#pragma clang diagnostic pop +#endif } diff --git a/src/instantiate_connection.cpp b/src/instantiate_connection.cpp index 9b331c9e8..bc4e04dfa 100644 --- a/src/instantiate_connection.cpp +++ b/src/instantiate_connection.cpp @@ -57,8 +57,8 @@ namespace libtorrent #ifdef TORRENT_USE_OPENSSL if (ssl_context) { - s.instantiate >(ios, ssl_context); - str = &s.get >()->next_layer(); + s.instantiate>(ios, ssl_context); + str = &s.get>()->next_layer(); } else #endif @@ -84,7 +84,7 @@ namespace libtorrent #ifdef TORRENT_USE_OPENSSL if (ssl_context) { - s.instantiate >(ios, ssl_context); + s.instantiate>(ios, ssl_context); } else #endif @@ -99,8 +99,8 @@ namespace libtorrent #ifdef TORRENT_USE_OPENSSL if (ssl_context) { - s.instantiate >(ios, ssl_context); - str = &s.get >()->next_layer(); + s.instantiate>(ios, ssl_context); + str = &s.get>()->next_layer(); } else #endif @@ -121,8 +121,8 @@ namespace libtorrent #ifdef TORRENT_USE_OPENSSL if (ssl_context) { - s.instantiate >(ios, ssl_context); - str = &s.get >()->next_layer(); + s.instantiate>(ios, ssl_context); + str = &s.get>()->next_layer(); } else #endif @@ -145,4 +145,3 @@ namespace libtorrent } } - diff --git a/src/lsd.cpp b/src/lsd.cpp index 8aef939f4..2880a05d7 100644 --- a/src/lsd.cpp +++ b/src/lsd.cpp @@ -90,7 +90,7 @@ lsd::lsd(io_service& ios, peer_callback_t const& cb , m_log_cb(log) #endif , m_broadcast_timer(ios) - , m_cookie((random(0x7fffffff) ^ boost::uintptr_t(this)) & 0x7fffffff) + , m_cookie((random(0x7fffffff) ^ std::uintptr_t(this)) & 0x7fffffff) , m_disabled(false) #if TORRENT_USE_IPV6 , m_disabled6(false) diff --git a/src/part_file.cpp b/src/part_file.cpp index 060e25ffe..528113636 100644 --- a/src/part_file.cpp +++ b/src/part_file.cpp @@ -330,7 +330,7 @@ namespace libtorrent TORRENT_ASSERT(!ec); if (ec || v.iov_len == 0) return; - boost::int64_t ret = f.writev(file_offset, &v, 1, ec); + std::int64_t ret = f.writev(file_offset, &v, 1, ec); TORRENT_ASSERT(ec || ret == v.iov_len); if (ec || ret != v.iov_len) return; @@ -409,11 +409,10 @@ namespace libtorrent slot = i->second; write_uint32(slot, ptr); } - memset(ptr, 0, m_header_size - (ptr - reinterpret_cast(header.get()))); + std::memset(ptr, 0, m_header_size - (ptr - reinterpret_cast(header.get()))); file::iovec_t b = {header.get(), size_t(m_header_size) }; m_file.writev(0, &b, 1, ec); if (ec) return; } } - diff --git a/src/peer_connection.cpp b/src/peer_connection.cpp index 9e1423db7..4585aa5ca 100644 --- a/src/peer_connection.cpp +++ b/src/peer_connection.cpp @@ -5888,10 +5888,17 @@ namespace libtorrent #endif #ifdef TORRENT_USE_OPENSSL +#ifdef TORRENT_MACOS_DEPRECATED_LIBCRYPTO +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" +#endif // add this RTT to the PRNG seed, to add more unpredictability std::uint64_t now = total_microseconds(completed - m_connect); // assume 12 bits of entropy (i.e. about 8 milliseconds) RAND_add(&now, 8, 1.5); +#ifdef TORRENT_MACOS_DEPRECATED_LIBCRYPTO +#pragma clang diagnostic pop +#endif #endif // if t is nullptr, we better not be connecting, since diff --git a/src/random.cpp b/src/random.cpp index 485e97ebc..8cbc4e789 100644 --- a/src/random.cpp +++ b/src/random.cpp @@ -33,6 +33,7 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/config.hpp" #include "libtorrent/random.hpp" #include "libtorrent/error_code.hpp" +#include "libtorrent/aux_/openssl.hpp" #include "libtorrent/aux_/disable_warnings_push.hpp" @@ -94,6 +95,10 @@ namespace libtorrent CryptReleaseContext(prov, 0); #elif defined TORRENT_USE_LIBCRYPTO +#ifdef TORRENT_MACOS_DEPRECATED_LIBCRYPTO +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" +#endif int r = RAND_bytes(reinterpret_cast(buffer.data()) , int(buffer.size())); if (r != 1) @@ -104,6 +109,9 @@ namespace libtorrent std::terminate(); #endif } +#ifdef TORRENT_MACOS_DEPRECATED_LIBCRYPTO +#pragma clang diagnostic pop +#endif #else std::uint32_t s = random(0xffffffff); std::independent_bits_engine generator(s); diff --git a/src/session_impl.cpp b/src/session_impl.cpp index 32f7ebb4c..a99485071 100644 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -156,7 +156,14 @@ namespace // structures it allocates struct openssl_cleanup { +#ifdef TORRENT_MACOS_DEPRECATED_LIBCRYPTO +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" +#endif ~openssl_cleanup() { CRYPTO_cleanup_all_ex_data(); } +#ifdef TORRENT_MACOS_DEPRECATED_LIBCRYPTO +#pragma clang diagnostic pop +#endif } openssl_global_destructor; } @@ -254,6 +261,10 @@ namespace aux { } #if defined TORRENT_USE_OPENSSL && OPENSSL_VERSION_NUMBER >= 0x90812f +#ifdef TORRENT_MACOS_DEPRECATED_LIBCRYPTO +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" +#endif namespace { // when running bittorrent over SSL, the SNI (server name indication) // extension is used to know which torrent the incoming connection is @@ -298,6 +309,9 @@ namespace aux { return SSL_TLSEXT_ERR_OK; } } // anonymous namespace +#ifdef TORRENT_MACOS_DEPRECATED_LIBCRYPTO +#pragma clang diagnostic pop +#endif #endif session_impl::session_impl(io_service& ios) @@ -2552,11 +2566,18 @@ namespace aux { TORRENT_ASSERT(is_single_thread()); #ifdef TORRENT_USE_OPENSSL +#ifdef TORRENT_MACOS_DEPRECATED_LIBCRYPTO +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" +#endif // add the current time to the PRNG, to add more unpredictability std::uint64_t now = clock_type::now().time_since_epoch().count(); // assume 12 bits of entropy (i.e. about 8 milliseconds) RAND_add(&now, 8, 1.5); +#ifdef TORRENT_MACOS_DEPRECATED_LIBCRYPTO +#pragma clang diagnostic pop #endif +#endif // TORRENT_USE_OPENSSL if (m_paused) { diff --git a/src/socket_type.cpp b/src/socket_type.cpp index ea942b1b7..97cd9a801 100644 --- a/src/socket_type.cpp +++ b/src/socket_type.cpp @@ -48,7 +48,7 @@ namespace libtorrent bool is_ssl(socket_type const& s) { #ifdef TORRENT_USE_OPENSSL -#define CASE(t) case socket_type_int_impl >::value: +#define CASE(t) case socket_type_int_impl>::value: switch (s.type()) { CASE(tcp::socket) @@ -69,7 +69,7 @@ namespace libtorrent { return s.get() != nullptr #ifdef TORRENT_USE_OPENSSL - || s.get >() != nullptr + || s.get>() != nullptr #endif ; } @@ -79,7 +79,7 @@ namespace libtorrent { return s.get() != nullptr #ifdef TORRENT_USE_OPENSSL - || s.get >() != nullptr + || s.get>() != nullptr #endif ; } @@ -87,13 +87,17 @@ namespace libtorrent void setup_ssl_hostname(socket_type& s, std::string const& hostname, error_code& ec) { -#if defined TORRENT_USE_OPENSSL && BOOST_VERSION >= 104700 +#if defined TORRENT_USE_OPENSSL +#ifdef TORRENT_MACOS_DEPRECATED_LIBCRYPTO +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" +#endif // for SSL connections, make sure to authenticate the hostname // of the certificate -#define CASE(t) case socket_type_int_impl >::value: \ - s.get >()->set_verify_callback( \ +#define CASE(t) case socket_type_int_impl>::value: \ + s.get>()->set_verify_callback( \ boost::asio::ssl::rfc2818_verification(hostname), ec); \ - ssl = s.get >()->native_handle(); \ + ssl = s.get>()->native_handle(); \ ctx = SSL_get_SSL_CTX(ssl); \ break; @@ -128,6 +132,9 @@ namespace libtorrent TORRENT_UNUSED(ec); TORRENT_UNUSED(hostname); TORRENT_UNUSED(s); +#endif +#ifdef TORRENT_MACOS_DEPRECATED_LIBCRYPTO +#pragma clang diagnostic pop #endif } @@ -330,8 +337,8 @@ namespace libtorrent get()->set_close_reason(code); break; #ifdef TORRENT_USE_OPENSSL - case socket_type_int_impl >::value: - get >()->lowest_layer().set_close_reason(code); + case socket_type_int_impl>::value: + get>()->lowest_layer().set_close_reason(code); break; #endif default: break; @@ -346,7 +353,7 @@ namespace libtorrent return get()->get_close_reason(); #ifdef TORRENT_USE_OPENSSL case socket_type_int_impl>::value: - return get >()->lowest_layer().get_close_reason(); + return get>()->lowest_layer().get_close_reason(); #endif default: return 0; } diff --git a/src/torrent.cpp b/src/torrent.cpp index 35993455e..c7f809869 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -1444,6 +1444,10 @@ namespace libtorrent #endif #ifdef TORRENT_USE_OPENSSL +#ifdef TORRENT_MACOS_DEPRECATED_LIBCRYPTO +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" +#endif bool torrent::verify_peer_cert(bool preverified, boost::asio::ssl::verify_context& ctx) { @@ -1645,7 +1649,9 @@ namespace libtorrent // tell the client we need a cert for this torrent alerts().emplace_alert(get_handle()); } - +#ifdef TORRENT_MACOS_DEPRECATED_LIBCRYPTO +#pragma clang diagnostic pop +#endif #endif // TORRENT_OPENSSL void torrent::construct_storage() @@ -1908,9 +1914,9 @@ namespace libtorrent for (std::vector::iterator i = c.begin(), end(c.end()); i != end; ++i) { - std::vector > ts = m_ses.find_collection(*i); + std::vector> ts = m_ses.find_collection(*i); - for (std::vector >::iterator k = ts.begin() + for (std::vector>::iterator k = ts.begin() , end2(ts.end()); k != end2; ++k) { // Only attempt to reuse files from torrents that are seeding. @@ -5008,7 +5014,7 @@ namespace libtorrent return m_picker->piece_priority(index); } - void torrent::prioritize_piece_list(std::vector > const& pieces) + void torrent::prioritize_piece_list(std::vector> const& pieces) { INVARIANT_CHECK; @@ -5020,18 +5026,17 @@ namespace libtorrent bool filter_updated = false; bool was_finished = is_finished(); - for (std::vector >::const_iterator i = pieces.begin() - , end(pieces.end()); i != end; ++i) + for (auto const& p : pieces) { - TORRENT_ASSERT(i->second >= 0); - TORRENT_ASSERT(i->second <= 7); - TORRENT_ASSERT(i->first >= 0); - TORRENT_ASSERT(i->first < m_torrent_file->num_pieces()); + TORRENT_ASSERT(p.second >= 0); + TORRENT_ASSERT(p.second <= 7); + TORRENT_ASSERT(p.first >= 0); + TORRENT_ASSERT(p.first < m_torrent_file->num_pieces()); - if (i->first < 0 || i->first >= m_torrent_file->num_pieces() || i->second < 0 || i->second > 7) + if (p.first < 0 || p.first >= m_torrent_file->num_pieces() || p.second < 0 || p.second > 7) continue; - filter_updated |= m_picker->set_piece_priority(i->first, i->second); + filter_updated |= m_picker->set_piece_priority(p.first, p.second); TORRENT_ASSERT(num_have() >= m_picker->num_have_filtered()); } update_gauge(); @@ -5773,7 +5778,7 @@ namespace libtorrent #endif peer_connection* peer = static_cast(web->peer_info.connection); - if (peer) + if (peer != nullptr) { // if we have a connection for this web seed, we also need to // disconnect it and clear its reference to the peer_info object @@ -6148,7 +6153,7 @@ namespace libtorrent if (proxy_hostnames && (s->get() #ifdef TORRENT_USE_OPENSSL - || s->get >() + || s->get>() #endif )) { @@ -6156,7 +6161,7 @@ namespace libtorrent // hostnames through it socks5_stream* str = #ifdef TORRENT_USE_OPENSSL - ssl ? &s->get >()->next_layer() : + ssl ? &s->get>()->next_layer() : #endif s->get(); TORRENT_ASSERT_VAL(str, s->type_name()); @@ -6698,7 +6703,7 @@ namespace libtorrent } else { - torrent_peer* tp = static_cast(info[j].peer); + torrent_peer* tp = info[j].peer; TORRENT_ASSERT(tp->in_use); if (tp->connection) { @@ -7036,6 +7041,10 @@ namespace libtorrent // INVARIANT_CHECK; #ifdef TORRENT_USE_OPENSSL +#ifdef TORRENT_MACOS_DEPRECATED_LIBCRYPTO +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" +#endif if (is_ssl_torrent()) { // if this is an SSL torrent, don't allow non SSL peers on it @@ -7083,6 +7092,9 @@ namespace libtorrent return false; } } +#ifdef TORRENT_MACOS_DEPRECATED_LIBCRYPTO +#pragma clang diagnostic pop +#endif #else // TORRENT_USE_OPENSSL if (is_ssl_torrent()) { @@ -7724,10 +7736,10 @@ namespace libtorrent TORRENT_ASSERT(index < int(m_trackers.size())); if (index >= int(m_trackers.size())) return -1; - while (index > 0 && m_trackers[index].tier == m_trackers[index-1].tier) + while (index > 0 && m_trackers[index].tier == m_trackers[index - 1].tier) { using std::swap; - swap(m_trackers[index], m_trackers[index-1]); + swap(m_trackers[index], m_trackers[index - 1]); if (m_last_working_tracker == index) --m_last_working_tracker; else if (m_last_working_tracker == index - 1) ++m_last_working_tracker; --index; @@ -10153,7 +10165,7 @@ namespace libtorrent , timed_out); #endif - // if requested is 0, it meants all blocks have been received, and + // if requested is 0, it means all blocks have been received, and // we're just waiting for it to flush them to disk. // if last_requested is recent enough, we should give it some // more time diff --git a/src/torrent_info.cpp b/src/torrent_info.cpp index 1ac04f822..f74aff2b0 100644 --- a/src/torrent_info.cpp +++ b/src/torrent_info.cpp @@ -375,9 +375,9 @@ namespace libtorrent namespace { - boost::uint32_t get_file_attributes(bdecode_node const& dict) + std::uint32_t get_file_attributes(bdecode_node const& dict) { - boost::uint32_t file_flags = 0; + std::uint32_t file_flags = 0; bdecode_node attr = dict.dict_find_string("attr"); if (attr) { @@ -397,7 +397,7 @@ namespace libtorrent // iterates an array of strings and returns the sum of the lengths of all // strings + one additional character per entry (to account for the presumed - // forward- or backslash to seaprate directory entries) + // forward- or backslash to separate directory entries) int path_length(bdecode_node const& p, error_code& ec) { int ret = 0; @@ -426,11 +426,11 @@ namespace libtorrent { if (dict.type() != bdecode_node::dict_t) return false; - boost::uint32_t file_flags = get_file_attributes(dict); + std::uint32_t file_flags = get_file_attributes(dict); // symlinks have an implied "size" of zero. i.e. they use up 0 bytes of // the torrent payload space - boost::int64_t const file_size = (file_flags & file_storage::flag_symlink) + std::int64_t const file_size = (file_flags & file_storage::flag_symlink) ? 0 : dict.dict_find_int_value("length", -1); if (file_size < 0 ) @@ -439,10 +439,9 @@ namespace libtorrent return false; } - boost::int64_t const mtime = dict.dict_find_int_value("mtime", 0); + std::int64_t const mtime = dict.dict_find_int_value("mtime", 0); std::string path = root_dir; - std::string path_element; char const* filename = nullptr; int filename_len = 0; @@ -1488,7 +1487,7 @@ namespace libtorrent { web_seed_entry ent(maybe_url_encode(url_seeds.string_value().to_string()) , web_seed_entry::url_seed); - if ((m_flags & multifile) && ent.url[ent.url.size()-1] != '/') ent.url += '/'; + if ((m_flags & multifile) && ent.url[ent.url.size() - 1] != '/') ent.url += '/'; m_web_seeds.push_back(ent); } else if (url_seeds && url_seeds.type() == bdecode_node::list_t) @@ -1502,7 +1501,7 @@ namespace libtorrent if (url.string_length() == 0) continue; web_seed_entry ent(maybe_url_encode(url.string_value().to_string()) , web_seed_entry::url_seed); - if ((m_flags & multifile) && ent.url[ent.url.size()-1] != '/') ent.url += '/'; + if ((m_flags & multifile) && ent.url[ent.url.size() - 1] != '/') ent.url += '/'; if (unique.count(ent.url)) continue; unique.insert(ent.url); m_web_seeds.push_back(ent); @@ -1675,4 +1674,3 @@ namespace libtorrent #endif } - diff --git a/test/setup_transfer.cpp b/test/setup_transfer.cpp index 3103613e5..f70d0ab7e 100644 --- a/test/setup_transfer.cpp +++ b/test/setup_transfer.cpp @@ -98,7 +98,7 @@ sha1_hash rand_hash() { sha1_hash ret; for (int i = 0; i < 20; ++i) - ret[i] = boost::uint8_t(lt::random(0xff)); + ret[i] = std::uint8_t(lt::random(0xff)); return ret; } @@ -107,7 +107,7 @@ address rand_v6() { address_v6::bytes_type bytes; for (int i = 0; i < int(bytes.size()); ++i) - bytes[i] = boost::uint8_t(lt::random(0xff)); + bytes[i] = std::uint8_t(lt::random(0xff)); return address_v6(bytes); } #endif @@ -542,7 +542,7 @@ int start_proxy(int proxy_type) s.open(tcp::v4(), ec); if (ec) break; s.bind(tcp::endpoint(address::from_string("127.0.0.1") - , boost::uint16_t(port)), ec); + , std::uint16_t(port)), ec); } while (ec); @@ -749,7 +749,7 @@ std::shared_ptr create_torrent(std::ostream* file } std::vector tmp; - std::back_insert_iterator > out(tmp); + std::back_insert_iterator> out(tmp); entry tor = t.generate(); @@ -919,7 +919,7 @@ setup_transfer(lt::session* ses1, lt::session* ses2, lt::session* ses3 std::fprintf(stderr, "%s: ses1: connecting peer port: %d\n" , time_now_string(), port); tor1.connect_peer(tcp::endpoint(address::from_string("127.0.0.1", ec) - , boost::uint16_t(port))); + , std::uint16_t(port))); if (ses3) { @@ -941,11 +941,11 @@ setup_transfer(lt::session* ses1, lt::session* ses2, lt::session* ses3 std::fprintf(stderr, "ses3: connecting peer port: %d\n", port); tor3.connect_peer(tcp::endpoint( - address::from_string("127.0.0.1", ec), boost::uint16_t(port))); + address::from_string("127.0.0.1", ec), std::uint16_t(port))); std::fprintf(stderr, "ses3: connecting peer port: %d\n", port2); tor3.connect_peer(tcp::endpoint( address::from_string("127.0.0.1", ec) - , boost::uint16_t(port2))); + , std::uint16_t(port2))); } } @@ -967,7 +967,7 @@ int start_web_server(bool ssl, bool chunked_encoding, bool keepalive) s.open(tcp::v4(), ec); if (ec) break; s.bind(tcp::endpoint(address::from_string("127.0.0.1") - , boost::uint16_t(port)), ec); + , std::uint16_t(port)), ec); } while (ec); char buf[200]; @@ -996,7 +996,7 @@ void stop_web_server() tcp::endpoint ep(char const* ip, int port) { error_code ec; - tcp::endpoint ret(address::from_string(ip, ec), boost::uint16_t(port)); + tcp::endpoint ret(address::from_string(ip, ec), std::uint16_t(port)); TEST_CHECK(!ec); return ret; }