summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2011-04-04 13:46:11 +0100
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2011-06-01 18:06:09 +0100
commit5a780af947f0141f4e0524aaf62fdd06abe6cd5f (patch)
treed14af7d1d75c29cd0c8a1ac29a3c45efcc8b27ad
parenta8605cf4c6c9dbc4a933dd744d339744e0102765 (diff)
dbus-binding-tool: forbid ReturnVal annotation after the first OUT <arg>
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 Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
-rw-r--r--dbus/dbus-binding-tool-glib.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/dbus/dbus-binding-tool-glib.c b/dbus/dbus-binding-tool-glib.c
index a66c944..c713e62 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 <arg> 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))