[Xfce4-commits] <xfwm4:libxfce4ui> Use explicit message when actual type of option does not match the expected type (so the warning can be useful)

Jérôme Guelfucci noreply at xfce.org
Sat Feb 27 01:04:19 CET 2010


Updating branch refs/heads/libxfce4ui
         to 366f4529971a360e6b4da0fc171c40b3e5399672 (commit)
       from 1b84cb5d4d2770003f66629428fdb4000b060227 (commit)

commit 366f4529971a360e6b4da0fc171c40b3e5399672
Author: Olivier Fourdan <fourdan at xfce.org>
Date:   Wed Feb 24 14:24:27 2010 +0100

    Use explicit message when actual type of option does not match the expected type (so the warning can be useful)

 src/parserc.c |   18 +++++++++++++++---
 1 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/src/parserc.c b/src/parserc.c
index 132ecaa..ac1e0fc 100644
--- a/src/parserc.c
+++ b/src/parserc.c
@@ -300,7 +300,11 @@ getStringValue (const gchar *option, Settings *rc)
         {
             if (rc[i].value == NULL)
                 return NULL;
-            g_return_val_if_fail(G_VALUE_TYPE(rc[i].value) == G_TYPE_STRING, NULL);
+            if (G_VALUE_TYPE(rc[i].value) != G_TYPE_STRING)
+            {
+                g_warning ("Option \"%s\" in not of expected type string", option);
+                return NULL;
+            }
             return g_value_get_string(rc[i].value);
         }
     }
@@ -322,7 +326,11 @@ getIntValue (const gchar *option, Settings *rc)
         {
             if (rc[i].value == NULL)
                 return 0;
-            g_return_val_if_fail(G_VALUE_TYPE(rc[i].value) == G_TYPE_INT, 0);
+            if (G_VALUE_TYPE(rc[i].value) != G_TYPE_INT)
+            {
+                g_warning ("Option \"%s\" in not of expected type int", option);
+                return 0;
+            }
             return g_value_get_int(rc[i].value);
         }
     }
@@ -344,7 +352,11 @@ getBoolValue (const gchar *option, Settings *rc)
         {
             if (rc[i].value == NULL)
                 return FALSE;
-            g_return_val_if_fail(G_VALUE_TYPE(rc[i].value) == G_TYPE_BOOLEAN, FALSE);
+            if (G_VALUE_TYPE(rc[i].value) != G_TYPE_BOOLEAN)
+            {
+                g_warning ("Option \"%s\" in not of expected type boolean", option);
+                return FALSE;
+            }
             return g_value_get_boolean(rc[i].value);
         }
     }



More information about the Xfce4-commits mailing list