Skip to content

Commit 0f381a0

Browse files
committed
Use locale-insensitive decoding of real numbers (Issue #1263)
1 parent 340de41 commit 0f381a0

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Changes in CUPS v2.4.13 (YYYY-MM-DD)
1313
- Fixed missing commas in `ippCreateRequestedArray` (Issue #1234)
1414
- Fixed subscription issues in the scheduler and D-Bus notifier (Issue #1235)
1515
- Fixed support for IPP/PPD options with periods or underscores (Issue #1249)
16+
- Fixed parsing of real numbers in PPD compiler source files (Issue #1263)
1617

1718

1819
Changes in CUPS v2.4.12 (2025-04-08)

ppdc/ppdc-source.cxx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ ppdcSource::ppdcSource(const char *f, // I - File to read
6262
cond_state = PPDC_COND_NORMAL;
6363
cond_current = cond_stack;
6464
cond_stack[0] = PPDC_COND_NORMAL;
65+
locdata = localeconv();
6566

6667
// Add standard #define variables...
6768
#define MAKE_STRING(x) #x
@@ -959,7 +960,7 @@ ppdcSource::get_float(ppdcFile *fp) // I - File to read
959960
return (-1.0f);
960961
}
961962

962-
val = (float)strtod(temp, &ptr);
963+
val = (float)_cupsStrScand(temp, &ptr, locdata);
963964

964965
if (*ptr)
965966
{
@@ -1479,7 +1480,7 @@ ppdcSource::get_measurement(ppdcFile *fp)
14791480
return (-1.0f);
14801481

14811482
// Get the floating point value of "s" and skip all digits and decimal points.
1482-
val = (float)strtod(buffer, &ptr);
1483+
val = (float)_cupsStrScand(buffer, &ptr, locdata);
14831484

14841485
// Check for a trailing unit specifier...
14851486
if (!_cups_strcasecmp(ptr, "mm"))

ppdc/ppdc.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
# include <cups/file.h>
1919
# include <stdlib.h>
20+
# include <locale.h>
2021

2122

2223
//
@@ -471,7 +472,7 @@ class ppdcSource //// Source File
471472
int cond_state, // Cumulative conditional state
472473
*cond_current, // Current #if state
473474
cond_stack[101]; // #if state stack
474-
475+
struct lconv *locdata; // Locale data
475476

476477
ppdcSource(const char *f = 0, cups_file_t *ffp = (cups_file_t *)0);
477478
~ppdcSource();

0 commit comments

Comments
 (0)