]> 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:58:39 +0000 (10:58 -0400)
committerMichael R Sweet <msweet@msweet.org>
Tue, 13 May 2025 14:58:39 +0000 (10:58 -0400)
CHANGES.md
ppdc/ppdc-source.cxx
ppdc/ppdc.h

index 9f2d51ccd47ad1fa39c7ee8f056a14387a12ede7..5b78288259fdd172067165de00080ed044b6c297 100644 (file)
@@ -13,6 +13,7 @@ Changes in CUPS v2.4.13 (YYYY-MM-DD)
 - Fixed missing commas in `ippCreateRequestedArray` (Issue #1234)
 - Fixed subscription issues in the scheduler and D-Bus notifier (Issue #1235)
 - Fixed support for IPP/PPD options with periods or underscores (Issue #1249)
+- Fixed parsing of real numbers in PPD compiler source files (Issue #1263)
 
 
 Changes in CUPS v2.4.12 (2025-04-08)
index 0738c97efbe04c6bb03da7e3a207f51dce6d07f5..d55ea0008daab57e3d424321064a5ca27bf06322 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();