HomePhabricator

[util] Replace use of locale dependent atoi(…) with locale-independent std…

Description

[util] Replace use of locale dependent atoi(…) with locale-independent std::from_chars (C++17)

Summary:
Removes the usage of atoi, which is not locale-independent, and replaces it with a new function LocaleIndependentAtoi, which is.

  • test: Add test cases for LocaleIndependentAtoi
  • fuzz: Assert legacy atoi(s) == LocaleIndependentAtoi<int>(s)
  • fuzz: Assert legacy atoi64(s) == LocaleIndependentAtoi<int64_t>(s)

Backport from core#20452.

Test Plan: ninja check, plus run fuzzers

Reviewers: Fabien, #bitcoin_abc

Reviewed By: Fabien, #bitcoin_abc

Differential Revision: https://reviews.bitcoinabc.org/D18472

Details

Provenance
tobias_ruckAuthored on Aug 11 2025, 13:23
tobias_ruckPushed on Aug 11 2025, 15:59
Reviewer
Restricted Project
Differential Revision
D18472: [util] Replace use of locale dependent atoi(…) with locale-independent std::from_chars (C++17)
Parents
rABC302d6904beec: Bump version to 0.31.10
Branches
Unknown
Tags
Unknown