dbus/glib dbus-gvalue.c, 1.10, 1.11 dbus-gobject.c, 1.26,
1.27 dbus-binding-tool-glib.c, 1.9, 1.10
Colin Walters
walters at freedesktop.org
Tue Jun 14 08:55:12 PDT 2005
Update of /cvs/dbus/dbus/glib
In directory gabe:/tmp/cvs-serv7216/glib
Modified Files:
dbus-gvalue.c dbus-gobject.c dbus-binding-tool-glib.c
Log Message:
2005-06-14 Colin Walters <walters at verbum.org>
* glib/dbus-binding-tool-glib.c:
* glib/dbus-gobject.c:
* glib/dbus-gvalue.c: Fix indentation and brace style.
Index: dbus-gvalue.c
===================================================================
RCS file: /cvs/dbus/dbus/glib/dbus-gvalue.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- dbus-gvalue.c 13 Jun 2005 15:36:31 -0000 1.10
+++ dbus-gvalue.c 14 Jun 2005 15:55:10 -0000 1.11
@@ -572,11 +572,12 @@
iter = *origiter;
- while ((current_type = dbus_signature_iter_get_current_type (&iter)) != DBUS_TYPE_INVALID) {
- subtype = dbus_gtype_from_signature_iter (&iter, is_client);
- if (subtype == G_TYPE_INVALID)
- return G_TYPE_INVALID;
- }
+ while ((current_type = dbus_signature_iter_get_current_type (&iter)) != DBUS_TYPE_INVALID)
+ {
+ subtype = dbus_gtype_from_signature_iter (&iter, is_client);
+ if (subtype == G_TYPE_INVALID)
+ return G_TYPE_INVALID;
+ }
return DBUS_TYPE_G_VALUE ();
#endif
}
Index: dbus-gobject.c
===================================================================
RCS file: /cvs/dbus/dbus/glib/dbus-gobject.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- dbus-gobject.c 14 Jun 2005 15:49:43 -0000 1.26
+++ dbus-gobject.c 14 Jun 2005 15:55:10 -0000 1.27
@@ -762,11 +762,10 @@
gerror = NULL;
- if (strcmp (string_table_lookup (get_method_data (object_info, method), 2), "A") == 0) {
+ if (strcmp (string_table_lookup (get_method_data (object_info, method), 2), "A") == 0)
call_only = TRUE;
- } else {
+ else
call_only = FALSE;
- }
/* This is evil. We do this to work around the fact that
* the generated glib marshallers check a flag in the closure object
@@ -811,83 +810,87 @@
g_value_set_object (&object_value, object);
g_value_array_prepend (value_array, &object_value);
- if (call_only) {
- GValue context_value = {0,};
- DBusGMethodInvocation *context;
- context = g_new (DBusGMethodInvocation, 1);
- context->connection = dbus_g_connection_ref (DBUS_G_CONNECTION_FROM_CONNECTION (connection));
- context->message = dbus_g_message_ref (DBUS_G_MESSAGE_FROM_MESSAGE (message));
- context->object = object_info;
- context->method = method;
- g_value_init (&context_value, G_TYPE_POINTER);
- g_value_set_pointer (&context_value, context);
- g_value_array_append (value_array, &context_value);
- } else {
- out_signature = method_output_signature_from_object_info (object_info, method);
-
- /* Count number of output parameters */
- dbus_signature_iter_init (&out_signature_iter, out_signature);
- out_param_count = 0;
- while ((current_type = dbus_signature_iter_get_current_type (&out_signature_iter)) != DBUS_TYPE_INVALID)
+ if (call_only)
{
- out_param_count++;
- dbus_signature_iter_next (&out_signature_iter);
+ GValue context_value = {0,};
+ DBusGMethodInvocation *context;
+ context = g_new (DBusGMethodInvocation, 1);
+ context->connection = dbus_g_connection_ref (DBUS_G_CONNECTION_FROM_CONNECTION (connection));
+ context->message = dbus_g_message_ref (DBUS_G_MESSAGE_FROM_MESSAGE (message));
+ context->object = object_info;
+ context->method = method;
+ g_value_init (&context_value, G_TYPE_POINTER);
+ g_value_set_pointer (&context_value, context);
+ g_value_array_append (value_array, &context_value);
}
-
- /* Create an array to store the actual values of OUT
- * parameters. Then, create a GValue boxed POINTER
- * to each of those values, and append to the invocation,
- * so the method can return the OUT parameters.
- */
- out_param_values = g_array_sized_new (FALSE, TRUE, sizeof (GTypeCValue), out_param_count);
-
- /* We have a special array of GValues for toplevel GValue return
- * types.
- */
- out_param_gvalues = g_value_array_new (out_param_count);
- out_param_pos = 0;
- out_param_gvalue_pos = 0;
- dbus_signature_iter_init (&out_signature_iter, out_signature);
- while ((current_type = dbus_signature_iter_get_current_type (&out_signature_iter)) != DBUS_TYPE_INVALID)
+ else
{
- GValue value = {0, };
- GTypeCValue storage;
-
- g_value_init (&value, G_TYPE_POINTER);
+ out_signature = method_output_signature_from_object_info (object_info, method);
- /* We special case variants to make method invocation a bit nicer */
- if (current_type != DBUS_TYPE_VARIANT)
+ /* Count number of output parameters */
+ dbus_signature_iter_init (&out_signature_iter, out_signature);
+ out_param_count = 0;
+ while ((current_type = dbus_signature_iter_get_current_type (&out_signature_iter)) != DBUS_TYPE_INVALID)
{
- memset (&storage, 0, sizeof (storage));
- g_array_append_val (out_param_values, storage);
- g_value_set_pointer (&value, &(g_array_index (out_param_values, GTypeCValue, out_param_pos)));
- out_param_pos++;
+ out_param_count++;
+ dbus_signature_iter_next (&out_signature_iter);
}
- else
+
+ /* Create an array to store the actual values of OUT
+ * parameters. Then, create a GValue boxed POINTER
+ * to each of those values, and append to the invocation,
+ * so the method can return the OUT parameters.
+ */
+ out_param_values = g_array_sized_new (FALSE, TRUE, sizeof (GTypeCValue), out_param_count);
+
+ /* We have a special array of GValues for toplevel GValue return
+ * types.
+ */
+ out_param_gvalues = g_value_array_new (out_param_count);
+ out_param_pos = 0;
+ out_param_gvalue_pos = 0;
+ dbus_signature_iter_init (&out_signature_iter, out_signature);
+ while ((current_type = dbus_signature_iter_get_current_type (&out_signature_iter)) != DBUS_TYPE_INVALID)
{
- g_value_array_append (out_param_gvalues, NULL);
- g_value_set_pointer (&value, out_param_gvalues->values + out_param_gvalue_pos);
- out_param_gvalue_pos++;
+ GValue value = {0, };
+ GTypeCValue storage;
+
+ g_value_init (&value, G_TYPE_POINTER);
+
+ /* We special case variants to make method invocation a bit nicer */
+ if (current_type != DBUS_TYPE_VARIANT)
+ {
+ memset (&storage, 0, sizeof (storage));
+ g_array_append_val (out_param_values, storage);
+ g_value_set_pointer (&value, &(g_array_index (out_param_values, GTypeCValue, out_param_pos)));
+ out_param_pos++;
+ }
+ else
+ {
+ g_value_array_append (out_param_gvalues, NULL);
+ g_value_set_pointer (&value, out_param_gvalues->values + out_param_gvalue_pos);
+ out_param_gvalue_pos++;
+ }
+ g_value_array_append (value_array, &value);
+ dbus_signature_iter_next (&out_signature_iter);
}
- g_value_array_append (value_array, &value);
- dbus_signature_iter_next (&out_signature_iter);
- }
- /* Append GError as final argument */
- g_value_init (&error_value, G_TYPE_POINTER);
- g_value_set_pointer (&error_value, &gerror);
- g_value_array_append (value_array, &error_value);
- }
+ /* Append GError as final argument */
+ g_value_init (&error_value, G_TYPE_POINTER);
+ g_value_set_pointer (&error_value, &gerror);
+ g_value_array_append (value_array, &error_value);
+ }
/* Actually invoke method */
g_value_init (&return_value, G_TYPE_BOOLEAN);
method->marshaller (&closure, &return_value,
value_array->n_values,
value_array->values,
NULL, method->function);
- if (call_only) {
- result = DBUS_HANDLER_RESULT_HANDLED;
- goto done;
- }
+ if (call_only)
+ {
+ result = DBUS_HANDLER_RESULT_HANDLED;
+ goto done;
+ }
had_error = !g_value_get_boolean (&return_value);
if (!had_error)
@@ -943,12 +946,13 @@
done:
g_free (in_signature);
g_free (out_signature);
- if (!call_only) {
- g_array_free (out_param_values, TRUE);
- g_value_array_free (out_param_gvalues);
- g_value_unset (&object_value);
- g_value_unset (&error_value);
- }
+ if (!call_only)
+ {
+ g_array_free (out_param_values, TRUE);
+ g_value_array_free (out_param_gvalues);
+ g_value_unset (&object_value);
+ g_value_unset (&error_value);
+ }
g_value_array_free (value_array);
g_value_unset (&return_value);
return result;
@@ -1175,11 +1179,12 @@
g_signal_query (ids[i], &query);
- if (query.return_type != G_TYPE_NONE) {
- g_warning("Not exporting signal '%s' as it has a return type %s", query.signal_name, g_type_name (query.return_type));
- continue; /* FIXME: these could be listed as methods ? */
- }
-
+ if (query.return_type != G_TYPE_NONE)
+ {
+ g_warning("Not exporting signal '%s' as it has a return type %s", query.signal_name, g_type_name (query.return_type));
+ continue; /* FIXME: these could be listed as methods ? */
+ }
+
closure = dbus_g_signal_closure_new (connection, object, query.signal_name);
g_closure_set_marshal (closure, signal_emitter_marshaller);
@@ -1275,10 +1280,11 @@
if (!dbus_connection_register_object_path (DBUS_CONNECTION_FROM_G_CONNECTION (connection),
at_path,
&gobject_dbus_vtable,
- object)) {
- g_error ("Failed to register GObject with DBusConnection");
- return;
- }
+ object))
+ {
+ g_error ("Failed to register GObject with DBusConnection");
+ return;
+ }
export_signals (connection, object);
@@ -1470,18 +1476,20 @@
dbus_message_iter_init_append (reply, &iter);
va_start (args, context);
- for (i = 0; i < argsig->len; i++) {
- GValue value = {0,};
- char *error;
- g_value_init (&value, g_array_index (argsig, GType, i));
- error = NULL;
- G_VALUE_COLLECT (&value, args, 0, &error);
- if (error) {
- g_warning(error);
- g_free (error);
+ for (i = 0; i < argsig->len; i++)
+ {
+ GValue value = {0,};
+ char *error;
+ g_value_init (&value, g_array_index (argsig, GType, i));
+ error = NULL;
+ G_VALUE_COLLECT (&value, args, 0, &error);
+ if (error)
+ {
+ g_warning(error);
+ g_free (error);
+ }
+ dbus_gvalue_marshal (&iter, &value);
}
- dbus_gvalue_marshal (&iter, &value);
- }
va_end (args);
dbus_connection_send (dbus_g_connection_get_connection (context->connection), reply, NULL);
Index: dbus-binding-tool-glib.c
===================================================================
RCS file: /cvs/dbus/dbus/glib/dbus-binding-tool-glib.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- dbus-binding-tool-glib.c 13 Jun 2005 03:01:24 -0000 1.9
+++ dbus-binding-tool-glib.c 14 Jun 2005 15:55:10 -0000 1.10
@@ -152,32 +152,35 @@
}
}
- if (method_info_get_annotation (method, DBUS_GLIB_ANNOTATION_ASYNC) != NULL) {
- if (!first)
- g_string_append (ret, ",");
- g_string_append (ret, "POINTER");
- first = FALSE;
- } else {
- /* Append pointer for each out arg storage */
- for (elt = method_info_get_args (method); elt; elt = elt->next)
+ if (method_info_get_annotation (method, DBUS_GLIB_ANNOTATION_ASYNC) != NULL)
{
- ArgInfo *arg = elt->data;
-
- if (arg_info_get_direction (arg) == ARG_OUT)
+ if (!first)
+ g_string_append (ret, ",");
+ g_string_append (ret, "POINTER");
+ first = FALSE;
+ }
+ else
+ {
+ /* Append pointer for each out arg storage */
+ for (elt = method_info_get_args (method); elt; elt = elt->next)
{
- if (!first)
- g_string_append (ret, ",");
- else
- first = FALSE;
- g_string_append (ret, "POINTER");
+ ArgInfo *arg = elt->data;
+
+ if (arg_info_get_direction (arg) == ARG_OUT)
+ {
+ if (!first)
+ g_string_append (ret, ",");
+ else
+ first = FALSE;
+ g_string_append (ret, "POINTER");
+ }
}
- }
- /* Final GError parameter */
- if (!first)
- g_string_append (ret, ",");
- g_string_append (ret, "POINTER");
+ /* Final GError parameter */
+ if (!first)
+ g_string_append (ret, ",");
+ g_string_append (ret, "POINTER");
- }
+ }
return g_string_free (ret, FALSE);
@@ -226,22 +229,25 @@
}
}
- if (method_info_get_annotation (method, DBUS_GLIB_ANNOTATION_ASYNC) != NULL) {
- g_string_append (ret, "_POINTER");
- } else {
- /* Append pointer for each out arg storage */
- for (elt = method_info_get_args (method); elt; elt = elt->next)
+ if (method_info_get_annotation (method, DBUS_GLIB_ANNOTATION_ASYNC) != NULL)
{
- ArgInfo *arg = elt->data;
-
- if (arg_info_get_direction (arg) == ARG_OUT)
+ g_string_append (ret, "_POINTER");
+ }
+ else
+ {
+ /* Append pointer for each out arg storage */
+ for (elt = method_info_get_args (method); elt; elt = elt->next)
{
- g_string_append (ret, "_POINTER");
+ ArgInfo *arg = elt->data;
+
+ if (arg_info_get_direction (arg) == ARG_OUT)
+ {
+ g_string_append (ret, "_POINTER");
+ }
}
+ /* Final GError parameter */
+ g_string_append (ret, "_POINTER");
}
- /* Final GError parameter */
- g_string_append (ret, "_POINTER");
- }
return g_string_free (ret, FALSE);
}
More information about the dbus-commit
mailing list