]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Use locale-insensitive decoding of real numbers (Issue #1263)
authorMichael R Sweet <msweet@msweet.org>
Tue, 13 May 2025 14:56:47 +0000 (10:56 -0400)
committerMichael R Sweet <msweet@msweet.org>
Tue, 13 May 2025 14:56:47 +0000 (10:56 -0400)
ppdc/ppdc-source.cxx
ppdc/ppdc.h

index d7edb9d48c6fd82703c10511b777344e8bb51f39..82d68549e4a9b5f3f0fe89e7a1bc688b40ef6a73 100644 (file)
@@ -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"))
index 727328251073b44fe24522af17b01430a3129438..9d9b0671955fa59d133c442f178934e5fd80ba2d 100644 (file)
@@ -17,6 +17,7 @@
 
 #  include <cups/file.h>
 #  include <stdlib.h>
+#  include <locale.h>
 
 
 //
@@ -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();