Mac: settings' numbers read with strtof (Apple's library has no float from_chars before macOS 26), as on Android

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Nexoniarz 2026-10-20 20:14:47 +02:00
commit ec67538be0

View file

@ -31,7 +31,9 @@ Cvar::~Cvar() { std::erase(cvars(), this); }
void Cvar::set(std::string_view value) { void Cvar::set(std::string_view value) {
value_ = value; value_ = value;
#if defined(__ANDROID__) // (the NDK's library has no float from_chars; bionic's locale is always "C") // (The NDK's library, and Apple's before macOS 26, have no float from_chars. strtof reads the
// "C" locale's way: the program never sets another.)
#if defined(__ANDROID__) || defined(__APPLE__)
const std::string text(value); const std::string text(value);
char* end = nullptr; char* end = nullptr;
const float parsed = std::strtof(text.c_str(), &end); const float parsed = std::strtof(text.c_str(), &end);