summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/drv/cdps.c12
-rw-r--r--src/svg/cdsvg.c12
2 files changed, 18 insertions, 6 deletions
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 <string.h>
#include <time.h>
#include <math.h>
+#include <locale.h>
#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, "</g>\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);
}