This is #18130 rebased.
TrimString
is an existing alternative.
Note
TrimString
uses" \f\n\r\t\v"
as the pattern, which is consistent with the default behavior ofstd::isspace
. See: https://en.cppreference.com/w/cpp/string/byte/isspace
This is #18130 rebased.
TrimString
is an existing alternative.
Note
TrimString
uses" \f\n\r\t\v"
as the pattern, which is consistent with the default behavior ofstd::isspace
. See: https://en.cppreference.com/w/cpp/string/byte/isspace
Note the only use of readStdin is fed to DecodeHexTx, which fails in
IsHex on non-hex characters as recorded in p_util_hexdigit.
Very happy to see a reduction in our locale dependency!
I think we’ll be able to have an empty KNOWN_VIOLATIONS
list in test/lint/lint-locale-dependence.sh
by the end of the year. That would be awesome! :)
ACK 696c76d6604c9c4faddfc4b6684e2788bb577ba6
130@@ -130,8 +131,7 @@ static bool RPCAuthorized(const std::string& strAuth, std::string& strAuthUserna
131 return false;
132 if (strAuth.substr(0, 6) != "Basic ")
133 return false;
134- std::string strUserPass64 = strAuth.substr(6);
135- boost::trim(strUserPass64);
136+ std::string strUserPass64 = TrimString(strAuth.substr(6));
137 std::string strUserPass = DecodeBase64(strUserPass64);
9355186 nit, these can be const
0- std::string strUserPass64 = TrimString(strAuth.substr(6));
1- std::string strUserPass = DecodeBase64(strUserPass64);
2+ const std::string strUserPass64 = TrimString(strAuth.substr(6));
3+ const std::string strUserPass = DecodeBase64(strUserPass64);
Code-review ACK 696c76d6604c9c4faddfc4b6684e2788bb577ba6
Happy to also re-ACK if Jon’s suggestion of declaring strUserPass{64}
as const
(https://github.com/bitcoin/bitcoin/pull/22859#discussion_r702292854) is applied.
771@@ -772,9 +772,7 @@ static std::string readStdin()
772 if (ferror(stdin))
773 throw std::runtime_error("error reading stdin");
774
775- boost::algorithm::trim_right(ret);
776-
777- return ret;
778+ return TrimString(ret);