mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-04 18:22:57 +02:00
Merge #14599: Use functions guaranteed to be locale independent (IsDigit, ToLower) in {Format,Parse}Money(...), uint256::SetHex(...), etc. Remove the use of locale dependent boost::is_space(...)
8931a95becInclude util/strencodings.h which is required for IsSpace(...) (practicalswift)7c9f790761Update KNOWN_VIOLATIONS: Remove fixed violations (practicalswift)587924f000Use IsSpace(...) instead of boost::is_space (practicalswift)c5fd143edbUse ToLower(...) instead of std::tolower (practicalswift)e70cc8983cUse IsDigit(...) instead of std::isdigit (practicalswift) Pull request description: * Use `ToLower(...)` instead of `std::tolower`. `std::tolower` is locale dependent. * Use `IsDigit(...)` instead of `std::isdigit`. Some implementations (e.g. Microsoft in 1252 codepage) may classify single-byte characters other than `[0-9]` as digits. * Update `KNOWN_VIOLATIONS`: Remove fixed violations. * ~~Replace use of locale dependent Boost trim (`boost::trim`) with locale independent `TrimString`.~~ * Use` IsSpace(...)` instead of `boost::is_space` Tree-SHA512: defed016136b530b723fa185afdbd00410925a748856ba3afa4cee60f61a67617e30f304f2b9991a67b5fe075d9624f051e14342aee176f45fbc024d59e1aa82
This commit is contained in:
@@ -20,7 +20,7 @@ std::string FormatMoney(const CAmount& n)
|
||||
|
||||
// Right-trim excess zeros before the decimal point:
|
||||
int nTrim = 0;
|
||||
for (int i = str.size()-1; (str[i] == '0' && isdigit(str[i-2])); --i)
|
||||
for (int i = str.size()-1; (str[i] == '0' && IsDigit(str[i-2])); --i)
|
||||
++nTrim;
|
||||
if (nTrim)
|
||||
str.erase(str.size()-nTrim, nTrim);
|
||||
@@ -49,7 +49,7 @@ bool ParseMoney(const char* pszIn, CAmount& nRet)
|
||||
{
|
||||
p++;
|
||||
int64_t nMult = COIN / 10;
|
||||
while (isdigit(*p) && (nMult > 0))
|
||||
while (IsDigit(*p) && (nMult > 0))
|
||||
{
|
||||
nUnits += nMult * (*p++ - '0');
|
||||
nMult /= 10;
|
||||
@@ -58,7 +58,7 @@ bool ParseMoney(const char* pszIn, CAmount& nRet)
|
||||
}
|
||||
if (IsSpace(*p))
|
||||
break;
|
||||
if (!isdigit(*p))
|
||||
if (!IsDigit(*p))
|
||||
return false;
|
||||
strWhole.insert(strWhole.end(), *p);
|
||||
}
|
||||
|
||||
@@ -443,7 +443,7 @@ bool ArgsManager::ParseParameters(int argc, const char* const argv[], std::strin
|
||||
key.erase(is_index);
|
||||
}
|
||||
#ifdef WIN32
|
||||
std::transform(key.begin(), key.end(), key.begin(), ::tolower);
|
||||
std::transform(key.begin(), key.end(), key.begin(), ToLower);
|
||||
if (key[0] == '/')
|
||||
key[0] = '-';
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user