dbus/glib dbus-gvalue.c,1.14,1.15

Colin Walters walters at freedesktop.org
Fri Jul 1 08:44:14 PDT 2005


Update of /cvs/dbus/dbus/glib
In directory gabe:/tmp/cvs-serv22628/glib

Modified Files:
	dbus-gvalue.c 
Log Message:
2005-07-01  Colin Walters  <walters at verbum.org>

	Patch from Jonathan Matthew <jonathan at kaolin.hn.org>
	
	* glib/dbus-gvalue.c (basic_typecode_to_gtype): Fix return type.
	(dbus_g_value_types_init): Marshal G_TYPE_CHAR as DBUS_TYPE_BYTE,
	G_TYPE_LONG as DBUS_TYPE_INT32, G_TYPE_ULONG as DBUS_TYPE_UINT32,
	and G_TYPE_FLOAT as DBUS_TYPE_DOUBLE.


Index: dbus-gvalue.c
===================================================================
RCS file: /cvs/dbus/dbus/glib/dbus-gvalue.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- dbus-gvalue.c	29 Jun 2005 23:52:35 -0000	1.14
+++ dbus-gvalue.c	1 Jul 2005 15:44:12 -0000	1.15
@@ -170,7 +170,7 @@
   return typecode_to_gtype (typecode) != G_TYPE_INVALID;
 }
 
-static gboolean
+static GType
 basic_typecode_to_gtype (int typecode)
 {
   g_assert (dbus_type_is_basic (typecode));
@@ -306,7 +306,36 @@
     };
     register_basic (DBUS_TYPE_STRING, &typedata);
   }
-  
+  /* fundamental GTypes that don't map 1:1 with D-BUS types */
+  {
+    static const DBusGTypeMarshalData typedata = {
+      DBUS_TYPE_BYTE_AS_STRING,
+      &basic_vtable,
+    };
+    set_type_metadata (G_TYPE_CHAR, &typedata);
+  }
+  {
+    static const DBusGTypeMarshalData typedata = {
+      DBUS_TYPE_INT32_AS_STRING,
+      &basic_vtable,
+    };
+    set_type_metadata (G_TYPE_LONG, &typedata);
+  }
+  {
+    static const DBusGTypeMarshalData typedata = {
+      DBUS_TYPE_UINT32_AS_STRING,
+      &basic_vtable,
+    };
+    set_type_metadata (G_TYPE_ULONG, &typedata);
+  }
+  {
+    static const DBusGTypeMarshalData typedata = {
+      DBUS_TYPE_DOUBLE_AS_STRING,
+      &basic_vtable,
+    };
+    set_type_metadata (G_TYPE_FLOAT, &typedata);
+  }
+
   /* Register complex types with builtin GType mappings */
   {
     static const DBusGTypeMarshalVtable vtable = {



More information about the dbus-commit mailing list