use C locale instead of en_us.utf8

TODO: replace these with numFromString instead :P
This commit is contained in:
matcool 2024-07-24 19:21:35 -03:00
parent 4272b8b549
commit 2cd1a9ee26
3 changed files with 3 additions and 3 deletions

View file

@ -151,7 +151,7 @@ Result<ModMetadata> ModMetadata::Impl::createFromSchemaV010(ModJson const& rawJs
if (ver != "*") {
double val = 0.0;
errno = 0;
if (std::setlocale(LC_NUMERIC, "en_US.utf8")) {
if (std::setlocale(LC_NUMERIC, "C")) {
val = std::strtod(ver.c_str(), nullptr);
if (errno == ERANGE) {
return Err("[mod.json] has invalid target GD version");

View file

@ -27,7 +27,7 @@ Num parseNumForInput(std::string const& str) {
else if constexpr (std::is_same_v<Num, double>) {
double val = 0.0;
errno = 0;
if (std::setlocale(LC_NUMERIC, "en_US.utf8")) {
if (std::setlocale(LC_NUMERIC, "C")) {
val = std::strtod(str.c_str(), nullptr);
if (errno == 0) {
return val;

View file

@ -22,7 +22,7 @@ static GLubyte parseInt(char const* str) {
static GLubyte parseFloat(char const* str) {
float val = 0.0f;
errno = 0;
if (std::setlocale(LC_NUMERIC, "en_US.utf8")) {
if (std::setlocale(LC_NUMERIC, "C")) {
val = std::strtof(str, nullptr);
if (errno == 0) {
return val;