[Xfce4-commits] [xfce/xfconf] 07/10: Return FALSE when xfconf_basic_gvariant_to_gvalue fails.

noreply at xfce.org noreply at xfce.org
Sun Oct 21 12:05:14 CEST 2018


This is an automated email from the git hooks/post-receive script.

a   l   i       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository xfce/xfconf.

commit 3f6221d109753998aaec317da35e35c3572da1cb
Author: Ali Abdallah <ali at xfce.org>
Date:   Sat Jul 14 02:04:09 2018 +0200

    Return FALSE when xfconf_basic_gvariant_to_gvalue fails.
    
    This way the GSettings backend can handled the non basic property as a
    string using g_variant_parse.
---
 common/xfconf-gvaluefuncs.c | 13 +++++++++----
 common/xfconf-gvaluefuncs.h |  2 +-
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/common/xfconf-gvaluefuncs.c b/common/xfconf-gvaluefuncs.c
index a775369..e191f9c 100644
--- a/common/xfconf-gvaluefuncs.c
+++ b/common/xfconf-gvaluefuncs.c
@@ -417,8 +417,9 @@ xfconf_basic_gvalue_to_gvariant (const GValue *value) {
     return NULL;
 }
 
-void xfconf_basic_gvariant_to_gvalue (GVariant *variant, GValue *value)
+gboolean xfconf_basic_gvariant_to_gvalue (GVariant *variant, GValue *value)
 {
+  gboolean ret = TRUE;
     switch (g_variant_classify (variant)){
     case G_VARIANT_CLASS_UINT16:
         g_value_init(value, G_TYPE_UINT);
@@ -461,9 +462,10 @@ void xfconf_basic_gvariant_to_gvalue (GVariant *variant, GValue *value)
         g_value_set_double (value, g_variant_get_double (variant));
         break;
     default:
-        g_warn_if_reached ();
+        ret = FALSE;
         break;
     }
+    return (ret);
 }
 
 GVariant *
@@ -608,7 +610,7 @@ xfconf_dup_value_array (GPtrArray *arr, gboolean auto_destroy_value) {
 
 GValue * xfconf_gvariant_to_gvalue (GVariant *in_variant)
 {
-    GValue *value;
+    GValue *value ;
     GVariant *variant;
     value = g_new0(GValue, 1);
 
@@ -651,7 +653,10 @@ GValue * xfconf_gvariant_to_gvalue (GVariant *in_variant)
         g_value_set_boxed (value, g_variant_get_strv (variant, NULL));
     }
     else {/* Should be a basic type */
-        xfconf_basic_gvariant_to_gvalue(variant, value);
+      if (!xfconf_basic_gvariant_to_gvalue(variant, value)) {
+        g_free(value);
+        return NULL;
+      }
     }
 
     return value;
diff --git a/common/xfconf-gvaluefuncs.h b/common/xfconf-gvaluefuncs.h
index 3a100b6..95a2915 100644
--- a/common/xfconf-gvaluefuncs.h
+++ b/common/xfconf-gvaluefuncs.h
@@ -44,7 +44,7 @@ G_GNUC_INTERNAL GVariant *xfconf_basic_gvalue_to_gvariant (const GValue *value);
 
 G_GNUC_INTERNAL GVariant *xfconf_gvalue_to_gvariant (const GValue *value);
 
-G_GNUC_INTERNAL void xfconf_basic_gvariant_to_gvalue (GVariant *variant, GValue *value);
+G_GNUC_INTERNAL gboolean xfconf_basic_gvariant_to_gvalue (GVariant *variant, GValue *value);
 
 G_GNUC_INTERNAL GValue * xfconf_gvariant_to_gvalue (GVariant *variant);
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list