aboutsummaryrefslogtreecommitdiff
path: root/src/util/moneystr.cpp
diff options
context:
space:
mode:
authorpracticalswift <practicalswift@users.noreply.github.com>2021-09-30 14:18:50 +0000
committerpracticalswift <practicalswift@users.noreply.github.com>2021-09-30 14:21:17 +0000
commit4343f114cc661cf031ec915538c11b9b030e2e15 (patch)
tree0b0cc9ec8fbea9cc65490dd2ae437478b78c3a72 /src/util/moneystr.cpp
parent2d8e0c0c3c0d3c4cee7bb52d1edf501f40c53463 (diff)
downloadbitcoin-4343f114cc661cf031ec915538c11b9b030e2e15.tar.xz
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)
Diffstat (limited to 'src/util/moneystr.cpp')
-rw-r--r--src/util/moneystr.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/util/moneystr.cpp b/src/util/moneystr.cpp
index d3f4029607..95a919ad12 100644
--- a/src/util/moneystr.cpp
+++ b/src/util/moneystr.cpp
@@ -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)) {