GNOME Bugzilla – Bug 597053
uint16 in dbus is not translated
Last modified: 2010-03-21 10:49:20 UTC
Created attachment 144549 [details] class that exhibits the bug I have code to talk to avahi with an async method as: group.AddService( -1, //IF_UNSPEC, -1, //PROTO_UNSPEC, (uint32)0, //flags service_name, "_http._tcp", "", "", // Domain and host are local (uint16)80 , ""// service TXT ); This gets translated to: void _dynamic_AddService5 (DBusGProxy* self, gint param1, gint param2, guint32 param3, const char* param4, const char* param5, const char* param6, const char* param7, guint16 param8, const char* param9, GError** error) { dbus_g_proxy_call (self, "AddService", error, G_TYPE_INT, param1, G_TYPE_INT, param2, G_TYPE_UINT, param3, G_TYPE_STRING, param4, G_TYPE_STRING, param5, G_TYPE_STRING, param6, G_TYPE_STRING, param7, TYPE_UINT16, param8, G_TYPE_STRING, param9, G_TYPE_INVALID, G_TYPE_INVALID); if (*error) { return; } } Notice that I get TYPE_UINT16 instead of G_TYPE_UINT16. I tried to use ushort in vala but that just got eliminated. Attached is the full class. It happens in 0.7.6 and 0.7.7.
Unfortunately, there is currently no G_TYPE_INT16 in glib, see bug 562498. For this reason, dbus-glib can't send int16 values, as far as I understand it. While dynamic D-Bus client support in Vala uses dbus-glib and thus can't be used with int16, you can switch to the static D-Bus client support, which directly uses libdbus marshalling and doesn't need anything like G_TYPE_INT16.
As the GLib bug won't be fixed, there is not much we can do in places where we use dbus-glib. I recommend you to use static D-Bus client support in Vala. That should work fine as it does not use the marshalling code from dbus-glib.