From: John Darrington Date: Wed, 19 Dec 2012 10:59:09 +0000 (+0100) Subject: PsppireOutputWindow (create_xr_print_driver) fix LC_NUMERIC issues. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?p=pspp;a=commitdiff_plain;h=eee67f3c01c70aa902b82dddc5139eeaa094ad88 PsppireOutputWindow (create_xr_print_driver) fix LC_NUMERIC issues. This function used *printf with a %f directive, which under certain locales would have generated a string like "270,00x210,00mm" which the print driver would have rejected. This change uses the newly available c_xasprintf function from gnulib to alleviate this problem. --- diff --git a/Smake b/Smake index 1fd4ac3d14..f82f4f4442 100644 --- a/Smake +++ b/Smake @@ -12,6 +12,7 @@ GNULIB_MODULES = \ c-strcasestr \ c-ctype \ c-strtod \ + c-xvasprintf \ clean-temp \ close \ configmake \ diff --git a/src/ui/gui/psppire-output-window.c b/src/ui/gui/psppire-output-window.c index 61f3bbdd28..d1d7e89166 100644 --- a/src/ui/gui/psppire-output-window.c +++ b/src/ui/gui/psppire-output-window.c @@ -41,6 +41,7 @@ #include "gl/error.h" #include "gl/tmpdir.h" #include "gl/xalloc.h" +#include "gl/c-xvasprintf.h" #include "helper.h" @@ -1049,7 +1050,6 @@ psppire_output_window_new (void) NULL)); } - static void create_xr_print_driver (GtkPrintContext *context, PsppireOutputWindow *window) @@ -1072,15 +1072,15 @@ create_xr_print_driver (GtkPrintContext *context, PsppireOutputWindow *window) string_map_init (&options); string_map_insert_nocopy (&options, xstrdup ("paper-size"), - xasprintf("%.2fx%.2fmm", width, height)); + c_xasprintf("%.2fx%.2fmm", width, height)); string_map_insert_nocopy (&options, xstrdup ("left-margin"), - xasprintf ("%.2fmm", left_margin)); + c_xasprintf ("%.2fmm", left_margin)); string_map_insert_nocopy (&options, xstrdup ("right-margin"), - xasprintf ("%.2fmm", right_margin)); + c_xasprintf ("%.2fmm", right_margin)); string_map_insert_nocopy (&options, xstrdup ("top-margin"), - xasprintf ("%.2fmm", top_margin)); + c_xasprintf ("%.2fmm", top_margin)); string_map_insert_nocopy (&options, xstrdup ("bottom-margin"), - xasprintf ("%.2fmm", bottom_margin)); + c_xasprintf ("%.2fmm", bottom_margin)); window->print_xrd = xr_driver_create (gtk_print_context_get_cairo_context (context), &options);