[grits] Add reset locale when formatting certain strings
- From: Andy Spencer <andys src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grits] Add reset locale when formatting certain strings
- Date: Mon, 29 Aug 2011 00:36:12 +0000 (UTC)
commit fae65c1172255850640da2bf987e8b64f6d1949a
Author: Andy Spencer <andy753421 gmail com>
Date: Sat Jul 2 03:19:35 2011 +0000
Add reset locale when formatting certain strings
LC_NUMERIC is used to determine the conversion for "%f" this can result
in errors when formatting strings with expected floating point formats.
src/data/grits-wms.c | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/src/data/grits-wms.c b/src/data/grits-wms.c
index 32c0c0c..fe6338c 100644
--- a/src/data/grits-wms.c
+++ b/src/data/grits-wms.c
@@ -72,13 +72,25 @@
#include <config.h>
#include <stdio.h>
#include <glib.h>
+#include <locale.h>
#include "grits-wms.h"
#include "grits-http.h"
+static gchar *g_strdup_printf_safe(char *fmt, ...)
+{
+ va_list ap;
+ va_start(ap, fmt);
+ setlocale(LC_ALL, "POSIX.UTF-8");
+ char *str = g_strdup_vprintf(fmt, ap);
+ setlocale(LC_ALL, "");
+ va_end(ap);
+ return str;
+}
+
static gchar *_make_uri(GritsWms *wms, GritsTile *tile)
{
- return g_strdup_printf(
+ return g_strdup_printf_safe(
"%s?"
"SERVICE=WMS&"
"VERSION=1.1.0&"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]