dbus/glib dbus-gvalue.h, 1.2, 1.3 dbus-gvalue.c, 1.6, 1.7 dbus-gutils.h, 1.7, 1.8 dbus-gutils.c, 1.10, 1.11 dbus-gparser.c, 1.13, 1.14 dbus-gobject.c, 1.20, 1.21 dbus-glib-tool.c, 1.10, 1.11 dbus-gidl.h, 1.10, 1.11 dbus-gidl.c, 1.13, 1.14 dbus-binding-tool-glib.c, 1.3, 1.4

Colin Walters walters at freedesktop.org
Sun Feb 27 09:38:14 PST 2005


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

Modified Files:
	dbus-gvalue.h dbus-gvalue.c dbus-gutils.h dbus-gutils.c 
	dbus-gparser.c dbus-gobject.c dbus-glib-tool.c dbus-gidl.h 
	dbus-gidl.c dbus-binding-tool-glib.c 
Log Message:
2005-02-27  Colin Walters  <walters at verbum.org>

	* glib/dbus-gidl.c (property_info_get_type, arg_info_get_type):
	Change return value to const char * instead of int so we can do
	full signatures.
	(struct PropertyInfo, struct ArgInfo): Store char *.
	(property_info_new, arg_info_new): Update parameters, strdup.
	(property_info_unref, arg_info_unref): Free.

	* glib/dbus-gidl.h: Update prototypes.

	* glib/dbus-gparser.c (basic_type_from_string): Delete.
	(validate_signature): New function, just validates signature and
	sets GError.
	(parse_property, parse_arg): Invoke validate_signature.  Store
	signature instead of just type code.

	* glib/dbus-gvalue.c (base_type_from_signature): New utility
	function to return a primary type for a signature, dropping
	information about types in container types.
	(dbus_gvalue_genmarshal_name_from_type)
	(dbus_gvalue_binding_type_from_type)
	(dbus_gvalue_ctype_from_type): Update to take full signature
	 instead of type code.
	(dbus_gtype_to_dbus_type): Moved here from glib/dbus-gobject.c.

	* glib/dbus-gvalue.h: Update prototypes for above.

	* glib/dbus-gobject.c (gtype_to_dbus_type): Moved to
	glib/dbus-gvalue.c as dbus_gtype_to_dbus_type.
	(introspect_properties, introspect_signals, write_interface):
	Update to handle signatures, and remove usage of
	_dbus_gutils_type_to_string.
	(handle_introspect): Print out type codes instead of e.g. "string"
	in hardcoded introspection XML; also use x_AS_STRING constants
	instead of hardcoding in string.

	* glib/dbus-glib-tool.c (pretty_print): Handle signature change
	to string.  Remove usage of _dbus_gutils_type_to_string.

	* glib/dbus-gutils.c (_dbus_gutils_type_to_string): Delete.

	* glib/dbus-gutils.h (_dbus_gutils_type_to_string): Update for
	deletion.
	
	* glib/dbus-binding-tool-glib.c (compute_marshaller)
	(compute_marshaller_name, generate_glue): Handle signature change
	to string.
	(write_formal_parameters, write_args_for_direction): Ditto, and
	remove FIXME.

	* tools/dbus-tree-view.c (type_to_string): Delete.
	(info_set_func_text): Update to print full signatures.

	* test/glib/test-service-glib.xml: Change types to new
	introspection format.


Index: dbus-gvalue.h
===================================================================
RCS file: /cvs/dbus/dbus/glib/dbus-gvalue.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- dbus-gvalue.h	17 Feb 2005 17:41:26 -0000	1.2
+++ dbus-gvalue.h	27 Feb 2005 17:38:12 -0000	1.3
@@ -20,11 +20,13 @@
   char * chararray_val;
 } DBusBasicGValue;
 
-const char *   dbus_gvalue_genmarshal_name_from_type (int type);
+const char *   dbus_gvalue_genmarshal_name_from_type (const char *type);
 
-const char *   dbus_gvalue_ctype_from_type           (int type, gboolean in);
+const char *   dbus_gvalue_ctype_from_type           (const char *type, gboolean in);
 
-const char *   dbus_gvalue_binding_type_from_type    (int type);
+const char *   dbus_gvalue_binding_type_from_type    (const char *type);
+
+const char *   dbus_gtype_to_dbus_type    (GType            type);
 
 gboolean       dbus_gvalue_init           (int              type,
 					   GValue          *value);

