diff --git a/include/libtorrent/torrent_status.hpp b/include/libtorrent/torrent_status.hpp index 2417cde7f..734a2133a 100644 --- a/include/libtorrent/torrent_status.hpp +++ b/include/libtorrent/torrent_status.hpp @@ -48,10 +48,22 @@ POSSIBILITY OF SUCH DAMAGE. namespace libtorrent { +#ifndef TORRENT_NO_DEPRECATE +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif +#endif + // holds a snapshot of the status of a torrent, as queried by // torrent_handle::status(). struct TORRENT_EXPORT torrent_status { +#ifndef TORRENT_NO_DEPRECATE +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif +#endif // hidden torrent_status() noexcept; ~torrent_status(); @@ -137,15 +149,17 @@ namespace libtorrent { // the error did not occur on a file static constexpr file_index_t error_file_none{-1}; - // the error occurred on m_url - static constexpr file_index_t error_file_url{-2}; - // the error occurred setting up the SSL context static constexpr file_index_t error_file_ssl_ctx{-3}; +#ifndef TORRENT_NO_DEPRECATE // the error occurred while loading the .torrent file via the user // supplied load function - static constexpr file_index_t error_file_metadata{-4}; + static constexpr file_index_t TORRENT_DEPRECATED error_file_metadata{-4}; + + // the error occurred on m_url + static constexpr file_index_t TORRENT_DEPRECATED error_file_url{-2}; +#endif // there was a serious error reported in this torrent. The error code // or a torrent log alert may provide more information. diff --git a/src/torrent.cpp b/src/torrent.cpp index 7688d6b57..5558cd285 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -8187,13 +8187,13 @@ namespace libtorrent { std::string torrent::resolve_filename(file_index_t const file) const { if (file == torrent_status::error_file_none) return ""; -#ifndef TORRENT_NO_DEPRECATE - if (file == torrent_status::error_file_url) return m_url; -#endif if (file == torrent_status::error_file_ssl_ctx) return "SSL Context"; if (file == torrent_status::error_file_exception) return "exception"; if (file == torrent_status::error_file_partfile) return "partfile"; +#ifndef TORRENT_NO_DEPRECATE + if (file == torrent_status::error_file_url) return m_url; if (file == torrent_status::error_file_metadata) return "metadata (from user load function)"; +#endif if (m_storage && file >= file_index_t(0)) { diff --git a/src/torrent_status.cpp b/src/torrent_status.cpp index 8039cc052..dfd623a8a 100644 --- a/src/torrent_status.cpp +++ b/src/torrent_status.cpp @@ -35,11 +35,14 @@ POSSIBILITY OF SUCH DAMAGE. namespace libtorrent { file_index_t constexpr torrent_status::error_file_none; - file_index_t constexpr torrent_status::error_file_url; file_index_t constexpr torrent_status::error_file_ssl_ctx; file_index_t constexpr torrent_status::error_file_exception; file_index_t constexpr torrent_status::error_file_partfile; + +#ifndef TORRENT_NO_DEPRECATE + file_index_t constexpr torrent_status::error_file_url; file_index_t constexpr torrent_status::error_file_metadata; +#endif torrent_status::torrent_status() noexcept {} torrent_status::~torrent_status() = default; diff --git a/test/test_torrent.cpp b/test/test_torrent.cpp index 0791e12b5..2f777a968 100644 --- a/test/test_torrent.cpp +++ b/test/test_torrent.cpp @@ -455,9 +455,11 @@ TORRENT_TEST(async_load_deprecated) TORRENT_TEST(torrent_status) { TEST_EQUAL(static_cast(torrent_status::error_file_none), -1); +#ifndef TORRENT_NO_DEPRECATE TEST_EQUAL(static_cast(torrent_status::error_file_url), -2); - TEST_EQUAL(static_cast(torrent_status::error_file_ssl_ctx), -3); TEST_EQUAL(static_cast(torrent_status::error_file_metadata), -4); +#endif + TEST_EQUAL(static_cast(torrent_status::error_file_ssl_ctx), -3); TEST_EQUAL(static_cast(torrent_status::error_file_exception), -5); }