Skip to content

Commit b193d5a

Browse files
committed
Removes the Boost case_conv.hpp dependency.
This commit removes the `boost/algorithm/string/case_conv.hpp` dependency from the project. It replaces the `boost::to_lower` and `boost::to_upper` functions with custom functions that are locale independent and ASCII deterministic.
1 parent 7a208d9 commit b193d5a

File tree

4 files changed

+2
-10
lines changed

4 files changed

+2
-10
lines changed

src/netbase.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
#include <fcntl.h>
2020
#endif
2121

22-
#include <boost/algorithm/string/case_conv.hpp> // for to_lower()
23-
2422
#if !defined(MSG_NOSIGNAL)
2523
#define MSG_NOSIGNAL 0
2624
#endif
@@ -37,7 +35,7 @@ static const int SOCKS5_RECV_TIMEOUT = 20 * 1000;
3735
static std::atomic<bool> interruptSocks5Recv(false);
3836

3937
enum Network ParseNetwork(std::string net) {
40-
boost::to_lower(net);
38+
Downcase(net);
4139
if (net == "ipv4") return NET_IPV4;
4240
if (net == "ipv6") return NET_IPV6;
4341
if (net == "onion") return NET_ONION;

src/rpc/server.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
#include <boost/bind.hpp>
1818
#include <boost/signals2/signal.hpp>
19-
#include <boost/algorithm/string/case_conv.hpp> // for to_upper()
2019
#include <boost/algorithm/string/classification.hpp>
2120
#include <boost/algorithm/string/split.hpp>
2221

@@ -192,9 +191,7 @@ std::string CRPCTable::help(const std::string& strCommand, const JSONRPCRequest&
192191
if (!category.empty())
193192
strRet += "\n";
194193
category = pcmd->category;
195-
std::string firstLetter = category.substr(0,1);
196-
boost::to_upper(firstLetter);
197-
strRet += "== " + firstLetter + category.substr(1) + " ==\n";
194+
strRet += "== " + Capitalize(category) + " ==\n";
198195
}
199196
}
200197
strRet += strHelp + "\n";

test/lint/lint-includes.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ fi
4747

4848
EXPECTED_BOOST_INCLUDES=(
4949
boost/algorithm/string.hpp
50-
boost/algorithm/string/case_conv.hpp
5150
boost/algorithm/string/classification.hpp
5251
boost/algorithm/string/replace.hpp
5352
boost/algorithm/string/split.hpp

test/lint/lint-locale-dependence.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,9 @@ KNOWN_VIOLATIONS=(
1111
"src/dbwrapper.cpp:.*vsnprintf"
1212
"src/httprpc.cpp.*trim"
1313
"src/init.cpp:.*atoi"
14-
"src/netbase.cpp.*to_lower"
1514
"src/qt/rpcconsole.cpp:.*atoi"
1615
"src/qt/rpcconsole.cpp:.*isdigit"
1716
"src/rest.cpp:.*strtol"
18-
"src/rpc/server.cpp.*to_upper"
1917
"src/test/dbwrapper_tests.cpp:.*snprintf"
2018
"src/test/getarg_tests.cpp.*split"
2119
"src/torcontrol.cpp:.*atoi"

0 commit comments

Comments
 (0)