Index: dbus-gvalue.c
===================================================================
RCS file: /cvs/dbus/dbus/glib/dbus-gvalue.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- dbus-gvalue.c	17 Feb 2005 17:41:26 -0000	1.6
+++ dbus-gvalue.c	27 Feb 2005 17:38:12 -0000	1.7
@@ -23,6 +23,7 @@
  */
 
 #include <dbus-gvalue.h>
+#include "dbus/dbus-signature.h"
 
 /* This is slightly evil, we don't use g_value_set_foo() functions */
 #define MAP_BASIC_INIT(d_t, g_t)                                     \
@@ -71,9 +72,24 @@
   return can_convert;
 }
 
+/* FIXME - broken for containers
+ */
+static int
+base_type_from_signature  (const char *signature)
+{
+  DBusSignatureIter iter;
+
+  dbus_signature_iter_init (&iter, signature);
+
+  return dbus_signature_iter_get_current_type (&iter);
+}
+
 const char *
-dbus_gvalue_genmarshal_name_from_type (int type)
+dbus_gvalue_genmarshal_name_from_type (const char *signature)
 {
+  int type;
+
+  type = base_type_from_signature (signature);
   switch (type)
     {
     case DBUS_TYPE_BOOLEAN:
@@ -109,8 +125,12 @@
 }
 
 const char *
-dbus_gvalue_binding_type_from_type (int type)
+dbus_gvalue_binding_type_from_type (const char *signature)
 {
+  int type;
+
+  type = base_type_from_signature (signature);
+
 #define STRINGIFY(x) \
   case x: \
     return (#x)
@@ -142,8 +162,12 @@
 }
 
 const char *
-dbus_gvalue_ctype_from_type (int type, gboolean in)
+dbus_gvalue_ctype_from_type (const char *signature, gboolean in)
 {
+  int type;
+
+  type = base_type_from_signature (signature);
+
   switch (type)
     {
     case DBUS_TYPE_BOOLEAN:
@@ -181,6 +205,47 @@
   return NULL;
 }
 
+const char *
+dbus_gtype_to_dbus_type (GType type)
+{
+  switch (type)
+    {
+    case G_TYPE_CHAR:
+    case G_TYPE_UCHAR:
+      return DBUS_TYPE_BYTE_AS_STRING;
+      
+    case G_TYPE_BOOLEAN:
+      return DBUS_TYPE_BOOLEAN_AS_STRING;
+
+      /* long gets cut to 32 bits so the remote API is consistent
+       * on all architectures
+       */
+      
+    case G_TYPE_LONG:
+    case G_TYPE_INT:
+      return DBUS_TYPE_INT32_AS_STRING;
+    case G_TYPE_ULONG:
+    case G_TYPE_UINT:
+      return DBUS_TYPE_UINT32_AS_STRING;
+
+    case G_TYPE_INT64:
+      return DBUS_TYPE_INT64_AS_STRING;
+
+    case G_TYPE_UINT64:
+      return DBUS_TYPE_UINT64_AS_STRING;
+      
+    case G_TYPE_FLOAT:
+    case G_TYPE_DOUBLE:
+      return DBUS_TYPE_DOUBLE_AS_STRING;
+
+    case G_TYPE_STRING:
+      return DBUS_TYPE_STRING_AS_STRING;
+
+    default:
+      return NULL;
+    }
+}
+
 gboolean
 dbus_gvalue_demarshal (DBusMessageIter *iter, GValue *value)
 {

Index: dbus-gutils.h
===================================================================
RCS file: /cvs/dbus/dbus/glib/dbus-gutils.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- dbus-gutils.h	17 Feb 2005 17:41:26 -0000	1.7
+++ dbus-gutils.h	27 Feb 2005 17:38:12 -0000	1.8
@@ -32,7 +32,6 @@
 G_BEGIN_DECLS
 
 char      **_dbus_gutils_split_path     (const char *path);
-const char *_dbus_gutils_type_to_string (int         type);
 
 char       *_dbus_gutils_wincaps_to_uscore (const char *uscore);
 

Index: dbus-gutils.c
===================================================================
RCS file: /cvs/dbus/dbus/glib/dbus-gutils.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- dbus-gutils.c	17 Feb 2005 17:41:26 -0000	1.10
+++ dbus-gutils.c	27 Feb 2005 17:38:12 -0000	1.11
@@ -83,48 +83,6 @@
   return split;
 }
 
-const char *
-_dbus_gutils_type_to_string (int type)
-{
-  switch (type)
-    {
-    case DBUS_TYPE_INVALID:
-      return "invalid";
-    case DBUS_TYPE_BOOLEAN:
-      return "boolean";
-    case DBUS_TYPE_BYTE:
-      return "byte";
-    case DBUS_TYPE_INT16:
-      return "int16";
-    case DBUS_TYPE_UINT16:
-      return "uint16";
-    case DBUS_TYPE_INT32:
-      return "int32";
-    case DBUS_TYPE_UINT32:
-      return "uint32";
-    case DBUS_TYPE_DOUBLE:
-      return "double";
-    case DBUS_TYPE_STRING:
-      return "string";
-    case DBUS_TYPE_OBJECT_PATH:
-      return "object_path";
-    case DBUS_TYPE_SIGNATURE:
-      return "signature";
-    case DBUS_TYPE_STRUCT:
-      return "struct";
-    case DBUS_TYPE_ARRAY:
-      return "array";
-    case DBUS_TYPE_VARIANT:
-      return "variant";
-    case DBUS_STRUCT_BEGIN_CHAR:
-      return "begin_struct";
-    case DBUS_STRUCT_END_CHAR:
-      return "end_struct";
-    default:
-      return "unknown";
-    }
-}
-
 char*
 _dbus_gutils_wincaps_to_uscore (const char *caps)
 {

Index: dbus-gparser.c
===================================================================
RCS file: /cvs/dbus/dbus/glib/dbus-gparser.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- dbus-gparser.c	19 Feb 2005 16:17:29 -0000	1.13
+++ dbus-gparser.c	27 Feb 2005 17:38:12 -0000	1.14
@@ -21,7 +21,9 @@
  *
  */
 #include "dbus-gparser.h"
+#include "dbus/dbus-glib-lowlevel.h"
 #include "dbus-gidl.h"
+#include "dbus/dbus-signature.h"
 #include <string.h>
 
 #include <libintl.h>
@@ -461,59 +463,21 @@
   return TRUE;
 }
 
-static int
-basic_type_from_string (const char *str)
+static gboolean
+validate_signature (const char *str,
+		    const char *element_name,
+		    GError    **error)
 {
-  if (strcmp (str, "string") == 0)
-    return DBUS_TYPE_STRING;
-  else if (strcmp (str, "int16") == 0)
-    return DBUS_TYPE_INT16;
-  else if (strcmp (str, "uint16") == 0)
-    return DBUS_TYPE_UINT16;
-  else if (strcmp (str, "int32") == 0)
-    return DBUS_TYPE_INT32;
-  else if (strcmp (str, "uint32") == 0)
-    return DBUS_TYPE_UINT32;
-  else if (strcmp (str, "int64") == 0)
-    return DBUS_TYPE_INT64;
-  else if (strcmp (str, "uint64") == 0)
-    return DBUS_TYPE_UINT64;
-  else if (strcmp (str, "double") == 0)
-    return DBUS_TYPE_DOUBLE;
-  else if (strcmp (str, "byte") == 0)
-    return DBUS_TYPE_BYTE;
-  else if (strcmp (str, "boolean") == 0)
-    return DBUS_TYPE_BOOLEAN;
-  else if (strcmp (str, "byte") == 0)
-    return DBUS_TYPE_BYTE;
-  else if (strcmp (str, "object") == 0)
-    return DBUS_TYPE_OBJECT_PATH;
-  else if (strcmp (str, "variant") == 0)
-    return DBUS_TYPE_VARIANT;
-  else
-    return DBUS_TYPE_INVALID;
-}
+  DBusError derror;
 
-/* FIXME we have to allow type signatures, not just basic types
- */
-static int
-type_from_string (const char *str,
-                  const char *element_name,
-                  GError    **error)
-{
-  int t;
+  dbus_error_init (&derror);
   
-  t = basic_type_from_string (str);
-
-  if (t == DBUS_TYPE_INVALID)
+  if (!dbus_signature_validate (str, &derror))
     {
-      g_set_error (error, G_MARKUP_ERROR,
-                   G_MARKUP_ERROR_PARSE,
-                   _("Type \"%s\" not understood on <%s> element "),
-                   str, element_name);
+      dbus_set_g_error (error, &derror);
+      return FALSE;
     }
-
-  return t;
+  return TRUE;
 }
 
 static gboolean
@@ -529,7 +493,6 @@
   PropertyInfo *property;
   NodeInfo *top;
   PropertyAccessFlags access_flags;
-  int t;
   
   if (parser->interface == NULL ||
       parser->node_stack == NULL ||
@@ -582,8 +545,7 @@
       return FALSE;
     }
 
-  t = type_from_string (type, element_name, error);
-  if (t == DBUS_TYPE_INVALID)
+  if (!validate_signature (type, element_name, error))
     return FALSE;
 
   access_flags = 0;
@@ -604,7 +566,7 @@
   
   top = parser->node_stack->data;
   
-  property = property_info_new (name, t, access_flags);
+  property = property_info_new (name, type, access_flags);
   interface_info_add_property (parser->interface, property);
   property_info_unref (property);
 
@@ -624,7 +586,6 @@
   const char *type;
   const char *direction;
   ArgDirection dir;
-  int t;
   ArgInfo *arg;
   char *generated_name;
   
@@ -694,8 +655,7 @@
       return FALSE;
     }
 
-  t = type_from_string (type, element_name, error);
-  if (t == DBUS_TYPE_INVALID)
+  if (!validate_signature (type, element_name, error))
     return FALSE;
 
   generated_name = NULL;
@@ -706,7 +666,7 @@
                                       signal_info_get_n_args (parser->signal));
                                       
   
-  arg = arg_info_new (name ? name : generated_name, dir, t);
+  arg = arg_info_new (name ? name : generated_name, dir, type);
   if (parser->method)
     method_info_add_arg (parser->method, arg);
   else if (parser->signal)

Index: dbus-gobject.c
===================================================================
RCS file: /cvs/dbus/dbus/glib/dbus-gobject.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- dbus-gobject.c	19 Feb 2005 16:17:29 -0000	1.20
+++ dbus-gobject.c	27 Feb 2005 17:38:12 -0000	1.21
@@ -247,47 +247,6 @@
 
 }
 
