From 819eea722b197d9d7e2cb3994342f926dd12c98a Mon Sep 17 00:00:00 2001 From: Alden Torres Date: Sun, 19 Jan 2020 23:09:44 -0500 Subject: [PATCH] backport of warning related fixes --- include/libtorrent/hex.hpp | 16 ++++++++++++---- src/read_resume_data.cpp | 5 ++++- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/include/libtorrent/hex.hpp b/include/libtorrent/hex.hpp index de6510dcc..ef7db00bc 100644 --- a/include/libtorrent/hex.hpp +++ b/include/libtorrent/hex.hpp @@ -46,22 +46,30 @@ namespace libtorrent { TORRENT_EXTRA_EXPORT int hex_to_int(char in); TORRENT_EXTRA_EXPORT bool is_hex(span in); +#if TORRENT_ABI_VERSION == 1 +#define TORRENT_CONDITIONAL_EXPORT TORRENT_EXPORT +#else +#define TORRENT_CONDITIONAL_EXPORT TORRENT_EXTRA_EXPORT +#endif + // The overload taking a ``std::string`` converts (binary) the string ``s`` // to hexadecimal representation and returns it. // The overload taking a ``char const*`` and a length converts the binary // buffer [``in``, ``in`` + len) to hexadecimal and prints it to the buffer // ``out``. The caller is responsible for making sure the buffer pointed to // by ``out`` is large enough, i.e. has at least len * 2 bytes of space. - TORRENT_DEPRECATED_EXPORT std::string to_hex(span s); - TORRENT_DEPRECATED_EXPORT void to_hex(span in, char* out); - TORRENT_DEPRECATED_EXPORT void to_hex(char const* in, int const len, char* out); + TORRENT_CONDITIONAL_EXPORT std::string to_hex(span s); + TORRENT_CONDITIONAL_EXPORT void to_hex(span in, char* out); + TORRENT_CONDITIONAL_EXPORT void to_hex(char const* in, int const len, char* out); // converts the buffer [``in``, ``in`` + len) from hexadecimal to // binary. The binary output is written to the buffer pointed to // by ``out``. The caller is responsible for making sure the buffer // at ``out`` has enough space for the result to be written to, i.e. // (len + 1) / 2 bytes. - TORRENT_DEPRECATED_EXPORT bool from_hex(span in, char* out); + TORRENT_CONDITIONAL_EXPORT bool from_hex(span in, char* out); + +#undef TORRENT_CONDITIONAL_EXPORT } diff --git a/src/read_resume_data.cpp b/src/read_resume_data.cpp index 92855f337..7a13af4c1 100644 --- a/src/read_resume_data.cpp +++ b/src/read_resume_data.cpp @@ -117,7 +117,10 @@ namespace { } else { - ret.ti->internal_set_creation_date(rd.dict_find_int_value("creation date", 0)); + // time_t might be 32 bit if we're unlucky, but there isn't + // much to do about it + ret.ti->internal_set_creation_date(static_cast( + rd.dict_find_int_value("creation date", 0))); ret.ti->internal_set_creator(rd.dict_find_string_value("created by", "")); ret.ti->internal_set_comment(rd.dict_find_string_value("comment", "")); }