mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-25 22:39:13 +02:00
Merge #14585: refactor: remove usage of locale dependent std::isspace
15db77f4dd Don't rely on locale dependent functions in base_blob<BITS>::SetHex(...) (uint256), DecodeBase58(...), ParseMoney(...) and ParseHex(...) (practicalswift)
Pull request description:
Don't rely on locale dependent function `std::isspace` in `base_blob<BITS>::SetHex(...)` (uint256), `DecodeBase58(...)`, `ParseMoney(...)` and `ParseHex(...)`.
Rationale:
```
$ uname -s
Darwin
$ cat poc.cpp
#include <iostream>
#include <locale>
int main(void) {
setlocale(LC_ALL, "");
std::cout << std::isspace(133) << ' ' << std::isspace(154) << ' ' << std::isspace(160);
std::cout << '\n';
}
$ clang++ -o poc poc.cpp
$ ./poc
1 0 1
$ LC_ALL=en_US ./poc
1 0 1
$ LC_ALL=C ./poc
0 0 0
$ LC_ALL=ru_RU.KOI8-R ./poc # an "interesting" locale
0 1 0
```
Tree-SHA512: 4eafb267342b8a777da6cca07c353afd1f90f3fc1d91e01f526f1b384a2b97c1da25b7bd7dfc300655182a4eaec6a4bea855a45723ab53c750a734b60e1e3c9f
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
|
||||
export LC_ALL=C
|
||||
KNOWN_VIOLATIONS=(
|
||||
"src/base58.cpp:.*isspace"
|
||||
"src/bitcoin-tx.cpp.*stoul"
|
||||
"src/bitcoin-tx.cpp.*trim_right"
|
||||
"src/bitcoin-tx.cpp:.*atoi"
|
||||
@@ -18,15 +17,12 @@ KNOWN_VIOLATIONS=(
|
||||
"src/test/getarg_tests.cpp.*split"
|
||||
"src/torcontrol.cpp:.*atoi"
|
||||
"src/torcontrol.cpp:.*strtol"
|
||||
"src/uint256.cpp:.*isspace"
|
||||
"src/uint256.cpp:.*tolower"
|
||||
"src/util.cpp:.*atoi"
|
||||
"src/util.cpp:.*fprintf"
|
||||
"src/util.cpp:.*tolower"
|
||||
"src/utilmoneystr.cpp:.*isdigit"
|
||||
"src/utilmoneystr.cpp:.*isspace"
|
||||
"src/utilstrencodings.cpp:.*atoi"
|
||||
"src/utilstrencodings.cpp:.*isspace"
|
||||
"src/utilstrencodings.cpp:.*strtol"
|
||||
"src/utilstrencodings.cpp:.*strtoll"
|
||||
"src/utilstrencodings.cpp:.*strtoul"
|
||||
|
||||
Reference in New Issue
Block a user