-static int
-gtype_to_dbus_type (GType type)
-{
-  switch (type)
-    {
-    case G_TYPE_CHAR:
-    case G_TYPE_UCHAR:
-      return DBUS_TYPE_BYTE;
-      
-    case G_TYPE_BOOLEAN:
-      return DBUS_TYPE_BOOLEAN;
-
-      /* long gets cut to 32 bits so the remote API is consistent
-       * on all architectures
-       */
-      
-    case G_TYPE_LONG:
-    case G_TYPE_INT:
-      return DBUS_TYPE_INT32;
-    case G_TYPE_ULONG:
-    case G_TYPE_UINT:
-      return DBUS_TYPE_UINT32;
-
-    case G_TYPE_INT64:
-      return DBUS_TYPE_INT64;
-
-    case G_TYPE_UINT64:
-      return DBUS_TYPE_UINT64;
-      
-    case G_TYPE_FLOAT:
-    case G_TYPE_DOUBLE:
-      return DBUS_TYPE_DOUBLE;
-
-    case G_TYPE_STRING:
-      return DBUS_TYPE_STRING;
-
-    default:
-      return DBUS_TYPE_INVALID;
-    }
-}
-
 static void
 introspect_properties (GObject *object, GString *xml)
 {
@@ -303,13 +262,13 @@
   for (i = 0; i < n_specs; i++ )
     {
       char *s;
-      int dbus_type;
+      const char *dbus_type;
       gboolean can_set;
       gboolean can_get;
       GParamSpec *spec = specs[i];
       
-      dbus_type = gtype_to_dbus_type (G_PARAM_SPEC_VALUE_TYPE (spec));
-      if (dbus_type == DBUS_TYPE_INVALID)
+      dbus_type = dbus_gtype_to_dbus_type (G_PARAM_SPEC_VALUE_TYPE (spec));
+      if (dbus_type == NULL)
 	continue;
       
       if (spec->owner_type != last_type)
@@ -341,7 +300,7 @@
           g_string_append (xml, "    <property name=\"");
           g_string_append (xml, s);
           g_string_append (xml, "\" type=\"");
-          g_string_append (xml, _dbus_gutils_type_to_string (dbus_type));
+          g_string_append (xml, dbus_type);
           g_string_append (xml, "\" access=\"");
 
           if (can_set && can_get)
@@ -397,10 +356,10 @@
 
       for (arg = 0; arg < query.n_params; arg++)
 	{
-	  int dbus_type = gtype_to_dbus_type (query.param_types[arg]);
+	  const char *dbus_type = dbus_gtype_to_dbus_type (query.param_types[arg]);
 
           g_string_append (xml, "      <arg type=\"");
-          g_string_append (xml, _dbus_gutils_type_to_string (dbus_type));
+          g_string_append (xml, dbus_type);
           g_string_append (xml, "\"/>\n");
 	}
 
@@ -455,7 +414,7 @@
 
 	  /* FIXME - handle container types */
 	  g_string_append_printf (xml, "      <arg name=\"%s\" type=\"%s\" direction=\"%s\"/>\n",
-				  name, _dbus_gutils_type_to_string (type[0]), arg_in ? "in" : "out");
+				  name, type, arg_in ? "in" : "out");
 
 	}
       g_string_append (xml, "    </method>\n");
