[gcalctool] nl_langinfo returns empty string, not NULL, when no value exists



commit 64f7b078900f19b17fd0b4a9bce701f89e67cce0
Author: Robin Sonefors <ozamosi flukkost nu>
Date:   Sat Oct 2 17:56:56 2010 +0200

    nl_langinfo returns empty string, not NULL, when no value exists

 src/math-equation.c |    4 ++--
 src/mp-convert.c    |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/src/math-equation.c b/src/math-equation.c
index cec1dc7..010f25d 100644
--- a/src/math-equation.c
+++ b/src/math-equation.c
@@ -1678,9 +1678,9 @@ math_equation_init(MathEquation *equation)
     setlocale(LC_NUMERIC, "");
 
     radix = nl_langinfo(RADIXCHAR);
-    equation->priv->radix = radix ? g_locale_to_utf8(radix, -1, NULL, NULL, NULL) : g_strdup(".");
+    equation->priv->radix = *radix ? g_locale_to_utf8(radix, -1, NULL, NULL, NULL) : g_strdup(".");
     tsep = nl_langinfo(THOUSEP);
-    equation->priv->tsep = tsep ? g_locale_to_utf8(tsep, -1, NULL, NULL, NULL) : g_strdup(",");
+    equation->priv->tsep = *tsep ? g_locale_to_utf8(tsep, -1, NULL, NULL, NULL) : g_strdup(",");
 
     equation->priv->tsep_count = 3;
   
diff --git a/src/mp-convert.c b/src/mp-convert.c
index e305aef..bbdb8fc 100644
--- a/src/mp-convert.c
+++ b/src/mp-convert.c
@@ -514,7 +514,7 @@ mp_radix_char()
     static const char* radix = NULL;
     if (radix == NULL) {
         radix = nl_langinfo(RADIXCHAR);
-        radix = radix ? g_locale_to_utf8(radix, -1, NULL, NULL, NULL) : g_strdup(".");
+        radix = *radix ? g_locale_to_utf8(radix, -1, NULL, NULL, NULL) : g_strdup(".");
     }
     return radix;
 }
@@ -859,7 +859,7 @@ mp_set_from_string(const char *str, int default_base, MPNumber *z)
 
     if (tsep == NULL) {
         tsep = nl_langinfo(THOUSEP);
-        tsep = tsep ? g_locale_to_utf8(tsep, -1, NULL, NULL, NULL) : g_strdup(",");
+        tsep = *tsep ? g_locale_to_utf8(tsep, -1, NULL, NULL, NULL) : g_strdup(",");
     }
 
     if (strstr(str, "°"))



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]