mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 23:18:14 +01:00
Replace use of locale dependent atoi(…) with locale-independent std::from_chars(…) (C++17)
test: Add test cases for LocaleIndependentAtoi fuzz: Assert legacy atoi(s) == LocaleIndependentAtoi<int>(s) fuzz: Assert legacy atoi64(s) == LocaleIndependentAtoi<int64_t>(s)
This commit is contained in:
@@ -77,8 +77,7 @@ std::optional<CAmount> ParseMoney(const std::string& money_string)
|
||||
return std::nullopt;
|
||||
if (nUnits < 0 || nUnits > COIN)
|
||||
return std::nullopt;
|
||||
int64_t nWhole = atoi64(strWhole);
|
||||
|
||||
int64_t nWhole = LocaleIndependentAtoi<int64_t>(strWhole);
|
||||
CAmount value = nWhole * COIN + nUnits;
|
||||
|
||||
if (!MoneyRange(value)) {
|
||||
|
||||
Reference in New Issue
Block a user