@@ -543,21 +502,21 @@
   /* We are introspectable, though I guess that was pretty obvious */
   g_string_append_printf (xml, "  <interface name=\"%s\">\n", DBUS_INTERFACE_INTROSPECTABLE);
   g_string_append (xml, "    <method name=\"Introspect\">\n");
-  g_string_append (xml, "      <arg name=\"data\" direction=\"out\" type=\"string\"/>\n");
+  g_string_append_printf (xml, "      <arg name=\"data\" direction=\"out\" type=\"%s\"/>\n", DBUS_TYPE_STRING_AS_STRING);
   g_string_append (xml, "    </method>\n");
   g_string_append (xml, "  </interface>\n");
 
   /* We support get/set properties */
   g_string_append_printf (xml, "  <interface name=\"%s\">\n", DBUS_INTERFACE_PROPERTIES);
   g_string_append (xml, "    <method name=\"Get\">\n");
-  g_string_append (xml, "      <arg name=\"interface\" direction=\"in\" type=\"string\"/>\n");
-  g_string_append (xml, "      <arg name=\"propname\" direction=\"in\" type=\"string\"/>\n");
-  g_string_append (xml, "      <arg name=\"value\" direction=\"out\" type=\"variant\"/>\n");
+  g_string_append_printf (xml, "      <arg name=\"interface\" direction=\"in\" type=\"%s\"/>\n", DBUS_TYPE_STRING_AS_STRING);
+  g_string_append_printf (xml, "      <arg name=\"propname\" direction=\"in\" type=\"%s\"/>\n", DBUS_TYPE_STRING_AS_STRING);
+  g_string_append_printf (xml, "      <arg name=\"value\" direction=\"out\" type=\"%s\"/>\n", DBUS_TYPE_VARIANT_AS_STRING);
   g_string_append (xml, "    </method>\n");
   g_string_append (xml, "    <method name=\"Set\">\n");
