mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 23:18:14 +01:00
[build] Add several util units
Adds the following util units and adds them to libbitcoin_util: - `util/url.cpp` takes `urlDecode` from `httpserver.cpp` - `util/error.cpp` takes `TransactionErrorString` from `node/transaction.cpp` and `AmountHighWarn` and `AmountErrMsg` from `ui_interface.cpp` - `util/fees.cpp` takes `StringForFeeReason` and `FeeModeFromString` from `policy/fees.cpp` - `util/rbf.cpp` takes `SignalsOptInRBF` from `policy/rbf.cpp` - 'util/validation.cpp` takes `FormatStateMessage` and `strMessageMagic` from 'validation.cpp`
This commit is contained in:
21
src/util/url.cpp
Normal file
21
src/util/url.cpp
Normal file
@@ -0,0 +1,21 @@
|
||||
// Copyright (c) 2015-2018 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 <util/url.h>
|
||||
|
||||
#include <event2/http.h>
|
||||
#include <stdlib.h>
|
||||
#include <string>
|
||||
|
||||
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;
|
||||
}
|
||||
Reference in New Issue
Block a user