From 736712ef1e87d38e52e502d859cca2dcad56a3ce Mon Sep 17 00:00:00 2001 From: scuri Date: Tue, 19 Oct 2010 15:48:26 +0000 Subject: *** empty log message *** --- html/en/history.html | 2 +- src/drv/cdps.c | 12 ++++++++++++ src/svg/cdsvg.c | 12 ++++++------ 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/html/en/history.html b/html/en/history.html index f68efe6..20acc64 100644 --- a/html/en/history.html +++ b/html/en/history.html @@ -60,7 +60,7 @@ driver when there are many horizontal lines in sequence on the same polygon.
  • - Fixed: locale in SVG for floating point + Fixed: locale in SVG and PS for floating point numbers, it must use dots "." for decimal separators.
  • Fixed: Cairo context plus base driver diff --git a/src/drv/cdps.c b/src/drv/cdps.c index 08d6ba7..0db3590 100644 --- a/src/drv/cdps.c +++ b/src/drv/cdps.c @@ -9,6 +9,7 @@ #include #include #include +#include #include "cd.h" #include "cd_private.h" @@ -64,6 +65,7 @@ struct _cdCtxCanvas int level1; /* if true generates level 1 only function calls */ int landscape; /* page orientation */ int debug; /* print debug strings in the file */ + char* old_locale; float rotate_angle; int rotate_center_x, @@ -391,6 +393,12 @@ static void cdkillcanvas(cdCtxCanvas *ctxcanvas) fclose(ctxcanvas->file); + if (ctxcanvas->old_locale) + { + setlocale(LC_NUMERIC, ctxcanvas->old_locale); + free(ctxcanvas->old_locale); + } + memset(ctxcanvas, 0, sizeof(cdCtxCanvas)); free(ctxcanvas); } @@ -1965,6 +1973,10 @@ static void cdcreatecanvas(cdCanvas* canvas, void *data) ctxcanvas = (cdCtxCanvas *)malloc(sizeof(cdCtxCanvas)); memset(ctxcanvas, 0, sizeof(cdCtxCanvas)); + /* SVN specification states that number must use dot as decimal separator */ + ctxcanvas->old_locale = cdStrDup(setlocale(LC_NUMERIC, NULL)); + setlocale(LC_NUMERIC, "C"); + line += cdGetFileName(line, filename); if (filename[0] == 0) return; diff --git a/src/svg/cdsvg.c b/src/svg/cdsvg.c index b84fb48..bfde533 100644 --- a/src/svg/cdsvg.c +++ b/src/svg/cdsvg.c @@ -58,12 +58,6 @@ static void cdtransform(cdCtxCanvas *ctxcanvas, const double* matrix); static void cdkillcanvas(cdCtxCanvas* ctxcanvas) { - if (ctxcanvas->old_locale) - { - setlocale(LC_NUMERIC, ctxcanvas->old_locale); - free(ctxcanvas->old_locale); - } - if (ctxcanvas->clip_control) fprintf(ctxcanvas->file, "\n"); /* close clipping container */ @@ -75,6 +69,12 @@ static void cdkillcanvas(cdCtxCanvas* ctxcanvas) fclose(ctxcanvas->file); + if (ctxcanvas->old_locale) + { + setlocale(LC_NUMERIC, ctxcanvas->old_locale); + free(ctxcanvas->old_locale); + } + memset(ctxcanvas, 0, sizeof(cdCtxCanvas)); free(ctxcanvas); } -- cgit v1.2.3