-  g_string_append (xml, "      <arg name=\"interface\" direction=\"in\" type=\"string\"/>\n");
-  g_string_append (xml, "      <arg name=\"propname\" direction=\"in\" type=\"string\"/>\n");
-  g_string_append (xml, "      <arg name=\"value\" direction=\"in\" type=\"variant\"/>\n");
+  g_string_append_printf (xml, "      <arg name=\"interface\" direction=\"in\" type=\"%s\"/>\n", DBUS_TYPE_STRING_AS_STRING);
+  g_string_append_printf (xml, "      <arg name=\"propname\" direction=\"in\" type=\"%s\"/>\n", DBUS_TYPE_STRING_AS_STRING);
+  g_string_append_printf (xml, "      <arg name=\"value\" direction=\"in\" type=\"%s\"/>\n", DBUS_TYPE_VARIANT_AS_STRING);
   g_string_append (xml, "    </method>\n");
   g_string_append (xml, "  </interface>\n");
   

Index: dbus-glib-tool.c
===================================================================
RCS file: /cvs/dbus/dbus/glib/dbus-glib-tool.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- dbus-glib-tool.c	19 Feb 2005 23:25:41 -0000	1.10
+++ dbus-glib-tool.c	27 Feb 2005 17:38:12 -0000	1.11
@@ -177,13 +177,13 @@
     case INFO_TYPE_PROPERTY:
       {
         PropertyInfo *a = (PropertyInfo*) base;
-        int pt = property_info_get_type (a);
+        const char *pt = property_info_get_type (a);
         PropertyAccessFlags acc = property_info_get_access (a);
 
         printf ("%s%s %s",
                 acc & PROPERTY_READ ? "read" : "",
                 acc & PROPERTY_WRITE ? "write" : "",
-                _dbus_gutils_type_to_string (pt));
+                pt);
         if (name)
           printf (" %s\n", name);
         else
