dbus/dbus dbus-message.c,1.123,1.124 dbus-message.h,1.51,1.52

Owen Fraser-Green ow3n at pdx.freedesktop.org
Tue Mar 23 10:07:50 PST 2004


Update of /cvs/dbus/dbus/dbus
In directory pdx:/tmp/cvs-serv27858/dbus

Modified Files:
	dbus-message.c dbus-message.h 
Log Message:
Added InterfaceProxy to Mono bindings to avoid having to generate a proxy for every registered object. Also added object_path functions to dbus-message.


Index: dbus-message.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-message.c,v
retrieving revision 1.123
retrieving revision 1.124
diff -u -d -r1.123 -r1.124
--- a/dbus-message.c	21 Mar 2004 13:42:23 -0000	1.123
+++ b/dbus-message.c	23 Mar 2004 18:07:48 -0000	1.124
@@ -1916,7 +1916,8 @@
 	    goto errorout;
 	  break;
         case DBUS_TYPE_OBJECT_PATH:
-
+	  if (!dbus_message_iter_append_object_path (&iter, va_arg (var_args, const char*)))
+	    goto errorout;
           break;
 	case DBUS_TYPE_CUSTOM:
 	  {
@@ -1977,6 +1978,10 @@
 		if (!dbus_message_iter_append_string_array (&iter, (const char **)data, len))
 		  goto errorout;
 		break;
+	      case DBUS_TYPE_OBJECT_PATH:
+		if (!dbus_message_iter_append_object_path_array (&iter, (const char **)data, len))
+		  goto errorout;
+		break;
 	      case DBUS_TYPE_NIL:
 	      case DBUS_TYPE_ARRAY:
 	      case DBUS_TYPE_CUSTOM:
@@ -2664,7 +2669,6 @@
   int type, pos;
 
   _dbus_return_val_if_fail (dbus_message_iter_check (real), NULL);
-
   pos = dbus_message_iter_get_data_start (real, &type);
   
   _dbus_assert (type == DBUS_TYPE_STRING);
@@ -2673,11 +2677,7 @@
                                  pos, NULL);
 }
 
-#if 0
 /**
- * @todo FIXME to finish this _dbus_demarshal_object_path() needs
- * to not explode the path.
- * 
  * Returns the object path value that an iterator may point to.
  * Note that you need to check that the iterator points to
  * an object path value before using this function.
@@ -2698,10 +2698,9 @@
   
   _dbus_assert (type == DBUS_TYPE_OBJECT_PATH);
 
-  return _dbus_demarshal_object_path (&real->message->body, real->message->byte_order,
-                                      pos, NULL);
+  return _dbus_demarshal_string (&real->message->body, real->message->byte_order,
+                                 pos, NULL);
 }
-#endif
 
 /**
  * Returns the name and data from a custom type that an iterator may
@@ -3325,11 +3324,7 @@
     return TRUE;
 }
 
-#if 0
 /**
- * @todo FIXME to implement this _dbus_demarshal_object_path_array()
- * needs implementing
- * 
  * Returns the object path array that the iterator may point to.
  * Note that you need to check that the iterator points
  * to an object path array prior to using this function.
@@ -3361,13 +3356,12 @@
   type = iter_get_array_type (real, NULL);
   _dbus_assert (type == DBUS_TYPE_OBJECT_PATH);
 
-  if (!_dbus_demarshal_object_path_array (&real->message->body, real->message->byte_order,
-                                          pos, NULL, value, len))
+  if (!_dbus_demarshal_string_array (&real->message->body, real->message->byte_order,
+				     pos, NULL, value, len))
     return FALSE;
   else
     return TRUE;
 }
-#endif
 
 /**
  * Returns the key name fot the dict entry that an iterator
@@ -3800,6 +3794,37 @@
 }
 
 /**
+ * Appends an object path to the message.
+ *
+ * @todo add return_val_if_fail(UTF-8 is valid)
+ *
+ * @param iter an iterator pointing to the end of the message
+ * @param value the object path
+ * @returns #TRUE on success
+ */
+dbus_bool_t
+dbus_message_iter_append_object_path (DBusMessageIter *iter,
+				      const char      *value)
+{
+  DBusMessageRealIter *real = (DBusMessageRealIter *)iter;
+
+  _dbus_return_val_if_fail (dbus_message_iter_append_check (real), FALSE);
+  
+  if (!dbus_message_iter_append_type (real, DBUS_TYPE_OBJECT_PATH))
+    return FALSE;
+  
+  if (!_dbus_marshal_string (&real->message->body, real->message->byte_order, value))
+    {
+      _dbus_string_set_length (&real->message->body, real->pos);
+      return FALSE;
+    }
+
+  dbus_message_iter_append_done (real);
+  
+  return TRUE;
+}
+
+/**
  * Appends a custom type data chunk to the message. A custom
  * type is simply an arbitrary UTF-8 string used as a type
  * tag, plus an array of arbitrary bytes to be interpreted
@@ -4331,6 +4356,37 @@
 }
 
 /**
+ * Appends an object path array to the message.
+ *
+ * @param iter an iterator pointing to the end of the message
+ * @param value the array
+ * @param len the length of the array
+ * @returns #TRUE on success
+ */
+dbus_bool_t
+dbus_message_iter_append_object_path_array (DBusMessageIter *iter,
+					    const char     **value,
+					    int              len)
+{
+  DBusMessageRealIter *real = (DBusMessageRealIter *)iter;
+
+  _dbus_return_val_if_fail (dbus_message_iter_append_check (real), FALSE);
+
+  if (!append_array_type (real, DBUS_TYPE_OBJECT_PATH, NULL, NULL))
+    return FALSE;
+  
+  if (!_dbus_marshal_string_array (&real->message->body, real->message->byte_order, value, len))
+    {
+      _dbus_string_set_length (&real->message->body, real->pos);
+      return FALSE;
+    }
+
+  dbus_message_iter_append_done (real);
+  
+  return TRUE;
+}
+
+/**
  * Sets the message sender.
  *
  * @param message the message

Index: dbus-message.h
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-message.h,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -d -r1.51 -r1.52
--- a/dbus-message.h	21 Mar 2004 13:42:23 -0000	1.51
+++ b/dbus-message.h	23 Mar 2004 18:07:48 -0000	1.52
@@ -230,6 +230,8 @@
 						    double                value);
 dbus_bool_t dbus_message_iter_append_string        (DBusMessageIter      *iter,
 						    const char           *value);
+dbus_bool_t dbus_message_iter_append_object_path   (DBusMessageIter      *iter,
+						    const char           *value);
 dbus_bool_t dbus_message_iter_append_custom        (DBusMessageIter      *iter,
 						    const char           *name,
 						    const unsigned char  *data,
@@ -269,6 +271,9 @@
 dbus_bool_t dbus_message_iter_append_string_array  (DBusMessageIter      *iter,
 						    const char          **value,
 						    int                   len);
+dbus_bool_t dbus_message_iter_append_object_path_array (DBusMessageIter      *iter,
+							const char          **value,
+							int                   len);
 
 
 




More information about the dbus-commit mailing list