fix warnings
This commit is contained in:
parent
36801fb96f
commit
3fb05d77d8
12
src/file.cpp
12
src/file.cpp
|
@ -315,11 +315,23 @@ namespace {
|
|||
}
|
||||
} // namespace
|
||||
# else
|
||||
|
||||
# ifdef __clang__
|
||||
# pragma clang diagnostic push
|
||||
# pragma clang diagnostic ignored "-Wreserved-id-macro"
|
||||
# pragma clang diagnostic ignored "-Wunused-macros"
|
||||
# endif
|
||||
|
||||
# undef _BSD_SOURCE
|
||||
# define _BSD_SOURCE // deprecated since glibc 2.20
|
||||
# undef _DEFAULT_SOURCE
|
||||
# define _DEFAULT_SOURCE
|
||||
# include <sys/uio.h>
|
||||
|
||||
# ifdef __clang__
|
||||
# pragma clang diagnostic pop
|
||||
# endif
|
||||
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
|
13
src/path.cpp
13
src/path.cpp
|
@ -140,10 +140,16 @@ namespace libtorrent {
|
|||
std::string convert_from_native_path(char const* s) { return convert_from_native(s); }
|
||||
#endif
|
||||
|
||||
template <typename T>
|
||||
std::unique_ptr<T, decltype(&std::free)> make_free_holder(T* ptr)
|
||||
namespace {
|
||||
struct free_function
|
||||
{
|
||||
return std::unique_ptr<T, decltype(&std::free)>(ptr, &std::free);
|
||||
void operator()(void* ptr) const noexcept { std::free(ptr); }
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
std::unique_ptr<T, free_function> make_free_holder(T* ptr)
|
||||
{
|
||||
return std::unique_ptr<T, free_function>(ptr, free_function{});
|
||||
}
|
||||
|
||||
#ifdef TORRENT_WINDOWS
|
||||
|
@ -158,6 +164,7 @@ namespace libtorrent {
|
|||
return time_t(ft / 10000000 - posix_time_offset);
|
||||
}
|
||||
#endif
|
||||
} // anonymous namespace
|
||||
|
||||
native_path_string convert_to_native_path_string(std::string const& path)
|
||||
{
|
||||
|
|
|
@ -115,9 +115,11 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#ifdef TORRENT_USE_LIBGCRYPT
|
||||
|
||||
#if GCRYPT_VERSION_NUMBER < 0x010600
|
||||
extern "C" {
|
||||
GCRY_THREAD_OPTION_PTHREAD_IMPL;
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -126,11 +128,13 @@ namespace {
|
|||
{
|
||||
gcrypt_setup()
|
||||
{
|
||||
gcry_check_version(0);
|
||||
gcry_check_version(nullptr);
|
||||
#if GCRYPT_VERSION_NUMBER < 0x010600
|
||||
gcry_error_t e = gcry_control(GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
|
||||
if (e != 0) std::fprintf(stderr, "libcrypt ERROR: %s\n", gcry_strerror(e));
|
||||
e = gcry_control(GCRYCTL_INITIALIZATION_FINISHED, 0);
|
||||
if (e != 0) std::fprintf(stderr, "initialization finished error: %s\n", gcry_strerror(e));
|
||||
#endif
|
||||
}
|
||||
} gcrypt_global_constructor;
|
||||
}
|
||||
|
@ -475,8 +479,8 @@ namespace aux {
|
|||
session_log("start session");
|
||||
#endif
|
||||
|
||||
error_code ec;
|
||||
#ifdef TORRENT_USE_OPENSSL
|
||||
error_code ec;
|
||||
m_ssl_ctx.set_verify_mode(boost::asio::ssl::context::verify_none, ec);
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x90812f
|
||||
aux::openssl_set_tlsext_servername_callback(m_ssl_ctx.native_handle()
|
||||
|
|
|
@ -887,7 +887,6 @@ void upnp::delete_port_mapping(rootdevice& d, port_mapping_t const i)
|
|||
char const* soap_action = "DeletePortMapping";
|
||||
|
||||
char soap[2048];
|
||||
error_code ec;
|
||||
std::snprintf(soap, sizeof(soap), "<?xml version=\"1.0\"?>\n"
|
||||
"<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" "
|
||||
"s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">"
|
||||
|
|
|
@ -141,7 +141,6 @@ void peer_conn::write_have_all()
|
|||
// unchoke
|
||||
write_uint32(1, ptr);
|
||||
write_uint8(1, ptr);
|
||||
error_code ec;
|
||||
boost::asio::async_write(s, boost::asio::buffer(write_buf_proto.data()
|
||||
, static_cast<std::size_t>(ptr - write_buf_proto.data()))
|
||||
, std::bind(&peer_conn::on_have_all_sent, this, _1, _2));
|
||||
|
@ -158,7 +157,6 @@ void peer_conn::write_have_all()
|
|||
// unchoke
|
||||
write_uint32(1, ptr);
|
||||
write_uint8(1, ptr);
|
||||
error_code ec;
|
||||
boost::asio::async_write(s, boost::asio::buffer(buffer.data()
|
||||
, static_cast<std::size_t>(len + 10))
|
||||
, std::bind(&peer_conn::on_have_all_sent, this, _1, _2));
|
||||
|
@ -224,7 +222,6 @@ bool peer_conn::write_request()
|
|||
write_uint32(current_piece, ptr);
|
||||
write_uint32(block * 16 * 1024, ptr);
|
||||
write_uint32(16 * 1024, ptr);
|
||||
error_code ec;
|
||||
boost::asio::async_write(s, boost::asio::buffer(m, sizeof(msg) - 1)
|
||||
, std::bind(&peer_conn::on_req_sent, this, m, _1, _2));
|
||||
|
||||
|
|
|
@ -96,7 +96,6 @@ TORRENT_TEST(session_get_ip_filter)
|
|||
TORRENT_TEST(ip_filter)
|
||||
{
|
||||
std::vector<ip_range<address_v4>> range;
|
||||
error_code ec;
|
||||
|
||||
// **** test joining of ranges at the end ****
|
||||
ip_range<address_v4> expected1[] =
|
||||
|
|
|
@ -59,9 +59,6 @@ void test_remap_files(storage_mode_t storage_mode = storage_mode_sparse)
|
|||
{
|
||||
using namespace lt;
|
||||
|
||||
// in case the previous run was terminated
|
||||
error_code ec;
|
||||
|
||||
// create a torrent with 2 files, remap them into 3 files and make sure
|
||||
// the file priorities don't break things
|
||||
static std::array<const int, 2> const file_sizes{{100000, 100000}};
|
||||
|
|
|
@ -982,7 +982,7 @@ void alloc_iov(iovec_t* iov, int num_bufs)
|
|||
{
|
||||
for (int i = 0; i < num_bufs; ++i)
|
||||
{
|
||||
iov[i] = { new char[num_bufs * (i + 1)]
|
||||
iov[i] = { new char[static_cast<std::size_t>(num_bufs * (i + 1))]
|
||||
, static_cast<std::size_t>(num_bufs * (i + 1)) };
|
||||
}
|
||||
}
|
||||
|
|
|
@ -636,7 +636,6 @@ TORRENT_TEST(test_have_piece_no_metadata)
|
|||
TORRENT_TEST(test_have_piece_out_of_range)
|
||||
{
|
||||
lt::session ses(settings());
|
||||
error_code ec;
|
||||
|
||||
add_torrent_params p;
|
||||
static std::array<const int, 2> const file_sizes{{100000, 100000}};
|
||||
|
@ -672,7 +671,6 @@ TORRENT_TEST(test_read_piece_no_metadata)
|
|||
TORRENT_TEST(test_read_piece_out_of_range)
|
||||
{
|
||||
lt::session ses(settings());
|
||||
error_code ec;
|
||||
|
||||
add_torrent_params p;
|
||||
static std::array<const int, 2> const file_sizes{{100000, 100000}};
|
||||
|
|
Loading…
Reference in New Issue