@@ -193,12 +193,12 @@
     case INFO_TYPE_ARG:
       {
         ArgInfo *a = (ArgInfo*) base;
-        int at = arg_info_get_type (a);
+        const char *at = arg_info_get_type (a);
         ArgDirection d = arg_info_get_direction (a);
 
         printf ("%s %s",
                 d == ARG_IN ? "in" : "out",
-                _dbus_gutils_type_to_string (at));
+                at);
         if (name)
           printf (" %s\n", name);
         else

Index: dbus-gidl.h
===================================================================
RCS file: /cvs/dbus/dbus/glib/dbus-gidl.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- dbus-gidl.h	17 Feb 2005 21:11:18 -0000	1.10
+++ dbus-gidl.h	27 Feb 2005 17:38:12 -0000	1.11
@@ -128,20 +128,20 @@
                                                    ArgInfo             *arg);
 int                 signal_info_get_n_args        (SignalInfo          *info);
 PropertyInfo*       property_info_new             (const char          *name,
-                                                   int                  type,
+                                                   const char          *type,
                                                    PropertyAccessFlags  access);
 PropertyInfo*       property_info_ref             (PropertyInfo        *info);
 void                property_info_unref           (PropertyInfo        *info);
 const char*         property_info_get_name        (PropertyInfo        *info);
-int                 property_info_get_type        (PropertyInfo        *info);
+const char*         property_info_get_type        (PropertyInfo        *info);
 PropertyAccessFlags property_info_get_access      (PropertyInfo        *info);
 ArgInfo*            arg_info_new                  (const char          *name,
                                                    ArgDirection         direction,
-                                                   int                  type);
+                                                   const char          *type);
 ArgInfo*            arg_info_ref                  (ArgInfo             *info);
 void                arg_info_unref                (ArgInfo             *info);
 const char*         arg_info_get_name             (ArgInfo             *info);
-int                 arg_info_get_type             (ArgInfo             *info);
+const char*         arg_info_get_type             (ArgInfo             *info);
 ArgDirection        arg_info_get_direction        (ArgInfo             *info);
 
 G_END_DECLS

Index: dbus-gidl.c
===================================================================
RCS file: /cvs/dbus/dbus/glib/dbus-gidl.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- dbus-gidl.c	17 Feb 2005 21:11:18 -0000	1.13
+++ dbus-gidl.c	27 Feb 2005 17:38:12 -0000	1.14
@@ -66,14 +66,14 @@
 struct PropertyInfo
 {
   BaseInfo base;
-  int type;
+  char *type;
   PropertyAccessFlags access;
 };
 
 struct ArgInfo
 {
   BaseInfo base;
-  int type;
+  char *type;
   ArgDirection direction;
 };
 
@@ -631,7 +631,7 @@
 
 PropertyInfo*
 property_info_new (const char          *name,
-                   int                  type,
+                   const char          *type,
                    PropertyAccessFlags  access)
 {
   PropertyInfo *info;
@@ -641,7 +641,7 @@
   info->base.name = g_strdup (name);
   info->base.type = INFO_TYPE_PROPERTY;
 
-  info->type = type;
+  info->type = g_strdup (type);
   info->access = access;
   
   return info;
@@ -662,6 +662,7 @@
   if (info->base.refcount == 0)
     {
       base_info_free (info);
+      g_free (info->type);
     }
 }
 
@@ -671,7 +672,7 @@
   return info->base.name;
 }
 
-int
+const char *
 property_info_get_type (PropertyInfo *info)
 {
   return info->type;
@@ -686,7 +687,7 @@
 ArgInfo*
 arg_info_new (const char  *name,
               ArgDirection direction,
-              int          type)
+              const char  *type)
 {
   ArgInfo *info;
 
@@ -697,7 +698,7 @@
   /* name can be NULL */
   info->base.name = g_strdup (name);
   info->direction = direction;
-  info->type = type;
+  info->type = g_strdup (type);
 
   return info;
 }
