use TORRENT_ABI_VERSION for new error_code_enum deprecated values (#3099)

This commit is contained in:
Alden Torres 2018-06-11 18:46:22 -04:00 committed by Arvid Norberg
parent 0e49051f17
commit 95b753778d
2 changed files with 10 additions and 1 deletions

View File

@ -326,6 +326,7 @@ namespace libtorrent {
// the listen socket associated with this request was closed // the listen socket associated with this request was closed
invalid_listen_socket, invalid_listen_socket,
#if TORRENT_ABI_VERSION == 1
// these error codes are deprecated, NAT-PMP/PCP error codes have // these error codes are deprecated, NAT-PMP/PCP error codes have
// been moved to their own category // been moved to their own category
@ -339,7 +340,13 @@ namespace libtorrent {
no_resources TORRENT_DEPRECATED_ENUM, no_resources TORRENT_DEPRECATED_ENUM,
// The NAT-PMP router failed because an unsupported opcode was sent // The NAT-PMP router failed because an unsupported opcode was sent
unsupported_opcode TORRENT_DEPRECATED_ENUM, unsupported_opcode TORRENT_DEPRECATED_ENUM,
#else
deprecated_120 = 120,
deprecated_121,
deprecated_122,
deprecated_123,
deprecated_124,
#endif
// The resume data file is missing the 'file sizes' entry // The resume data file is missing the 'file sizes' entry

View File

@ -66,8 +66,10 @@ TORRENT_TEST(primitives)
TEST_CHECK(error_code(errors::http_error).message() == "HTTP error"); TEST_CHECK(error_code(errors::http_error).message() == "HTTP error");
TEST_CHECK(error_code(errors::missing_file_sizes).message() TEST_CHECK(error_code(errors::missing_file_sizes).message()
== "missing or invalid 'file sizes' entry"); == "missing or invalid 'file sizes' entry");
#if TORRENT_ABI_VERSION == 1
TEST_CHECK(error_code(errors::unsupported_protocol_version).message() TEST_CHECK(error_code(errors::unsupported_protocol_version).message()
== "unsupported protocol version"); == "unsupported protocol version");
#endif
TEST_CHECK(error_code(errors::no_i2p_router).message() == "no i2p router is set up"); TEST_CHECK(error_code(errors::no_i2p_router).message() == "no i2p router is set up");
TEST_CHECK(error_code(errors::http_parse_error).message() == "Invalid HTTP header"); TEST_CHECK(error_code(errors::http_parse_error).message() == "Invalid HTTP header");
TEST_CHECK(error_code(errors::error_code_max).message() == "Unknown error"); TEST_CHECK(error_code(errors::error_code_max).message() == "Unknown error");