[maemo-commits] [maemo-commits] r11724 - in projects/haf/trunk/gconf2: . debian gconf

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Mon May 21 12:08:40 EEST 2007
Author: richard
Date: 2007-05-21 12:08:39 +0300 (Mon, 21 May 2007)
New Revision: 11724

Modified:
   projects/haf/trunk/gconf2/ChangeLog
   projects/haf/trunk/gconf2/debian/changelog
   projects/haf/trunk/gconf2/gconf/gconf-dbus-utils.c
Log:
Handle empty pairs.

Modified: projects/haf/trunk/gconf2/ChangeLog
===================================================================
--- projects/haf/trunk/gconf2/ChangeLog	2007-05-21 09:05:41 UTC (rev 11723)
+++ projects/haf/trunk/gconf2/ChangeLog	2007-05-21 09:08:39 UTC (rev 11724)
@@ -1,3 +1,10 @@
+2007-05-21  Richard Hult  <richard at imendio.com>
+
+	* gconf/gconf-dbus-utils.c: (utils_append_value_helper_pair),
+	(utils_append_value), (utils_append_entry_values),
+	(utils_get_value_helper_fundamental),
+	(utils_get_value_helper_pair): Handle empty pairs.
+
 2007-05-15  Richard Hult  <richard at imendio.com>
 
 	* dbus-tests/test-stale-value-bug.c: Improve the test.

Modified: projects/haf/trunk/gconf2/debian/changelog
===================================================================
--- projects/haf/trunk/gconf2/debian/changelog	2007-05-21 09:05:41 UTC (rev 11723)
+++ projects/haf/trunk/gconf2/debian/changelog	2007-05-21 09:08:39 UTC (rev 11724)
@@ -1,3 +1,10 @@
+gconf2 (2.16.0-1osso5) unstable; urgency=low
+
+  * UNRELEASED
+  * Handle setting empty pairs
+
+ -- Richard Hult <richard at imendio.com>  Tue, 15 May 2007 15:22:55 +0200
+
 gconf2 (2.16.0-1osso4) unstable; urgency=low
 
   * Fixes: NB#49550, gconf_client_get sees a removed key

Modified: projects/haf/trunk/gconf2/gconf/gconf-dbus-utils.c
===================================================================
--- projects/haf/trunk/gconf2/gconf/gconf-dbus-utils.c	2007-05-21 09:05:41 UTC (rev 11723)
+++ projects/haf/trunk/gconf2/gconf/gconf-dbus-utils.c	2007-05-21 09:08:39 UTC (rev 11724)
@@ -214,16 +214,25 @@
   cdr = gconf_value_get_cdr (value);
   
   /* The pair types. */
-  type = car->type;
+  if (car)
+    type = car->type;
+  else
+    type = GCONF_VALUE_INVALID;
   dbus_message_iter_append_basic (&struct_iter, DBUS_TYPE_INT32, &type);
   
-  type = cdr->type;
+  if (cdr)
+    type = cdr->type;
+  else
+    type = GCONF_VALUE_INVALID;
   dbus_message_iter_append_basic (&struct_iter, DBUS_TYPE_INT32, &type);
 
   /* The values. */
-  utils_append_value_helper_fundamental (&struct_iter, car);
-  utils_append_value_helper_fundamental (&struct_iter, cdr);
+  if (car)
+    utils_append_value_helper_fundamental (&struct_iter, car);
 
+  if (cdr)
+    utils_append_value_helper_fundamental (&struct_iter, cdr);
+
   dbus_message_iter_close_container (main_iter, &struct_iter);
 }
 
@@ -485,7 +494,7 @@
 			   gboolean          is_writable,
 			   const gchar      *schema_name)   
 {
-  DBusMessageIter  struct_iter;
+  DBusMessageIter struct_iter;
 
   d(g_print ("Appending entry %s\n", key));
   
@@ -504,8 +513,7 @@
 
   dbus_message_iter_append_basic (&struct_iter, DBUS_TYPE_BOOLEAN, &is_writable);
   
-  if (!dbus_message_iter_close_container (main_iter, &struct_iter))
-    g_error ("Out of memory");
+  dbus_message_iter_close_container (main_iter, &struct_iter);
 }
 
 /* Writes an entry, which is a struct. */
@@ -728,7 +736,7 @@
   GConfValue      *value;
   DBusMessageIter  struct_iter;
   gint32           car_type, cdr_type;
-  GConfValue      *car_value, *cdr_value;
+  GConfValue      *car_value = NULL, *cdr_value = NULL;
 
   d(g_print ("Get value (pair)\n"));
 
@@ -742,20 +750,23 @@
 
   /* Get the values. */
   dbus_message_iter_next (&struct_iter);
-  if (car_type != GCONF_VALUE_SCHEMA) 
+  if (car_type == GCONF_VALUE_SCHEMA) 
+    car_value = utils_get_schema_value (&struct_iter);
+  else if (car_type != GCONF_VALUE_INVALID)
     car_value = utils_get_value_helper_fundamental (&struct_iter, car_type);
-  else
-    car_value = utils_get_schema_value (&struct_iter);
 
   dbus_message_iter_next (&struct_iter);
-  if (cdr_type != GCONF_VALUE_SCHEMA) 
+  if (cdr_type == GCONF_VALUE_SCHEMA) 
+    cdr_value = utils_get_schema_value (&struct_iter);
+  else if (cdr_type != GCONF_VALUE_INVALID)
     cdr_value = utils_get_value_helper_fundamental (&struct_iter, cdr_type);
-  else 
-    cdr_value = utils_get_schema_value (&struct_iter);
 
-  gconf_value_set_car_nocopy (value, car_value);
-  gconf_value_set_cdr_nocopy (value, cdr_value);
+  if (car_value)
+    gconf_value_set_car_nocopy (value, car_value);
 
+  if (cdr_value)
+    gconf_value_set_cdr_nocopy (value, cdr_value);
+
   return value;
 }
 


More information about the maemo-commits mailing list