@@ -717,6 +718,7 @@
   if (info->base.refcount == 0)
     {
       base_info_free (info);
+      g_free (info->type);
     }
 }
 const char*
@@ -725,7 +727,7 @@
   return info->base.name;
 }
 
-int
+const char *
 arg_info_get_type (ArgInfo *info)
 {
   return info->type;

Index: dbus-binding-tool-glib.c
===================================================================
RCS file: /cvs/dbus/dbus/glib/dbus-binding-tool-glib.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- dbus-binding-tool-glib.c	19 Feb 2005 23:25:41 -0000	1.3
+++ dbus-binding-tool-glib.c	27 Feb 2005 17:38:12 -0000	1.4
@@ -68,13 +68,15 @@
 
       if (arg_info_get_direction (arg) == ARG_IN)
 	{
-	  const char *marshal_name = dbus_gvalue_genmarshal_name_from_type (arg_info_get_type (arg));
+	  const char *marshal_name;
+
+	  marshal_name = dbus_gvalue_genmarshal_name_from_type (arg_info_get_type (arg));
 	  if (!marshal_name)
 	    {
 	      g_set_error (error,
 			   DBUS_BINDING_TOOL_ERROR,
 			   DBUS_BINDING_TOOL_ERROR_UNSUPPORTED_CONVERSION,
-			   _("Unsupported conversion from D-BUS type %d to glib-genmarshal type"),
+			   _("Unsupported conversion from D-BUS type %s to glib-genmarshal type"),
 			   arg_info_get_type (arg));
 	      g_string_free (ret, TRUE);
 	      return NULL;
@@ -129,7 +131,7 @@
       if (arg_info_get_direction (arg) == ARG_IN)
 	{
 	  const char *marshal_name;
-	  int type; 
+	  const char *type;
 
 	  type = arg_info_get_type (arg);
 	  marshal_name = dbus_gvalue_genmarshal_name_from_type (type);
@@ -145,7 +147,7 @@
 	    }
 
 	  g_string_append (ret, "_");
-	  g_string_append (ret, dbus_gvalue_genmarshal_name_from_type (arg_info_get_type (arg)));
+	  g_string_append (ret, dbus_gvalue_genmarshal_name_from_type (type));
 	}
     }
 
@@ -385,7 +387,7 @@
 	      g_string_append_c (object_introspection_data_blob, direction);
 	      g_string_append_c (object_introspection_data_blob, '\0');
 
-	      g_string_append_c (object_introspection_data_blob, arg_info_get_type (arg));
+	      g_string_append (object_introspection_data_blob, arg_info_get_type (arg));
 	      g_string_append_c (object_introspection_data_blob, '\0');
 	    }
 
@@ -608,7 +610,6 @@
 
       direction = arg_info_get_direction (arg);
 
-      /* FIXME - broken for containers */
       type_str = dbus_gvalue_ctype_from_type (arg_info_get_type (arg), direction == ARG_IN);
 
       if (!type_str)
@@ -616,7 +617,7 @@
 	  g_set_error (error,
 		       DBUS_BINDING_TOOL_ERROR,
 		       DBUS_BINDING_TOOL_ERROR_UNSUPPORTED_CONVERSION,
-		       _("Unsupported conversion from D-BUS type %d to glib C type"),
+		       _("Unsupported conversion from D-BUS type %s to glib C type"),
 		       arg_info_get_type (arg));
 	  return FALSE;
 	}
@@ -660,15 +661,14 @@
       if (direction != arg_info_get_direction (arg))
 	continue;
 
-      /* FIXME - broken for containers */
       type_str = dbus_gvalue_binding_type_from_type (arg_info_get_type (arg));
       if (!type_str)
 	{
 	  g_set_error (error,
 		       DBUS_BINDING_TOOL_ERROR,
 		       DBUS_BINDING_TOOL_ERROR_UNSUPPORTED_CONVERSION,
-		       _("Unsupported conversion from D-BUS type %c"),
-		       (char) arg_info_get_type (arg));
+		       _("Unsupported conversion from D-BUS type %s"),
+		       arg_info_get_type (arg));
 	  return FALSE;
 	}
 



More information about the dbus-commit mailing list