From 058eb69ce47c17205a41fc667ce66429f09a332a Mon Sep 17 00:00:00 2001 From: fanquake Date: Tue, 11 Oct 2022 16:03:35 +0800 Subject: build: add missing event cflags to libbitcoin_util The fact that this is missing is currently masked by the inclusion of BOOST_CPPFLAGS. --- src/Makefile.am | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am index 6d10f86d57..19b131a5f4 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -710,6 +710,7 @@ libbitcoin_util_a_SOURCES = \ $(BITCOIN_CORE_H) if USE_LIBEVENT +libbitcoin_util_a_CPPFLAGS += $(EVENT_CFLAGS) libbitcoin_util_a_SOURCES += util/url.cpp endif # -- cgit v1.2.3 From 3a0b352c63db543833e0f919a004cf2c5093fe9c Mon Sep 17 00:00:00 2001 From: fanquake Date: Fri, 14 Oct 2022 13:55:53 +0800 Subject: refactor: move url.h/cpp from lib util to lib common --- src/Makefile.am | 13 +++++++------ src/bitcoin-cli.cpp | 2 +- src/bitcoin-wallet.cpp | 2 +- src/bitcoind.cpp | 2 +- src/common/url.cpp | 22 ++++++++++++++++++++++ src/common/url.h | 14 ++++++++++++++ src/qt/main.cpp | 2 +- src/test/fuzz/string.cpp | 2 +- src/test/util/setup_common.cpp | 2 +- src/util/url.cpp | 22 ---------------------- src/util/url.h | 14 -------------- src/wallet/rpc/util.cpp | 2 +- 12 files changed, 50 insertions(+), 49 deletions(-) create mode 100644 src/common/url.cpp create mode 100644 src/common/url.h delete mode 100644 src/util/url.cpp delete mode 100644 src/util/url.h (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am index 19b131a5f4..d50247b52f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -134,6 +134,7 @@ BITCOIN_CORE_H = \ coins.h \ common/bloom.h \ common/run_command.h \ + common/url.h \ compat/assumptions.h \ compat/byteswap.h \ compat/compat.h \ @@ -303,7 +304,6 @@ BITCOIN_CORE_H = \ util/translation.h \ util/types.h \ util/ui_change_type.h \ - util/url.h \ util/vector.h \ validation.h \ validationinterface.h \ @@ -662,6 +662,11 @@ libbitcoin_common_a_SOURCES = \ script/standard.cpp \ warnings.cpp \ $(BITCOIN_CORE_H) + +if USE_LIBEVENT +libbitcoin_common_a_CPPFLAGS += $(EVENT_CFLAGS) +libbitcoin_common_a_SOURCES += common/url.cpp +endif # # util # @@ -708,11 +713,6 @@ libbitcoin_util_a_SOURCES = \ util/time.cpp \ util/tokenpipe.cpp \ $(BITCOIN_CORE_H) - -if USE_LIBEVENT -libbitcoin_util_a_CPPFLAGS += $(EVENT_CFLAGS) -libbitcoin_util_a_SOURCES += util/url.cpp -endif # # cli # @@ -776,6 +776,7 @@ endif bitcoin_cli_LDADD = \ $(LIBBITCOIN_CLI) \ $(LIBUNIVALUE) \ + $(LIBBITCOIN_COMMON) \ $(LIBBITCOIN_UTIL) \ $(LIBBITCOIN_CRYPTO) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index 6d77385584..c06488dbe9 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -9,6 +9,7 @@ #include #include +#include #include #include #include @@ -21,7 +22,6 @@ #include #include #include -#include #include #include diff --git a/src/bitcoin-wallet.cpp b/src/bitcoin-wallet.cpp index d556300ee2..78c1a2060c 100644 --- a/src/bitcoin-wallet.cpp +++ b/src/bitcoin-wallet.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -17,7 +18,6 @@ #include #include #include -#include #include #include diff --git a/src/bitcoind.cpp b/src/bitcoind.cpp index 9f81640ddb..d8d4e34e47 100644 --- a/src/bitcoind.cpp +++ b/src/bitcoind.cpp @@ -9,6 +9,7 @@ #include #include +#include #include #include #include @@ -25,7 +26,6 @@ #include #include #include -#include #include #include diff --git a/src/common/url.cpp b/src/common/url.cpp new file mode 100644 index 0000000000..5200d55096 --- /dev/null +++ b/src/common/url.cpp @@ -0,0 +1,22 @@ +// Copyright (c) 2015-2019 The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#include + +#include + +#include +#include + +std::string urlDecode(const std::string &urlEncoded) { + std::string res; + if (!urlEncoded.empty()) { + char *decoded = evhttp_uridecode(urlEncoded.c_str(), false, nullptr); + if (decoded) { + res = std::string(decoded); + free(decoded); + } + } + return res; +} diff --git a/src/common/url.h b/src/common/url.h new file mode 100644 index 0000000000..7bbd8b60de --- /dev/null +++ b/src/common/url.h @@ -0,0 +1,14 @@ +// Copyright (c) 2015-2020 The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#ifndef BITCOIN_COMMON_URL_H +#define BITCOIN_COMMON_URL_H + +#include + +using UrlDecodeFn = std::string(const std::string& url_encoded); +UrlDecodeFn urlDecode; +extern UrlDecodeFn* const URL_DECODE; + +#endif // BITCOIN_COMMON_URL_H diff --git a/src/qt/main.cpp b/src/qt/main.cpp index e8f39584ad..45131a1cf5 100644 --- a/src/qt/main.cpp +++ b/src/qt/main.cpp @@ -4,9 +4,9 @@ #include +#include #include #include -#include #include diff --git a/src/test/fuzz/string.cpp b/src/test/fuzz/string.cpp index 94399faf04..f6373351d8 100644 --- a/src/test/fuzz/string.cpp +++ b/src/test/fuzz/string.cpp @@ -4,6 +4,7 @@ #include #include +#include #include #include #include @@ -27,7 +28,6 @@ #include #include #include -#include #include #include diff --git a/src/test/util/setup_common.cpp b/src/test/util/setup_common.cpp index 0d0db176f9..bdcff1076b 100644 --- a/src/test/util/setup_common.cpp +++ b/src/test/util/setup_common.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -46,7 +47,6 @@ #include #include #include -#include #include #include #include diff --git a/src/util/url.cpp b/src/util/url.cpp deleted file mode 100644 index ea9323e666..0000000000 --- a/src/util/url.cpp +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) 2015-2019 The Bitcoin Core developers -// Distributed under the MIT software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. - -#include - -#include - -#include -#include - -std::string urlDecode(const std::string &urlEncoded) { - std::string res; - if (!urlEncoded.empty()) { - char *decoded = evhttp_uridecode(urlEncoded.c_str(), false, nullptr); - if (decoded) { - res = std::string(decoded); - free(decoded); - } - } - return res; -} diff --git a/src/util/url.h b/src/util/url.h deleted file mode 100644 index 5a7b11fa04..0000000000 --- a/src/util/url.h +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (c) 2015-2020 The Bitcoin Core developers -// Distributed under the MIT software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. - -#ifndef BITCOIN_UTIL_URL_H -#define BITCOIN_UTIL_URL_H - -#include - -using UrlDecodeFn = std::string(const std::string& url_encoded); -UrlDecodeFn urlDecode; -extern UrlDecodeFn* const URL_DECODE; - -#endif // BITCOIN_UTIL_URL_H diff --git a/src/wallet/rpc/util.cpp b/src/wallet/rpc/util.cpp index 1aa2a87e99..26270f23ed 100644 --- a/src/wallet/rpc/util.cpp +++ b/src/wallet/rpc/util.cpp @@ -4,9 +4,9 @@ #include +#include #include #include -#include #include #include -- cgit v1.2.3