forked from premiere/premiere-libtorrent
deprecate the error_file_* constants whose underlying features have been deprecated
This commit is contained in:
parent
f8889858f6
commit
8658fb5f7c
|
@ -48,10 +48,22 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
namespace libtorrent {
|
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
|
// holds a snapshot of the status of a torrent, as queried by
|
||||||
// torrent_handle::status().
|
// torrent_handle::status().
|
||||||
struct TORRENT_EXPORT torrent_status
|
struct TORRENT_EXPORT torrent_status
|
||||||
{
|
{
|
||||||
|
#ifndef TORRENT_NO_DEPRECATE
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
// hidden
|
// hidden
|
||||||
torrent_status() noexcept;
|
torrent_status() noexcept;
|
||||||
~torrent_status();
|
~torrent_status();
|
||||||
|
@ -137,15 +149,17 @@ namespace libtorrent {
|
||||||
// the error did not occur on a file
|
// the error did not occur on a file
|
||||||
static constexpr file_index_t error_file_none{-1};
|
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
|
// the error occurred setting up the SSL context
|
||||||
static constexpr file_index_t error_file_ssl_ctx{-3};
|
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
|
// the error occurred while loading the .torrent file via the user
|
||||||
// supplied load function
|
// 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
|
// there was a serious error reported in this torrent. The error code
|
||||||
// or a torrent log alert may provide more information.
|
// or a torrent log alert may provide more information.
|
||||||
|
|
|
@ -8187,13 +8187,13 @@ namespace libtorrent {
|
||||||
std::string torrent::resolve_filename(file_index_t const file) const
|
std::string torrent::resolve_filename(file_index_t const file) const
|
||||||
{
|
{
|
||||||
if (file == torrent_status::error_file_none) return "";
|
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_ssl_ctx) return "SSL Context";
|
||||||
if (file == torrent_status::error_file_exception) return "exception";
|
if (file == torrent_status::error_file_exception) return "exception";
|
||||||
if (file == torrent_status::error_file_partfile) return "partfile";
|
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)";
|
if (file == torrent_status::error_file_metadata) return "metadata (from user load function)";
|
||||||
|
#endif
|
||||||
|
|
||||||
if (m_storage && file >= file_index_t(0))
|
if (m_storage && file >= file_index_t(0))
|
||||||
{
|
{
|
||||||
|
|
|
@ -35,11 +35,14 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
namespace libtorrent {
|
namespace libtorrent {
|
||||||
|
|
||||||
file_index_t constexpr torrent_status::error_file_none;
|
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_ssl_ctx;
|
||||||
file_index_t constexpr torrent_status::error_file_exception;
|
file_index_t constexpr torrent_status::error_file_exception;
|
||||||
file_index_t constexpr torrent_status::error_file_partfile;
|
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;
|
file_index_t constexpr torrent_status::error_file_metadata;
|
||||||
|
#endif
|
||||||
|
|
||||||
torrent_status::torrent_status() noexcept {}
|
torrent_status::torrent_status() noexcept {}
|
||||||
torrent_status::~torrent_status() = default;
|
torrent_status::~torrent_status() = default;
|
||||||
|
|
|
@ -455,9 +455,11 @@ TORRENT_TEST(async_load_deprecated)
|
||||||
TORRENT_TEST(torrent_status)
|
TORRENT_TEST(torrent_status)
|
||||||
{
|
{
|
||||||
TEST_EQUAL(static_cast<int>(torrent_status::error_file_none), -1);
|
TEST_EQUAL(static_cast<int>(torrent_status::error_file_none), -1);
|
||||||
|
#ifndef TORRENT_NO_DEPRECATE
|
||||||
TEST_EQUAL(static_cast<int>(torrent_status::error_file_url), -2);
|
TEST_EQUAL(static_cast<int>(torrent_status::error_file_url), -2);
|
||||||
TEST_EQUAL(static_cast<int>(torrent_status::error_file_ssl_ctx), -3);
|
|
||||||
TEST_EQUAL(static_cast<int>(torrent_status::error_file_metadata), -4);
|
TEST_EQUAL(static_cast<int>(torrent_status::error_file_metadata), -4);
|
||||||
|
#endif
|
||||||
|
TEST_EQUAL(static_cast<int>(torrent_status::error_file_ssl_ctx), -3);
|
||||||
TEST_EQUAL(static_cast<int>(torrent_status::error_file_exception), -5);
|
TEST_EQUAL(static_cast<int>(torrent_status::error_file_exception), -5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue