From 8854ff4963f264be21f488d7bdeb951e2ac32c74 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 4 Apr 2011 13:46:11 +0100 Subject: [PATCH] dbus-binding-tool: forbid ReturnVal annotation after the first OUT It has never actually worked correctly (invoke_object_method would always treat the ReturnVal as if it had been the first OUT argument), so let's only allow the situation that worked in practice. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=35952 --- dbus/dbus-binding-tool-glib.c | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-) diff --git a/dbus/dbus-binding-tool-glib.c b/dbus/dbus-binding-tool-glib.c index 8f1a0e5..b3c7e90 100644 --- a/dbus/dbus-binding-tool-glib.c +++ b/dbus/dbus-binding-tool-glib.c @@ -566,6 +566,7 @@ generate_glue (BaseInfo *base, DBusBindingToolCData *data, GError **error) gboolean async = FALSE; GSList *args; gboolean found_retval = FALSE; + guint found_out_args = 0; method = (MethodInfo *) tmp->data; method_c_name = g_strdup (method_info_get_annotation (method, DBUS_GLIB_ANNOTATION_C_SYMBOL)); @@ -633,6 +634,7 @@ generate_glue (BaseInfo *base, DBusBindingToolCData *data, GError **error) break; case ARG_OUT: direction = 'O'; + found_out_args++; break; case ARG_INVALID: default: @@ -692,6 +694,19 @@ generate_glue (BaseInfo *base, DBusBindingToolCData *data, GError **error) interface_info_get_name (interface)); return FALSE; } + + if (found_out_args != 1) + { + g_set_error (error, + DBUS_BINDING_TOOL_ERROR, + DBUS_BINDING_TOOL_ERROR_INVALID_ANNOTATION, + "An output after the first cannot have the ReturnVal annotation, in argument \"%s\" of method \"%s\" of interface \"%s\"\n", + arg_info_get_name (arg), + method_info_get_name (method), + interface_info_get_name (interface)); + return FALSE; + } + if (!strcmp ("", returnval_annotation)) g_string_append_c (object_introspection_data_blob, 'R'); else if (!strcmp ("error", returnval_annotation)) -- 1.7.4.1