From c5d62cf1cab3e0a75cf4991106205d3063d4e5c8 Mon Sep 17 00:00:00 2001 From: Alden Torres Date: Fri, 2 Feb 2018 02:26:21 -0500 Subject: [PATCH] fixing warnings in tests code, part9 (#2758) --- test/test_bencoding.cpp | 2 +- test/test_buffer.cpp | 9 +-------- test/test_peer_priority.cpp | 2 ++ test/test_ssl.cpp | 5 +++-- 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/test/test_bencoding.cpp b/test/test_bencoding.cpp index fd81ce60f..3b4a5f534 100644 --- a/test/test_bencoding.cpp +++ b/test/test_bencoding.cpp @@ -526,7 +526,7 @@ TORRENT_TEST(lazy_entry) { unsigned char buf[] = { 0x44, 0x91, 0x3a }; - entry ent = bdecode(buf, buf + sizeof(buf)); + entry ent = bdecode(reinterpret_cast(buf), reinterpret_cast(buf) + sizeof(buf)); TEST_CHECK(ent == entry()); } diff --git a/test/test_buffer.cpp b/test/test_buffer.cpp index a4c5a4ac8..9cf834b11 100644 --- a/test/test_buffer.cpp +++ b/test/test_buffer.cpp @@ -188,14 +188,7 @@ struct holder holder(holder const&) = delete; holder& operator=(holder const&) = delete; holder(holder&& rhs) noexcept : m_buf(rhs.m_buf), m_size(rhs.m_size) { rhs.m_buf = nullptr; } - holder& operator=(holder&& rhs) noexcept - { - if (m_buf) free_buffer(m_buf); - m_buf = rhs.m_buf; - m_size = rhs.m_size; - rhs.m_buf = nullptr; - return *this; - } + holder& operator=(holder&& rhs) = delete; char* data() const { return m_buf; } std::size_t size() const { return m_size; } private: diff --git a/test/test_peer_priority.cpp b/test/test_peer_priority.cpp index 698457e95..fd404e9fd 100644 --- a/test/test_peer_priority.cpp +++ b/test/test_peer_priority.cpp @@ -34,7 +34,9 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/hasher.hpp" #include "libtorrent/broadcast_socket.hpp" // for supports_ipv6() #include "setup_transfer.hpp" +#include "libtorrent/aux_/disable_warnings_push.hpp" #include +#include "libtorrent/aux_/disable_warnings_pop.hpp" #include "test.hpp" diff --git a/test/test_ssl.cpp b/test/test_ssl.cpp index d72c9fbb3..a591c5b3c 100644 --- a/test/test_ssl.cpp +++ b/test/test_ssl.cpp @@ -37,6 +37,7 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/torrent_info.hpp" #include "libtorrent/hex.hpp" // for to_hex #include "libtorrent/time.hpp" +#include "libtorrent/aux_/openssl.hpp" #include "test.hpp" #include "test_utils.hpp" @@ -459,7 +460,7 @@ bool try_connect(lt::session& ses1, int port { std::string name = aux::to_hex(t->info_hash()); std::printf("SNI: %s\n", name.c_str()); - SSL_set_tlsext_host_name(ssl_sock.native_handle(), name.c_str()); + aux::openssl_set_tlsext_hostname(ssl_sock.native_handle(), name.c_str()); } else if (flags & invalid_sni_hash) { @@ -470,7 +471,7 @@ bool try_connect(lt::session& ses1, int port name += hex_alphabet[rand() % 16]; std::printf("SNI: %s\n", name.c_str()); - SSL_set_tlsext_host_name(ssl_sock.native_handle(), name.c_str()); + aux::openssl_set_tlsext_hostname(ssl_sock.native_handle(), name.c_str()); } std::printf("SSL handshake\n");