From 658442373790528f8964517d757c811166e921d1 Mon Sep 17 00:00:00 2001 From: arvidn Date: Thu, 30 Mar 2017 21:04:48 -0400 Subject: [PATCH] don't include base32encode in the build when i2p is disabled --- include/libtorrent/aux_/escape_string.hpp | 2 ++ src/escape_string.cpp | 2 ++ test/test_string.cpp | 2 ++ 3 files changed, 6 insertions(+) diff --git a/include/libtorrent/aux_/escape_string.hpp b/include/libtorrent/aux_/escape_string.hpp index 4dc34989e..d87688090 100644 --- a/include/libtorrent/aux_/escape_string.hpp +++ b/include/libtorrent/aux_/escape_string.hpp @@ -78,8 +78,10 @@ namespace libtorrent // encodes a string using the base64 scheme TORRENT_EXTRA_EXPORT std::string base64encode(std::string const& s); +#if TORRENT_USE_I2P // encodes a string using the base32 scheme TORRENT_EXTRA_EXPORT std::string base32encode(string_view s, int flags = 0); +#endif TORRENT_EXTRA_EXPORT std::string base32decode(string_view s); TORRENT_EXTRA_EXPORT string_view url_has_argument( diff --git a/src/escape_string.cpp b/src/escape_string.cpp index b1c5365db..d8c1a7fc4 100644 --- a/src/escape_string.cpp +++ b/src/escape_string.cpp @@ -338,6 +338,7 @@ namespace libtorrent return ret; } +#if TORRENT_USE_I2P std::string base32encode(string_view s, int flags) { static char const base32_table_canonical[] = @@ -401,6 +402,7 @@ namespace libtorrent } return ret; } +#endif // TORRENT_USE_I2P std::string base32decode(string_view s) { diff --git a/test/test_string.cpp b/test/test_string.cpp index ac4428246..c83c3bec6 100644 --- a/test/test_string.cpp +++ b/test/test_string.cpp @@ -143,6 +143,7 @@ TORRENT_TEST(base64) TEST_CHECK(base64encode("foobar") == "Zm9vYmFy"); } +#if TORRENT_USE_I2P TORRENT_TEST(base32) { // base32 test vectors from http://www.faqs.org/rfcs/rfc4648.html @@ -159,6 +160,7 @@ TORRENT_TEST(base32) TEST_CHECK(base32encode("fo", string::no_padding) == "MZXQ"); TEST_CHECK(base32encode("foob", string::i2p) == "mzxw6yq"); TEST_CHECK(base32encode("foobar", string::lowercase) == "mzxw6ytboi======"); +#endif // TORRENT_USE_I2P TEST_CHECK(base32decode("") == ""); TEST_CHECK(base32decode("MY======") == "f");