From: Michael R Sweet Date: Tue, 13 May 2025 14:56:47 +0000 (-0400) Subject: Use locale-insensitive decoding of real numbers (Issue #1263) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3507bb9b6468ae74c1a4662297c3907c7dbe0a0b;p=thirdparty%2Fcups.git Use locale-insensitive decoding of real numbers (Issue #1263) --- diff --git a/ppdc/ppdc-source.cxx b/ppdc/ppdc-source.cxx index d7edb9d48c..82d68549e4 100644 --- a/ppdc/ppdc-source.cxx +++ b/ppdc/ppdc-source.cxx @@ -62,6 +62,7 @@ ppdcSource::ppdcSource(const char *f, // I - File to read cond_state = PPDC_COND_NORMAL; cond_current = cond_stack; cond_stack[0] = PPDC_COND_NORMAL; + locdata = localeconv(); // Add standard #define variables... #define MAKE_STRING(x) #x @@ -959,7 +960,7 @@ ppdcSource::get_float(ppdcFile *fp) // I - File to read return (-1.0f); } - val = (float)strtod(temp, &ptr); + val = (float)_cupsStrScand(temp, &ptr, locdata); if (*ptr) { @@ -1479,7 +1480,7 @@ ppdcSource::get_measurement(ppdcFile *fp) return (-1.0f); // Get the floating point value of "s" and skip all digits and decimal points. - val = (float)strtod(buffer, &ptr); + val = (float)_cupsStrScand(buffer, &ptr, locdata); // Check for a trailing unit specifier... if (!_cups_strcasecmp(ptr, "mm")) diff --git a/ppdc/ppdc.h b/ppdc/ppdc.h index 7273282510..9d9b067195 100644 --- a/ppdc/ppdc.h +++ b/ppdc/ppdc.h @@ -17,6 +17,7 @@ # include # include +# include // @@ -471,7 +472,7 @@ class ppdcSource //// Source File int cond_state, // Cumulative conditional state *cond_current, // Current #if state cond_stack[101]; // #if state stack - + struct lconv *locdata; // Locale data ppdcSource(const char *f = 0, cups_file_t *ffp = (cups_file_t *)0); ~ppdcSource();