From 74b1b35402f6b9bbc09999a6224dfc04bc48b2a9 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Wed, 9 Mar 2005 17:09:11 +0000 Subject: 2005-03-09 Colin Walters * glib/dbus-gproxy.c (dbus_g_proxy_invoke): New method; calls to this are generated for client-side wrappers. Invokes a D-BUS method and returns reply values. * glib/dbus-binding-tool-glib.c (write_args_sig_for_direction): New function; writes signature string for argument direction. (write_args_for_direction): Change to pass input values directly instead of via address, and fix indentation. (generate_client_glue): Change to invoke dbus_g_proxy_invoke. Also make generated wrappers inlineable. * dbus/dbus-message.c (dbus_message_iter_get_fixed_array): Add note about using dbus_type_is_fixed. * dbus/dbus-marshal-basic.c (_dbus_type_is_fixed): Moved to dbus/dbus-signature.c as dbus_type_is_fixed. All callers updated. * dbus/dbus-signature.c (dbus_type_is_fixed): Moved here from dbus/dbus-marshal-basic.c:_dbus_type_is_fixed. * dbus/dbus-signature.h: Prototype. * glib/dbus-binding-tool-glib.c (compute_marshaller_name): Fix error printf code. * test/glib/test-dbus-glib.c (main): Be sure to clear error as appropriate instead of just freeing it. (main): Free returned strings using g_free. * test/glib/Makefile.am (test-service-glib-glue.h) (test-service-glib-bindings.h): Add dependency on dbus-binding-tool. * glib/dbus-gvalue.c (MAP_BASIC): Refactored from MAP_BASIC_INIT; simply maps a simple D-BUS type to GType. (dbus_dbus_type_to_gtype): Function which maps D-BUS type to GType. (dbus_gvalue_init): Just invoke dbus_dbus_type_to_gtype and initialize the value with it. (dbus_gvalue_binding_type_from_type): Unused, delete. (dbus_gvalue_demarshal): Switch to hardcoding demarshalling for various types instead of unmarshalling to value data directly. Remove can_convert boolean. (dbus_gvalue_marshal): Remove duplicate initialization; switch to returning directly instead of using can_convert boolean. (dbus_gvalue_store): New function; not related to D-BUS per-se. Stores a GValue in a pointer to a value of its corresponding C type. * glib/dbus-gvalue.h: Remove dbus_gvalue_binding_type_from_type, add dbus_gvalue_store. --- test/glib/Makefile.am | 4 ++-- test/glib/test-dbus-glib.c | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'test/glib') diff --git a/test/glib/Makefile.am b/test/glib/Makefile.am index 58f4d778..b0b8361a 100644 --- a/test/glib/Makefile.am +++ b/test/glib/Makefile.am @@ -44,10 +44,10 @@ test_service_glib_SOURCES= \ BUILT_SOURCES = test-service-glib-glue.h test-service-glib-bindings.h -test-service-glib-glue.h: test-service-glib.xml +test-service-glib-glue.h: test-service-glib.xml $(top_builddir)/glib/dbus-binding-tool $(top_builddir)/glib/dbus-binding-tool --mode=glib-server --output=test-service-glib-glue.h test-service-glib.xml -test-service-glib-bindings.h: test-service-glib.xml +test-service-glib-bindings.h: test-service-glib.xml $(top_builddir)/glib/dbus-binding-tool $(top_builddir)/glib/dbus-binding-tool --mode=glib-client --output=test-service-glib-bindings.h test-service-glib.xml CLEANFILES = test-service-glib-glue.h test-service-glib-bindings.h diff --git a/test/glib/test-dbus-glib.c b/test/glib/test-dbus-glib.c index 0c2078e5..b0dc9efc 100644 --- a/test/glib/test-dbus-glib.c +++ b/test/glib/test-dbus-glib.c @@ -267,7 +267,7 @@ main (int argc, char **argv) lose ("ThrowError call unexpectedly succeeded!"); g_print ("ThrowError failed (as expected) returned error: %s\n", error->message); - g_error_free (error); + g_clear_error (&error); v_STRING = "foobar"; call = dbus_g_proxy_begin_call (proxy, "Uppercase", @@ -313,12 +313,13 @@ main (int argc, char **argv) lose ("(wrapped) ThrowError call unexpectedly succeeded!"); g_print ("(wrapped) ThrowError failed (as expected) returned error: %s\n", error->message); - g_error_free (error); + g_clear_error (&error); if (!org_freedesktop_DBus_Tests_MyObject_uppercase (proxy, "foobar", &v_STRING_2, &error)) lose_gerror ("Failed to complete (wrapped) Uppercase call", error); if (strcmp ("FOOBAR", v_STRING_2) != 0) lose ("(wrapped) Uppercase call returned unexpected string %s", v_STRING_2); + g_free (v_STRING_2); if (!org_freedesktop_DBus_Tests_MyObject_many_args (proxy, 26, "bazwhee", G_PI, &v_DOUBLE_2, &v_STRING_2, &error)) @@ -330,6 +331,7 @@ main (int argc, char **argv) if (strcmp ("BAZWHEE", v_STRING_2) != 0) lose ("(wrapped) ManyArgs call returned unexpected string %s", v_STRING_2); + g_free (v_STRING_2); g_object_unref (G_OBJECT (proxy)); -- cgit