[dia] Bug 603576 - wrong decimal separator with vdx
- From: Hans Breuer <hans src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [dia] Bug 603576 - wrong decimal separator with vdx
- Date: Sat, 5 Dec 2009 18:49:41 +0000 (UTC)
commit 5786137095d49a0064cfe1bfe18865383bdc9908
Author: Hans Breuer <hans breuer org>
Date: Sat Dec 5 19:20:21 2009 +0100
Bug 603576 - wrong decimal separator with vdx
Temporarily switch to LC_NUMERIC, "C" in import and export callback.
plug-ins/vdx/vdx-export.c | 7 +++++++
plug-ins/vdx/vdx-import.c | 10 ++++++++++
2 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/plug-ins/vdx/vdx-export.c b/plug-ins/vdx/vdx-export.c
index cfc0377..f2380cf 100644
--- a/plug-ins/vdx/vdx-export.c
+++ b/plug-ins/vdx/vdx-export.c
@@ -1841,6 +1841,7 @@ export_vdx(DiagramData *data, const gchar *filename,
VDXRenderer *renderer;
int i;
Layer *layer;
+ char* old_locale;
file = g_fopen(filename, "w");
@@ -1850,6 +1851,9 @@ export_vdx(DiagramData *data, const gchar *filename,
return;
}
+ /* ugly, but still better than creatin corrupt files */
+ old_locale = setlocale(LC_NUMERIC, "C");
+
/* Create and initialise our renderer */
renderer = g_object_new(VDX_TYPE_RENDERER, NULL);
@@ -1894,6 +1898,9 @@ export_vdx(DiagramData *data, const gchar *filename,
g_object_unref(renderer);
+ /* dont screw Dia's global state */
+ setlocale(LC_NUMERIC, old_locale);
+
fclose(file);
}
diff --git a/plug-ins/vdx/vdx-import.c b/plug-ins/vdx/vdx-import.c
index 202f3f7..1e5ac3c 100644
--- a/plug-ins/vdx/vdx-import.c
+++ b/plug-ins/vdx/vdx-import.c
@@ -36,6 +36,7 @@
#include <libxml/xmlmemory.h>
#include <float.h>
#include <sys/stat.h>
+#include <locale.h>
#include "intl.h"
#include "message.h"
@@ -2974,6 +2975,7 @@ import_vdx(const gchar *filename, DiagramData *dia, void* user_data)
int visio_version = 0;
const char *debug = 0;
unsigned int debug_shapes = 0;
+ char* old_locale;
if (!doc) {
message_warning("parse error for %s",
@@ -3010,6 +3012,10 @@ import_vdx(const gchar *filename, DiagramData *dia, void* user_data)
theDoc = g_new0(struct VDXDocument, 1);
theDoc->ok = TRUE;
+
+ /* ugly, but still better than bogus sizes */
+ old_locale = setlocale(LC_NUMERIC, "C");
+
/* VDX_DEBUG sets verbose per-shape debugging on */
if (g_getenv("VDX_DEBUG")) theDoc->debug_comments = TRUE;
@@ -3061,6 +3067,10 @@ import_vdx(const gchar *filename, DiagramData *dia, void* user_data)
/* Get rid of internal strings before returning */
vdx_free(theDoc);
xmlFreeDoc(doc);
+
+ /* dont screw Dia's global state */
+ setlocale(LC_NUMERIC, old_locale);
+
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]