summaryrefslogtreecommitdiffstats
path: root/glib
diff options
context:
space:
mode:
Diffstat (limited to 'glib')
-rw-r--r--glib/Makefile.am5
-rw-r--r--glib/dbus-binding-tool-glib.c36
-rw-r--r--glib/dbus-gmain.c23
-rw-r--r--glib/dbus-gobject.c35
-rw-r--r--glib/dbus-gproxy.c13
-rw-r--r--glib/dbus-gsignature.c189
-rw-r--r--glib/dbus-gsignature.h19
-rw-r--r--glib/dbus-gvalue-utils.c46
-rw-r--r--glib/dbus-gvalue-utils.h28
-rw-r--r--glib/dbus-gvalue.c237
-rw-r--r--glib/dbus-gvalue.h21
11 files changed, 350 insertions, 302 deletions
diff --git a/glib/Makefile.am b/glib/Makefile.am
index 4e3b796c..fd8cba50 100644
--- a/glib/Makefile.am
+++ b/glib/Makefile.am
@@ -15,6 +15,9 @@ DBUS_GLIB_INTERNALS = \
dbus-gtype-specialized.c \
dbus-gutils.c \
dbus-gutils.h \
+ dbus-gsignature.c \
+ dbus-gsignature.h \
+ dbus-gvalue.h \
dbus-gvalue-utils.c \
dbus-gvalue-utils.h
@@ -29,9 +32,9 @@ libdbus_glib_1_la_SOURCES = \
dbus-gproxy.c \
dbus-gtest.c \
dbus-gtest.h \
- dbus-gthread.c \
dbus-gvalue.c \
dbus-gvalue.h \
+ dbus-gthread.c \
$(DBUS_GLIB_INTERNALS)
libdbus_glib_HEADERS = \
diff --git a/glib/dbus-binding-tool-glib.c b/glib/dbus-binding-tool-glib.c
index 39c180fd..7ad62f5a 100644
--- a/glib/dbus-binding-tool-glib.c
+++ b/glib/dbus-binding-tool-glib.c
@@ -23,10 +23,12 @@
*/
#include <config.h>
+#include "dbus/dbus-glib.h"
#include "dbus-gidl.h"
#include "dbus-gparser.h"
#include "dbus-gutils.h"
-#include "dbus-gvalue.h"
+#include "dbus-gtype-specialized.h"
+#include "dbus-gsignature.h"
#include "dbus-gvalue-utils.h"
#include "dbus-glib-tool.h"
#include "dbus-binding-tool-glib.h"
@@ -146,7 +148,7 @@ compute_gsignature (MethodInfo *method, GType *rettype, GArray **params, GError
if (returnval_annotation != NULL)
{
arg_type = arg_info_get_type (arg);
- retval_type = dbus_gtype_from_signature (arg_type, FALSE);
+ retval_type = _dbus_gtype_from_signature (arg_type, FALSE);
if (retval_type == G_TYPE_INVALID)
goto invalid_type;
found_retval = TRUE;
@@ -173,7 +175,7 @@ compute_gsignature (MethodInfo *method, GType *rettype, GArray **params, GError
GType gtype;
arg_type = arg_info_get_type (arg);
- gtype = dbus_gtype_from_signature (arg_type, FALSE);
+ gtype = _dbus_gtype_from_signature (arg_type, FALSE);
if (gtype == G_TYPE_INVALID)
goto invalid_type;
@@ -196,7 +198,7 @@ compute_gsignature (MethodInfo *method, GType *rettype, GArray **params, GError
{
GType gtype;
arg_type = arg_info_get_type (arg);
- gtype = dbus_gtype_from_signature (arg_type, FALSE);
+ gtype = _dbus_gtype_from_signature (arg_type, FALSE);
if (gtype == G_TYPE_INVALID)
goto invalid_type;
/* We actually just need a pointer for the return value
@@ -658,7 +660,7 @@ generate_glue (BaseInfo *base, DBusBindingToolCData *data, GError **error)
g_string_append_c (object_introspection_data_blob, 'R');
else if (!strcmp ("error", returnval_annotation))
{
- gtype = dbus_gtype_from_signature (arg_info_get_type (arg), TRUE);
+ gtype = _dbus_gtype_from_signature (arg_info_get_type (arg), TRUE);
if (!_dbus_gtype_can_signal_error (gtype))
{
g_set_error (error,
@@ -769,7 +771,8 @@ dbus_binding_tool_output_glib_server (BaseInfo *info, GIOChannel *channel, const
memset (&data, 0, sizeof (data));
- dbus_g_value_types_init ();
+ dbus_g_type_specialized_init ();
+ _dbus_g_type_specialized_builtins_init ();
data.prefix = prefix;
data.generated = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify) g_free, NULL);
@@ -917,7 +920,7 @@ write_formal_parameters (InterfaceInfo *iface, MethodInfo *method, GIOChannel *c
direction = arg_info_get_direction (arg);
- gtype = dbus_gtype_from_signature (arg_info_get_type (arg), TRUE);
+ gtype = _dbus_gtype_from_signature (arg_info_get_type (arg), TRUE);
if (gtype == G_TYPE_INVALID)
{
g_set_error (error,
@@ -1056,7 +1059,7 @@ write_args_for_direction (InterfaceInfo *iface, MethodInfo *method, GIOChannel *
if (direction != arg_info_get_direction (arg))
continue;
- gtype = dbus_gtype_from_signature (arg_info_get_type (arg), TRUE);
+ gtype = _dbus_gtype_from_signature (arg_info_get_type (arg), TRUE);
g_assert (gtype != G_TYPE_INVALID);
type_lookup = dbus_g_type_get_lookup_function (gtype);
g_assert (type_lookup != NULL);
@@ -1098,7 +1101,7 @@ check_supported_parameters (MethodInfo *method)
GType gtype;
arg = args->data;
- gtype = dbus_gtype_from_signature (arg_info_get_type (arg), TRUE);
+ gtype = _dbus_gtype_from_signature (arg_info_get_type (arg), TRUE);
if (gtype == G_TYPE_INVALID)
return FALSE;
}
@@ -1144,7 +1147,7 @@ write_formal_declarations_for_direction (InterfaceInfo *iface, MethodInfo *metho
dir = arg_info_get_direction (arg);
- gtype = dbus_gtype_from_signature (arg_info_get_type (arg), TRUE);
+ gtype = _dbus_gtype_from_signature (arg_info_get_type (arg), TRUE);
type_str = dbus_g_type_get_c_name (gtype);
if (!type_str)
@@ -1220,7 +1223,7 @@ write_formal_parameters_for_direction (InterfaceInfo *iface, MethodInfo *method,
WRITE_OR_LOSE (", ");
- gtype = dbus_gtype_from_signature (arg_info_get_type (arg), TRUE);
+ gtype = _dbus_gtype_from_signature (arg_info_get_type (arg), TRUE);
type_str = dbus_g_type_get_c_name (gtype);
/* Variants are special...*/
if (gtype == G_TYPE_VALUE)
@@ -1293,7 +1296,7 @@ write_typed_args_for_direction (InterfaceInfo *iface, MethodInfo *method, GIOCha
if (dir != direction)
continue;
- gtype = dbus_gtype_from_signature (arg_info_get_type (arg), TRUE);
+ gtype = _dbus_gtype_from_signature (arg_info_get_type (arg), TRUE);
type_lookup = dbus_g_type_get_lookup_function (gtype);
if (!write_printf_to_iochannel ("%s, &%s_%s, ", channel, error, type_lookup, direction == ARG_IN ? "IN" : "OUT", arg_info_get_name (arg)))
@@ -1326,14 +1329,14 @@ write_async_method_client (GIOChannel *channel, InterfaceInfo *interface, Method
if (arg_info_get_direction (arg) != ARG_OUT)
continue;
- gtype = dbus_gtype_from_signature (arg_info_get_type (arg), TRUE);
+ gtype = _dbus_gtype_from_signature (arg_info_get_type (arg), TRUE);
if (gtype != G_TYPE_VALUE && (g_type_is_a (gtype, G_TYPE_BOXED)
|| g_type_is_a (gtype, G_TYPE_OBJECT)
|| g_type_is_a (gtype, G_TYPE_POINTER)))
type_suffix = "*";
else
type_suffix = "";
- type_str = dbus_g_type_get_c_name (dbus_gtype_from_signature (arg_info_get_type (arg), TRUE));
+ type_str = dbus_g_type_get_c_name (_dbus_gtype_from_signature (arg_info_get_type (arg), TRUE));
if (!write_printf_to_iochannel ("%s %sOUT_%s, ", channel, error, type_str, type_suffix, arg_info_get_name (arg)))
goto io_lose;
}
@@ -1508,13 +1511,14 @@ dbus_binding_tool_output_glib_client (BaseInfo *info, GIOChannel *channel, gbool
DBusBindingToolCData data;
gboolean ret;
- dbus_g_value_types_init ();
-
memset (&data, 0, sizeof (data));
data.channel = channel;
data.ignore_unsupported = ignore_unsupported;
+ dbus_g_type_specialized_init ();
+ _dbus_g_type_specialized_builtins_init ();
+
WRITE_OR_LOSE ("/* Generated by dbus-binding-tool; do not edit! */\n\n");
WRITE_OR_LOSE ("#include <glib/gtypes.h>\n");
WRITE_OR_LOSE ("#include <glib/gerror.h>\n");
diff --git a/glib/dbus-gmain.c b/glib/dbus-gmain.c
index 85d7bca1..4904588e 100644
--- a/glib/dbus-gmain.c
+++ b/glib/dbus-gmain.c
@@ -30,6 +30,7 @@
#include "dbus-gvalue.h"
#include "dbus-gobject.h"
#include "dbus-gvalue-utils.h"
+#include "dbus-gsignature.h"
#include <string.h>
#include <libintl.h>
@@ -714,7 +715,7 @@ dbus_g_bus_get (DBusBusType type,
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
- dbus_g_value_types_init ();
+ _dbus_g_value_types_init ();
dbus_error_init (&derror);
@@ -744,30 +745,30 @@ dbus_g_bus_get (DBusBusType type,
gboolean
_dbus_gmain_test (const char *test_data_dir)
{
+ GType type;
GType rectype;
- GType gtype;
g_type_init ();
- dbus_g_value_types_init ();
+ _dbus_g_value_types_init ();
rectype = dbus_g_type_get_collection ("GArray", G_TYPE_UINT);
g_assert (rectype != G_TYPE_INVALID);
g_assert (!strcmp (g_type_name (rectype), "GArray+guint"));
- gtype = dbus_gtype_from_signature ("au", TRUE);
- g_assert (gtype == rectype);
+ type = _dbus_gtype_from_signature ("au", TRUE);
+ g_assert (type == rectype);
rectype = dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_STRING);
g_assert (rectype != G_TYPE_INVALID);
g_assert (!strcmp (g_type_name (rectype), "GHashTable+gchararray+gchararray"));
- gtype = dbus_gtype_from_signature ("a{ss}", TRUE);
- g_assert (gtype == rectype);
+ type = _dbus_gtype_from_signature ("a{ss}", TRUE);
+ g_assert (type == rectype);
- gtype = dbus_gtype_from_signature ("o", FALSE);
- g_assert (gtype == DBUS_TYPE_G_OBJECT_PATH);
- gtype = dbus_gtype_from_signature ("o", TRUE);
- g_assert (gtype == DBUS_TYPE_G_OBJECT_PATH);
+ type = _dbus_gtype_from_signature ("o", FALSE);
+ g_assert (type == DBUS_TYPE_G_OBJECT_PATH);
+ type = _dbus_gtype_from_signature ("o", TRUE);
+ g_assert (type == DBUS_TYPE_G_OBJECT_PATH);
return TRUE;
}
diff --git a/glib/dbus-gobject.c b/glib/dbus-gobject.c
index 56042520..e124f934 100644
--- a/glib/dbus-gobject.c
+++ b/glib/dbus-gobject.c
@@ -29,6 +29,7 @@
#include "dbus-gtest.h"
#include "dbus-gutils.h"
#include "dbus-gobject.h"
+#include "dbus-gsignature.h"
#include "dbus-gvalue.h"
#include "dbus-gmarshal.h"
#include "dbus-gvalue-utils.h"
@@ -421,7 +422,7 @@ write_interface (gpointer key, gpointer val, gpointer user_data)
for (arg = 0; arg < query.n_params; arg++)
{
- char *dbus_type = dbus_gtype_to_signature (query.param_types[arg]);
+ char *dbus_type = _dbus_gtype_to_signature (query.param_types[arg]);
g_assert (dbus_type != NULL);
@@ -453,7 +454,7 @@ write_interface (gpointer key, gpointer val, gpointer user_data)
g_assert (spec != NULL);
g_free (s);
- dbus_type = dbus_gtype_to_signature (G_PARAM_SPEC_VALUE_TYPE (spec));
+ dbus_type = _dbus_gtype_to_signature (G_PARAM_SPEC_VALUE_TYPE (spec));
g_assert (dbus_type != NULL);
can_set = ((spec->flags & G_PARAM_WRITABLE) != 0 &&
@@ -658,7 +659,7 @@ set_object_property (DBusConnection *connection,
context.proxy = NULL;
g_value_init (&value, pspec->value_type);
- if (dbus_gvalue_demarshal (&context, &sub, &value, NULL))
+ if (_dbus_gvalue_demarshal (&context, &sub, &value, NULL))
{
g_object_set_property (object,
pspec->name,
@@ -706,7 +707,7 @@ get_object_property (DBusConnection *connection,
dbus_message_iter_init_append (message, &iter);
- if (!dbus_gvalue_marshal (&iter, &value))
+ if (!_dbus_gvalue_marshal (&iter, &value))
{
dbus_message_unref (ret);
ret = dbus_message_new_error (message,
@@ -937,11 +938,11 @@ invoke_object_method (GObject *object,
context.gconnection = DBUS_G_CONNECTION_FROM_CONNECTION (connection);
context.proxy = NULL;
- types_array = dbus_gtypes_from_arg_signature (in_signature, FALSE);
+ types_array = _dbus_gtypes_from_arg_signature (in_signature, FALSE);
n_params = types_array->len;
types = (const GType*) types_array->data;
- value_array = dbus_gvalue_demarshal_message (&context, message, n_params, types, &error);
+ value_array = _dbus_gvalue_demarshal_message (&context, message, n_params, types, &error);
if (value_array == NULL)
{
g_free (in_signature);
@@ -1014,7 +1015,7 @@ invoke_object_method (GObject *object,
/* Initialize our return GValue with the specified type */
dbus_signature_iter_init (&tmp_sigiter, argsig);
- g_value_init (&return_value, dbus_gtype_from_signature_iter (&tmp_sigiter, FALSE));
+ g_value_init (&return_value, _dbus_gtype_from_signature_iter (&tmp_sigiter, FALSE));
}
else
{
@@ -1070,7 +1071,7 @@ invoke_object_method (GObject *object,
continue;
dbus_signature_iter_init (&tmp_sigiter, argsig);
- current_gtype = dbus_gtype_from_signature_iter (&tmp_sigiter, FALSE);
+ current_gtype = _dbus_gtype_from_signature_iter (&tmp_sigiter, FALSE);
g_value_init (&value, G_TYPE_POINTER);
@@ -1130,7 +1131,7 @@ invoke_object_method (GObject *object,
/* First, append the return value, unless it's synthetic */
if (have_retval && !retval_is_synthetic)
{
- if (!dbus_gvalue_marshal (&iter, &return_value))
+ if (!_dbus_gvalue_marshal (&iter, &return_value))
goto nomem;
if (!retval_is_constant)
g_value_unset (&return_value);
@@ -1168,10 +1169,10 @@ invoke_object_method (GObject *object,
dbus_signature_iter_init (&argsigiter, arg_signature);
- g_value_init (&gvalue, dbus_gtype_from_signature_iter (&argsigiter, FALSE));
+ g_value_init (&gvalue, _dbus_gtype_from_signature_iter (&argsigiter, FALSE));
if (G_VALUE_TYPE (&gvalue) != G_TYPE_VALUE)
{
- if (!dbus_gvalue_take (&gvalue,
+ if (!_dbus_gvalue_take (&gvalue,
&(g_array_index (out_param_values, GTypeCValue, out_param_pos))))
g_assert_not_reached ();
out_param_pos++;
@@ -1182,10 +1183,10 @@ invoke_object_method (GObject *object,
out_param_gvalue_pos++;
}
- if (!dbus_gvalue_marshal (&iter, &gvalue))
+ if (!_dbus_gvalue_marshal (&iter, &gvalue))
goto nomem;
/* Here we actually free the allocated value; we
- * took ownership of it with dbus_gvalue_take, unless
+ * took ownership of it with _dbus_gvalue_take, unless
* an annotation has specified this value as constant.
*/
if (!constval)
@@ -1404,7 +1405,7 @@ signal_emitter_marshaller (GClosure *closure,
/* First argument is the object itself, and we can't marshall that */
for (i = 1; i < n_param_values; i++)
{
- if (!dbus_gvalue_marshal (&iter,
+ if (!_dbus_gvalue_marshal (&iter,
(GValue *) (&(param_values[i]))))
{
g_warning ("failed to marshal parameter %d for signal %s",
@@ -1536,7 +1537,7 @@ dbus_g_object_type_install_info (GType object_type,
{
g_return_if_fail (G_TYPE_IS_CLASSED (object_type));
- dbus_g_value_types_init ();
+ _dbus_g_value_types_init ();
g_type_set_qdata (object_type,
dbus_g_object_type_dbus_metadata_quark (),
@@ -1874,7 +1875,7 @@ dbus_g_method_return (DBusGMethodInvocation *context, ...)
reply = dbus_message_new_method_return (dbus_g_message_get_message (context->message));
out_sig = method_output_signature_from_object_info (context->object, context->method);
- argsig = dbus_gtypes_from_arg_signature (out_sig, FALSE);
+ argsig = _dbus_gtypes_from_arg_signature (out_sig, FALSE);
dbus_message_iter_init_append (reply, &iter);
@@ -1891,7 +1892,7 @@ dbus_g_method_return (DBusGMethodInvocation *context, ...)
g_warning(error);
g_free (error);
}
- dbus_gvalue_marshal (&iter, &value);
+ _dbus_gvalue_marshal (&iter, &value);
}
va_end (args);
diff --git a/glib/dbus-gproxy.c b/glib/dbus-gproxy.c
index 9fd46020..ca1b5544 100644
--- a/glib/dbus-gproxy.c
+++ b/glib/dbus-gproxy.c
@@ -25,6 +25,7 @@
#include <dbus/dbus-glib-lowlevel.h>
#include <dbus/dbus-signature.h>
#include "dbus-gutils.h"
+#include "dbus-gsignature.h"
#include "dbus-gvalue.h"
#include "dbus-gvalue-utils.h"
#include "dbus-gobject.h"
@@ -1551,7 +1552,7 @@ marshal_dbus_message_to_g_marshaller (GClosure *closure,
context.proxy = proxy;
types = (const GType*) gsignature->data;
- value_array = dbus_gvalue_demarshal_message (&context, message,
+ value_array = _dbus_gvalue_demarshal_message (&context, message,
gsignature->len, types, NULL);
}
@@ -1603,7 +1604,7 @@ dbus_g_proxy_emit_remote_signal (DBusGProxy *proxy,
if (gsignature == NULL)
goto out;
- msg_gsignature = dbus_gtypes_from_arg_signature (dbus_message_get_signature (message),
+ msg_gsignature = _dbus_gtypes_from_arg_signature (dbus_message_get_signature (message),
TRUE);
for (i = 0; i < gsignature->len; i++)
{
@@ -2019,7 +2020,7 @@ dbus_g_proxy_marshal_args_to_message (DBusGProxy *proxy,
gvalue = g_value_array_get_nth (args, i);
- if (!dbus_gvalue_marshal (&msgiter, gvalue))
+ if (!_dbus_gvalue_marshal (&msgiter, gvalue))
g_assert_not_reached ();
}
return message;
@@ -2143,7 +2144,7 @@ dbus_g_proxy_end_call_internal (DBusGProxy *proxy,
if (arg_type == DBUS_TYPE_VARIANT
&& g_type_is_a (valtype, G_TYPE_VALUE))
{
- if (!dbus_gvalue_demarshal_variant (&context, &msgiter, (GValue*) return_storage, NULL))
+ if (!_dbus_gvalue_demarshal_variant (&context, &msgiter, (GValue*) return_storage, NULL))
{
g_set_error (error,
DBUS_GERROR,
@@ -2157,11 +2158,11 @@ dbus_g_proxy_end_call_internal (DBusGProxy *proxy,
{
g_value_init (&gvalue, valtype);
- if (!dbus_gvalue_demarshal (&context, &msgiter, &gvalue, error))
+ if (!_dbus_gvalue_demarshal (&context, &msgiter, &gvalue, error))
goto out;
/* Anything that can be demarshaled must be storable */
- if (!dbus_gvalue_store (&gvalue, (gpointer*) return_storage))
+ if (!_dbus_gvalue_store (&gvalue, (gpointer*) return_storage))
g_assert_not_reached ();
/* Ownership of the value passes to the client, don't unset */
}
diff --git a/glib/dbus-gsignature.c b/glib/dbus-gsignature.c
new file mode 100644
index 00000000..a0370b0e
--- /dev/null
+++ b/glib/dbus-gsignature.c
@@ -0,0 +1,189 @@
+/* -*- mode: C; c-file-style: "gnu" -*- */
+/* dbus-gsignature.c Mapping from dbus type signatures to GType
+ *
+ * Copyright (C) 2005 Red Hat, Inc.
+ *
+ * Licensed under the Academic Free License version 2.1
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include "config.h"
+#include "dbus-gtest.h"
+#include "dbus-gsignature.h"
+#include "dbus-gvalue-utils.h"
+#include <string.h>
+#include <glib.h>
+
+#define MAP_BASIC(d_t, g_t) \
+ case DBUS_TYPE_##d_t: \
+ return G_TYPE_##g_t;
+static GType
+typecode_to_gtype (int type)
+{
+ switch (type)
+ {
+ MAP_BASIC (BOOLEAN, BOOLEAN);
+ MAP_BASIC (BYTE, UCHAR);
+ MAP_BASIC (INT16, INT);
+ MAP_BASIC (INT32, INT);
+ MAP_BASIC (UINT16, UINT);
+ MAP_BASIC (UINT32, UINT);
+ MAP_BASIC (INT64, INT64);
+ MAP_BASIC (UINT64, UINT64);
+ MAP_BASIC (DOUBLE, DOUBLE);
+ MAP_BASIC (STRING, STRING);
+ default:
+ return G_TYPE_INVALID;
+ }
+}
+#undef MAP_BASIC
+
+static gboolean
+dbus_typecode_maps_to_basic (int typecode)
+{
+ return typecode_to_gtype (typecode) != G_TYPE_INVALID;
+}
+
+GType
+_dbus_gtype_from_basic_typecode (int typecode)
+{
+ g_assert (dbus_type_is_basic (typecode));
+ g_assert (dbus_typecode_maps_to_basic (typecode));
+ return typecode_to_gtype (typecode);
+}
+
+static GType
+signature_iter_to_g_type_dict (const DBusSignatureIter *subiter, gboolean is_client)
+{
+ DBusSignatureIter iter;
+ GType key_gtype;
+ GType value_gtype;
+
+ g_assert (dbus_signature_iter_get_current_type (subiter) == DBUS_TYPE_DICT_ENTRY);
+
+ dbus_signature_iter_recurse (subiter, &iter);
+
+ key_gtype = _dbus_gtype_from_signature_iter (&iter, is_client);
+ if (key_gtype == G_TYPE_INVALID)
+ return G_TYPE_INVALID;
+
+ dbus_signature_iter_next (&iter);
+ value_gtype = _dbus_gtype_from_signature_iter (&iter, is_client);
+ if (value_gtype == G_TYPE_INVALID)
+ return G_TYPE_INVALID;
+
+ if (!_dbus_gtype_is_valid_hash_key (key_gtype)
+ || !_dbus_gtype_is_valid_hash_value (value_gtype))
+ /* Later we need to return DBUS_TYPE_G_VALUE */
+ return G_TYPE_INVALID;
+
+ return dbus_g_type_get_map ("GHashTable", key_gtype, value_gtype);
+}
+
+static GType
+signature_iter_to_g_type_array (DBusSignatureIter *iter, gboolean is_client)
+{
+ GType elt_gtype;
+
+ elt_gtype = _dbus_gtype_from_signature_iter (iter, is_client);
+ if (elt_gtype == G_TYPE_INVALID)
+ return G_TYPE_INVALID;
+
+ if (elt_gtype == G_TYPE_OBJECT)
+ return DBUS_TYPE_G_OBJECT_ARRAY;
+ if (elt_gtype == G_TYPE_STRING)
+ return G_TYPE_STRV;
+ if (_dbus_g_type_is_fixed (elt_gtype))
+ return dbus_g_type_get_collection ("GArray", elt_gtype);
+ else if (g_type_is_a (elt_gtype, G_TYPE_OBJECT)
+ || g_type_is_a (elt_gtype, G_TYPE_BOXED))
+ return dbus_g_type_get_collection ("GPtrArray", elt_gtype);
+
+ /* Later we need to return DBUS_TYPE_G_VALUE */
+ return G_TYPE_INVALID;
+}
+
+GType
+_dbus_gtype_from_signature_iter (DBusSignatureIter *iter, gboolean is_client)
+{
+ int current_type;
+
+ current_type = dbus_signature_iter_get_current_type (iter);
+ /* TODO: handle type 0? */
+ if (dbus_typecode_maps_to_basic (current_type))
+ return _dbus_gtype_from_basic_typecode (current_type);
+ else if (current_type == DBUS_TYPE_OBJECT_PATH)
+ return DBUS_TYPE_G_OBJECT_PATH;
+ else
+ {
+ DBusSignatureIter subiter;
+
+ g_assert (dbus_type_is_container (current_type));
+
+ if (current_type == DBUS_TYPE_VARIANT)
+ return G_TYPE_VALUE;
+ if (current_type == DBUS_TYPE_STRUCT)
+ return G_TYPE_VALUE_ARRAY;
+
+ dbus_signature_iter_recurse (iter, &subiter);
+
+ if (current_type == DBUS_TYPE_ARRAY)
+ {
+ int elt_type = dbus_signature_iter_get_current_type (&subiter);
+ if (elt_type == DBUS_TYPE_DICT_ENTRY)
+ return signature_iter_to_g_type_dict (&subiter, is_client);
+ else
+ return signature_iter_to_g_type_array (&subiter, is_client);
+ }
+ else
+ {
+ g_assert_not_reached ();
+ return G_TYPE_INVALID;
+ }
+ }
+}
+
+GType
+_dbus_gtype_from_signature (const char *signature, gboolean is_client)
+{
+ DBusSignatureIter iter;
+
+ dbus_signature_iter_init (&iter, signature);
+
+ return _dbus_gtype_from_signature_iter (&iter, is_client);
+}
+
+GArray *
+_dbus_gtypes_from_arg_signature (const char *argsig, gboolean is_client)
+{
+ GArray *ret;
+ int current_type;
+ DBusSignatureIter sigiter;
+
+ ret = g_array_new (FALSE, FALSE, sizeof (GType));
+
+ dbus_signature_iter_init (&sigiter, argsig);
+ while ((current_type = dbus_signature_iter_get_current_type (&sigiter)) != DBUS_TYPE_INVALID)
+ {
+ GType curtype;
+
+ curtype = _dbus_gtype_from_signature_iter (&sigiter, is_client);
+ g_array_append_val (ret, curtype);
+ dbus_signature_iter_next (&sigiter);
+ }
+ return ret;
+}
diff --git a/glib/dbus-gsignature.h b/glib/dbus-gsignature.h
new file mode 100644
index 00000000..08757e11
--- /dev/null
+++ b/glib/dbus-gsignature.h
@@ -0,0 +1,19 @@
+#ifndef DBUS_GOBJECT_SIGNATURE_H
+#define DBUS_GOBJECT_SIGNATURE_H
+
+#include <dbus/dbus.h>
+#include <dbus/dbus-signature.h>
+#include <glib.h>
+
+GType _dbus_gtype_from_basic_typecode (int typecode);
+
+GType _dbus_gtype_from_signature (const char *signature,
+ gboolean is_client);
+
+GType _dbus_gtype_from_signature_iter (DBusSignatureIter *sigiter,
+ gboolean is_client);
+
+GArray * _dbus_gtypes_from_arg_signature (const char *signature,
+ gboolean is_client);
+
+#endif
diff --git a/glib/dbus-gvalue-utils.c b/glib/dbus-gvalue-utils.c
index 04afaee2..c7b0d580 100644
--- a/glib/dbus-gvalue-utils.c
+++ b/glib/dbus-gvalue-utils.c
@@ -59,20 +59,20 @@ fixed_type_get_size (GType type)
}
gboolean
-dbus_g_type_is_fixed (GType type)
+_dbus_g_type_is_fixed (GType type)
{
return fixed_type_get_size (type) > 0;
}
guint
-dbus_g_type_fixed_get_size (GType type)
+_dbus_g_type_fixed_get_size (GType type)
{
- g_assert (dbus_g_type_is_fixed (type));
+ g_assert (_dbus_g_type_is_fixed (type));
return fixed_type_get_size (type);
}
gboolean
-dbus_gvalue_store (GValue *value,
+_dbus_gvalue_store (GValue *value,
gpointer storage)
{
/* FIXME - can we use the GValue lcopy_value method
@@ -128,7 +128,7 @@ dbus_gvalue_store (GValue *value,
}
gboolean
-dbus_gvalue_set_from_pointer (GValue *value,
+_dbus_gvalue_set_from_pointer (GValue *value,
gconstpointer storage)
{
/* FIXME - is there a better way to do this? */
@@ -182,7 +182,7 @@ dbus_gvalue_set_from_pointer (GValue *value,
}
gboolean
-dbus_gvalue_take (GValue *value,
+_dbus_gvalue_take (GValue *value,
GTypeCValue *cvalue)
{
GType g_type;
@@ -313,21 +313,21 @@ hash_free_from_gtype (GType gtype, GDestroyNotify *func)
}
gboolean
-dbus_gtype_is_valid_hash_key (GType type)
+_dbus_gtype_is_valid_hash_key (GType type)
{
GHashFunc func;
return hash_func_from_gtype (type, &func);
}
gboolean
-dbus_gtype_is_valid_hash_value (GType type)
+_dbus_gtype_is_valid_hash_value (GType type)
{
GDestroyNotify func;
return hash_free_from_gtype (type, &func);
}
GHashFunc
-dbus_g_hash_func_from_gtype (GType gtype)
+_dbus_g_hash_func_from_gtype (GType gtype)
{
GHashFunc func;
gboolean ret;
@@ -337,9 +337,9 @@ dbus_g_hash_func_from_gtype (GType gtype)
}
GEqualFunc
-dbus_g_hash_equal_from_gtype (GType gtype)
+_dbus_g_hash_equal_from_gtype (GType gtype)
{
- g_assert (dbus_gtype_is_valid_hash_key (gtype));
+ g_assert (_dbus_gtype_is_valid_hash_key (gtype));
switch (gtype)
{
@@ -358,7 +358,7 @@ dbus_g_hash_equal_from_gtype (GType gtype)
}
GDestroyNotify
-dbus_g_hash_free_from_gtype (GType gtype)
+_dbus_g_hash_free_from_gtype (GType gtype)
{
GDestroyNotify func;
gboolean ret;
@@ -490,7 +490,7 @@ hashtable_iterator (GType hash_type,
}
void
-dbus_g_hash_table_insert_steal_values (GHashTable *table,
+_dbus_g_hash_table_insert_steal_values (GHashTable *table,
GValue *key_val,
GValue *value_val)
{
@@ -510,7 +510,7 @@ hashtable_append (DBusGTypeSpecializedAppendContext *ctx,
GHashTable *table;
table = g_value_get_boxed (ctx->val);
- dbus_g_hash_table_insert_steal_values (table, key, val);
+ _dbus_g_hash_table_insert_steal_values (table, key, val);
}
static gpointer
@@ -523,10 +523,10 @@ hashtable_constructor (GType type)
key_gtype = dbus_g_type_get_map_key_specialization (type);
value_gtype = dbus_g_type_get_map_value_specialization (type);
- ret = g_hash_table_new_full (dbus_g_hash_func_from_gtype (key_gtype),
- dbus_g_hash_equal_from_gtype (key_gtype),
- dbus_g_hash_free_from_gtype (key_gtype),
- dbus_g_hash_free_from_gtype (value_gtype));
+ ret = g_hash_table_new_full (_dbus_g_hash_func_from_gtype (key_gtype),
+ _dbus_g_hash_equal_from_gtype (key_gtype),
+ _dbus_g_hash_free_from_gtype (key_gtype),
+ _dbus_g_hash_free_from_gtype (value_gtype));
return ret;
}
@@ -543,7 +543,7 @@ hashtable_insert_values (GHashTable *table,
g_value_init (&value_copy, G_VALUE_TYPE (value_val));
g_value_copy (value_val, &value_copy);
- dbus_g_hash_table_insert_steal_values (table, &key_copy, &value_copy);
+ _dbus_g_hash_table_insert_steal_values (table, &key_copy, &value_copy);
}
static void
@@ -587,7 +587,7 @@ array_constructor (GType type)
elt_type = dbus_g_type_get_collection_specialization (type);
g_assert (elt_type != G_TYPE_INVALID);
- elt_size = dbus_g_type_fixed_get_size (elt_type);
+ elt_size = _dbus_g_type_fixed_get_size (elt_type);
/* These are "safe" defaults */
zero_terminated = TRUE; /* ((struct _DBusGRealArray*) garray)->zero_terminated; */
@@ -626,7 +626,7 @@ array_fixed_accessor (GType type, gpointer instance, gpointer *values, guint *le
GArray *array = instance;
elt_type = dbus_g_type_get_collection_specialization (type);
- if (!dbus_g_type_is_fixed (elt_type))
+ if (!_dbus_g_type_is_fixed (elt_type))
return FALSE;
*values = array->data;
@@ -841,7 +841,7 @@ slist_free (GType type, gpointer val)
}
void
-dbus_g_type_specialized_builtins_init (void)
+_dbus_g_type_specialized_builtins_init (void)
{
static const DBusGTypeSpecializedCollectionVtable array_vtable = {
{
@@ -967,7 +967,7 @@ _dbus_gvalue_utils_test (const char *datadir)
GType type;
dbus_g_type_specialized_init ();
- dbus_g_type_specialized_builtins_init ();
+ _dbus_g_type_specialized_builtins_init ();
type = dbus_g_type_get_collection ("GArray", G_TYPE_UINT);
g_assert (dbus_g_type_is_collection (type));
diff --git a/glib/dbus-gvalue-utils.h b/glib/dbus-gvalue-utils.h
index 4f81081e..139f4a31 100644
--- a/glib/dbus-gvalue-utils.h
+++ b/glib/dbus-gvalue-utils.h
@@ -29,39 +29,39 @@
G_BEGIN_DECLS
-void dbus_g_type_specialized_builtins_init (void);
+void _dbus_g_type_specialized_builtins_init (void);
-gboolean dbus_g_type_is_fixed (GType gtype);
-guint dbus_g_type_fixed_get_size (GType gtype);
+gboolean _dbus_g_type_is_fixed (GType gtype);
+guint _dbus_g_type_fixed_get_size (GType gtype);
-gboolean dbus_gvalue_set_from_pointer (GValue *value,
+gboolean _dbus_gvalue_set_from_pointer (GValue *value,
gconstpointer storage);
typedef void (*DBusGHashValueForeachFunc) (GValue * key, GValue *val, gpointer data);
-void dbus_g_hash_table_value_foreach (GHashTable *table,
+void _dbus_g_hash_table_value_foreach (GHashTable *table,
GType hash_type,
DBusGHashValueForeachFunc func,
gpointer data);
-void dbus_g_hash_table_insert_values (GHashTable *table,
+void _dbus_g_hash_table_insert_values (GHashTable *table,
GValue *key_val,
GValue *value_val);
-void dbus_g_hash_table_insert_steal_values (GHashTable *table,
+void _dbus_g_hash_table_insert_steal_values (GHashTable *table,
GValue *key_val,
GValue *value_val);
-gboolean dbus_gtype_is_valid_hash_key (GType type);
-gboolean dbus_gtype_is_valid_hash_value (GType type);
+gboolean _dbus_gtype_is_valid_hash_key (GType type);
+gboolean _dbus_gtype_is_valid_hash_value (GType type);
-GHashFunc dbus_g_hash_func_from_gtype (GType gtype);
-GEqualFunc dbus_g_hash_equal_from_gtype (GType gtype);
-GDestroyNotify dbus_g_hash_free_from_gtype (GType gtype);
+GHashFunc _dbus_g_hash_func_from_gtype (GType gtype);
+GEqualFunc _dbus_g_hash_equal_from_gtype (GType gtype);
+GDestroyNotify _dbus_g_hash_free_from_gtype (GType gtype);
-gboolean dbus_gvalue_store (GValue *value,
+gboolean _dbus_gvalue_store (GValue *value,
gpointer storage);
-gboolean dbus_gvalue_take (GValue *value,
+gboolean _dbus_gvalue_take (GValue *value,
GTypeCValue *cvalue);
gboolean _dbus_gtype_can_signal_error (GType gtype);
diff --git a/glib/dbus-gvalue.c b/glib/dbus-gvalue.c
index 282b3747..ebde24b0 100644
--- a/glib/dbus-gvalue.c
+++ b/glib/dbus-gvalue.c
@@ -25,6 +25,7 @@
#include "config.h"
#include "dbus-gtest.h"
#include "dbus-gvalue.h"
+#include "dbus-gsignature.h"
#include "dbus-gobject.h"
#include "dbus-gvalue-utils.h"
#include "dbus/dbus-glib.h"
@@ -140,52 +141,14 @@ set_type_metadata (GType type, const DBusGTypeMarshalData *data)
g_type_set_qdata (type, dbus_g_type_metadata_data_quark (), (gpointer) data);
}
-#define MAP_BASIC(d_t, g_t) \
- case DBUS_TYPE_##d_t: \
- return G_TYPE_##g_t;
-static GType
-typecode_to_gtype (int type)
-{
- switch (type)
- {
- MAP_BASIC (BOOLEAN, BOOLEAN);
- MAP_BASIC (BYTE, UCHAR);
- MAP_BASIC (INT16, INT);
- MAP_BASIC (INT32, INT);
- MAP_BASIC (UINT16, UINT);
- MAP_BASIC (UINT32, UINT);
- MAP_BASIC (INT64, INT64);
- MAP_BASIC (UINT64, UINT64);
- MAP_BASIC (DOUBLE, DOUBLE);
- MAP_BASIC (STRING, STRING);
- default:
- return G_TYPE_INVALID;
- }
-}
-#undef MAP_BASIC
-
-static gboolean
-dbus_typecode_maps_to_basic (int typecode)
-{
- return typecode_to_gtype (typecode) != G_TYPE_INVALID;
-}
-
-static GType
-basic_typecode_to_gtype (int typecode)
-{
- g_assert (dbus_type_is_basic (typecode));
- g_assert (dbus_typecode_maps_to_basic (typecode));
- return typecode_to_gtype (typecode);
-}
-
static void
register_basic (int typecode, const DBusGTypeMarshalData *typedata)
{
- set_type_metadata (basic_typecode_to_gtype (typecode), typedata);
+ set_type_metadata (_dbus_gtype_from_basic_typecode (typecode), typedata);
}
void
-dbus_g_value_types_init (void)
+_dbus_g_value_types_init (void)
{
static gboolean types_initialized;
@@ -198,8 +161,7 @@ dbus_g_value_types_init (void)
return;
dbus_g_type_specialized_init ();
- dbus_g_type_specialized_builtins_init ();
-
+ _dbus_g_type_specialized_builtins_init ();
/* Register basic types */
{
@@ -384,109 +346,8 @@ dbus_g_object_path_get_g_type (void)
return type_id;
}
-static GType
-signature_iter_to_g_type_dict (const DBusSignatureIter *subiter, gboolean is_client)
-{
- DBusSignatureIter iter;
- GType key_gtype;
- GType value_gtype;
-
- g_assert (dbus_signature_iter_get_current_type (subiter) == DBUS_TYPE_DICT_ENTRY);
-
- dbus_signature_iter_recurse (subiter, &iter);
-
- key_gtype = dbus_gtype_from_signature_iter (&iter, is_client);
- if (key_gtype == G_TYPE_INVALID)
- return G_TYPE_INVALID;
-
- dbus_signature_iter_next (&iter);
- value_gtype = dbus_gtype_from_signature_iter (&iter, is_client);
- if (value_gtype == G_TYPE_INVALID)
- return G_TYPE_INVALID;
-
- if (!dbus_gtype_is_valid_hash_key (key_gtype)
- || !dbus_gtype_is_valid_hash_value (value_gtype))
- /* Later we need to return DBUS_TYPE_G_VALUE */
- return G_TYPE_INVALID;
-
- return dbus_g_type_get_map ("GHashTable", key_gtype, value_gtype);
-}
-
-static GType
-signature_iter_to_g_type_array (DBusSignatureIter *iter, gboolean is_client)
-{
- GType elt_gtype;
-
- elt_gtype = dbus_gtype_from_signature_iter (iter, is_client);
- if (elt_gtype == G_TYPE_INVALID)
- return G_TYPE_INVALID;
-
- if (elt_gtype == G_TYPE_OBJECT)
- return DBUS_TYPE_G_OBJECT_ARRAY;
- if (elt_gtype == G_TYPE_STRING)
- return G_TYPE_STRV;
- if (dbus_g_type_is_fixed (elt_gtype))
- return dbus_g_type_get_collection ("GArray", elt_gtype);
- else if (g_type_is_a (elt_gtype, G_TYPE_OBJECT)
- || g_type_is_a (elt_gtype, G_TYPE_BOXED))
- return dbus_g_type_get_collection ("GPtrArray", elt_gtype);
-
- /* Later we need to return DBUS_TYPE_G_VALUE */
- return G_TYPE_INVALID;
-}
-
-GType
-dbus_gtype_from_signature_iter (DBusSignatureIter *iter, gboolean is_client)
-{
- int current_type;
-
- current_type = dbus_signature_iter_get_current_type (iter);
- /* TODO: handle type 0? */
- if (dbus_typecode_maps_to_basic (current_type))
- return basic_typecode_to_gtype (current_type);
- else if (current_type == DBUS_TYPE_OBJECT_PATH)
- return DBUS_TYPE_G_OBJECT_PATH;
- else
- {
- DBusSignatureIter subiter;
-
- g_assert (dbus_type_is_container (current_type));
-
- if (current_type == DBUS_TYPE_VARIANT)
- return G_TYPE_VALUE;
- if (current_type == DBUS_TYPE_STRUCT)
- return G_TYPE_VALUE_ARRAY;
-
- dbus_signature_iter_recurse (iter, &subiter);
-
- if (current_type == DBUS_TYPE_ARRAY)
- {
- int elt_type = dbus_signature_iter_get_current_type (&subiter);
- if (elt_type == DBUS_TYPE_DICT_ENTRY)
- return signature_iter_to_g_type_dict (&subiter, is_client);
- else
- return signature_iter_to_g_type_array (&subiter, is_client);
- }
- else
- {
- g_assert_not_reached ();
- return G_TYPE_INVALID;
- }
- }
-}
-
-GType
-dbus_gtype_from_signature (const char *signature, gboolean is_client)
-{
- DBusSignatureIter iter;
-
- dbus_signature_iter_init (&iter, signature);
-
- return dbus_gtype_from_signature_iter (&iter, is_client);
-}
-
char *
-dbus_gtype_to_signature (GType gtype)
+_dbus_gtype_to_signature (GType gtype)
{
char *ret;
DBusGTypeMarshalData *typedata;
@@ -497,7 +358,7 @@ dbus_gtype_to_signature (GType gtype)
char *subsig;
elt_gtype = dbus_g_type_get_collection_specialization (gtype);
- subsig = dbus_gtype_to_signature (elt_gtype);
+ subsig = _dbus_gtype_to_signature (elt_gtype);
ret = g_strconcat (DBUS_TYPE_ARRAY_AS_STRING, subsig, NULL);
g_free (subsig);
}
@@ -510,8 +371,8 @@ dbus_gtype_to_signature (GType gtype)
key_gtype = dbus_g_type_get_map_key_specialization (gtype);
val_gtype = dbus_g_type_get_map_value_specialization (gtype);
- key_subsig = dbus_gtype_to_signature (key_gtype);
- val_subsig = dbus_gtype_to_signature (val_gtype);
+ key_subsig = _dbus_gtype_to_signature (key_gtype);
+ val_subsig = _dbus_gtype_to_signature (val_gtype);
ret = g_strconcat (DBUS_TYPE_ARRAY_AS_STRING DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING, key_subsig, val_subsig, DBUS_DICT_ENTRY_END_CHAR_AS_STRING, NULL);
g_free (key_subsig);
g_free (val_subsig);
@@ -552,31 +413,9 @@ dbus_gvalue_to_signature (const GValue *val)
return g_string_free (str, FALSE);
}
else
- return dbus_gtype_to_signature (gtype);
-}
-
-GArray *
-dbus_gtypes_from_arg_signature (const char *argsig, gboolean is_client)
-{
- GArray *ret;
- int current_type;
- DBusSignatureIter sigiter;
-
- ret = g_array_new (FALSE, FALSE, sizeof (GType));
-
- dbus_signature_iter_init (&sigiter, argsig);
- while ((current_type = dbus_signature_iter_get_current_type (&sigiter)) != DBUS_TYPE_INVALID)
- {
- GType curtype;
-
- curtype = dbus_gtype_from_signature_iter (&sigiter, is_client);
- g_array_append_val (ret, curtype);
- dbus_signature_iter_next (&sigiter);
- }
- return ret;
+ return _dbus_gtype_to_signature (gtype);
}
-
static gboolean
demarshal_basic (DBusGValueMarshalCtx *context,
DBusMessageIter *iter,
@@ -681,12 +520,12 @@ demarshal_static_variant (DBusGValueMarshalCtx *context,
dbus_message_iter_recurse (iter, &subiter);
sig = dbus_message_iter_get_signature (&subiter);
- variant_type = dbus_gtype_from_signature (sig, context->proxy != NULL);
+ variant_type = _dbus_gtype_from_signature (sig, context->proxy != NULL);
if (variant_type != G_TYPE_INVALID)
{
g_value_init (value, variant_type);
- if (!dbus_gvalue_demarshal (context, &subiter, value, error))
+ if (!_dbus_gvalue_demarshal (context, &subiter, value, error))
{
dbus_free (sig);
return FALSE;
@@ -898,7 +737,7 @@ demarshal_valuearray (DBusGValueMarshalCtx *context,
val = g_value_array_get_nth (ret, ret->n_values - 1);
current_sig = dbus_message_iter_get_signature (&subiter);
- elt_type = dbus_gtype_from_signature (current_sig, TRUE);
+ elt_type = _dbus_gtype_from_signature (current_sig, TRUE);
g_free (current_sig);
if (elt_type == G_TYPE_INVALID)
@@ -913,7 +752,7 @@ demarshal_valuearray (DBusGValueMarshalCtx *context,
g_value_init (val, elt_type);
- if (!dbus_gvalue_demarshal (context, &subiter, val, error))
+ if (!_dbus_gvalue_demarshal (context, &subiter, val, error))
{
g_value_array_free (ret);
return FALSE;
@@ -986,7 +825,7 @@ demarshal_map (DBusGValueMarshalCtx *context,
dbus_message_iter_recurse (&subiter, &entry_iter);
g_value_init (&key_value, key_gtype);
- if (!dbus_gvalue_demarshal (context,
+ if (!_dbus_gvalue_demarshal (context,
&entry_iter,
&key_value,
error))
@@ -995,7 +834,7 @@ demarshal_map (DBusGValueMarshalCtx *context,
dbus_message_iter_next (&entry_iter);
g_value_init (&value_value, value_gtype);
- if (!dbus_gvalue_demarshal (context,
+ if (!_dbus_gvalue_demarshal (context,
&entry_iter,
&value_value,
error))
@@ -1044,7 +883,7 @@ demarshal_collection (DBusGValueMarshalCtx *context,
coltype = G_VALUE_TYPE (value);
subtype = dbus_g_type_get_collection_specialization (coltype);
- if (dbus_g_type_is_fixed (subtype))
+ if (_dbus_g_type_is_fixed (subtype))
return demarshal_collection_array (context, iter, value, error);
else
return demarshal_collection_ptrarray (context, iter, value, error);
@@ -1136,9 +975,9 @@ demarshal_collection_array (DBusGValueMarshalCtx *context,
elt_gtype = dbus_g_type_get_collection_specialization (G_VALUE_TYPE (value));
g_assert (elt_gtype != G_TYPE_INVALID);
- g_assert (dbus_g_type_is_fixed (elt_gtype));
+ g_assert (_dbus_g_type_is_fixed (elt_gtype));
- elt_size = dbus_g_type_fixed_get_size (elt_gtype);
+ elt_size = _dbus_g_type_fixed_get_size (elt_gtype);
ret = g_array_new (FALSE, TRUE, elt_size);
@@ -1156,7 +995,7 @@ demarshal_collection_array (DBusGValueMarshalCtx *context,
}
gboolean
-dbus_gvalue_demarshal (DBusGValueMarshalCtx *context,
+_dbus_gvalue_demarshal (DBusGValueMarshalCtx *context,
DBusMessageIter *iter,
GValue *value,
GError **error)
@@ -1182,7 +1021,7 @@ dbus_gvalue_demarshal (DBusGValueMarshalCtx *context,
}
gboolean
-dbus_gvalue_demarshal_variant (DBusGValueMarshalCtx *context,
+_dbus_gvalue_demarshal_variant (DBusGValueMarshalCtx *context,
DBusMessageIter *iter,
GValue *value,
GError **error)
@@ -1191,7 +1030,7 @@ dbus_gvalue_demarshal_variant (DBusGValueMarshalCtx *context,
}
GValueArray *
-dbus_gvalue_demarshal_message (DBusGValueMarshalCtx *context,
+_dbus_gvalue_demarshal_message (DBusGValueMarshalCtx *context,
DBusMessage *message,
guint n_types,
const GType *types,
@@ -1225,7 +1064,7 @@ dbus_gvalue_demarshal_message (DBusGValueMarshalCtx *context,
gtype = types[index];
g_value_init (value, gtype);
- if (!dbus_gvalue_demarshal (context, &iter, value, error))
+ if (!_dbus_gvalue_demarshal (context, &iter, value, error))
goto lose;
dbus_message_iter_next (&iter);
index++;
@@ -1433,7 +1272,7 @@ marshal_valuearray (DBusMessageIter *iter,
for (i = 0; i < array->n_values; i++)
{
- if (!dbus_gvalue_marshal (&subiter, g_value_array_get_nth (array, i)))
+ if (!_dbus_gvalue_marshal (&subiter, g_value_array_get_nth (array, i)))
return FALSE;
}
@@ -1527,10 +1366,10 @@ marshal_map_entry (const GValue *key,
&subiter))
goto lose;
- if (!dbus_gvalue_marshal (&subiter, key))
+ if (!_dbus_gvalue_marshal (&subiter, key))
goto lose;
- if (!dbus_gvalue_marshal (&subiter, value))
+ if (!_dbus_gvalue_marshal (&subiter, value))
goto lose;
if (!dbus_message_iter_close_container (hashdata->iter, &subiter))
@@ -1561,17 +1400,17 @@ marshal_map (DBusMessageIter *iter,
ret = FALSE;
key_type = dbus_g_type_get_map_key_specialization (gtype);
- g_assert (dbus_gtype_is_valid_hash_key (key_type));
+ g_assert (_dbus_gtype_is_valid_hash_key (key_type));
value_type = dbus_g_type_get_map_value_specialization (gtype);
- g_assert (dbus_gtype_is_valid_hash_value (value_type));
+ g_assert (_dbus_gtype_is_valid_hash_value (value_type));
- key_sig = dbus_gtype_to_signature (key_type);
+ key_sig = _dbus_gtype_to_signature (key_type);
if (!key_sig)
{
g_warning ("Cannot marshal type \"%s\" in map\n", g_type_name (key_type));
return FALSE;
}
- value_sig = dbus_gtype_to_signature (value_type);
+ value_sig = _dbus_gtype_to_signature (value_type);
if (!value_sig)
{
g_free (key_sig);
@@ -1701,7 +1540,7 @@ marshal_collection (DBusMessageIter *iter,
coltype = G_VALUE_TYPE (value);
subtype = dbus_g_type_get_collection_specialization (coltype);
- if (dbus_g_type_is_fixed (subtype))
+ if (_dbus_g_type_is_fixed (subtype))
return marshal_collection_array (iter, value);
else
return marshal_collection_ptrarray (iter, value);
@@ -1723,7 +1562,7 @@ marshal_collection_ptrarray (DBusMessageIter *iter,
if (!data.marshaller)
return FALSE;
- elt_sig = dbus_gtype_to_signature (elt_gtype);
+ elt_sig = _dbus_gtype_to_signature (elt_gtype);
if (!elt_sig)
{
g_warning ("Cannot marshal type \"%s\" in collection\n", g_type_name (elt_gtype));
@@ -1765,15 +1604,15 @@ marshal_collection_array (DBusMessageIter *iter,
char *subsignature_str;
elt_gtype = dbus_g_type_get_collection_specialization (G_VALUE_TYPE (value));
- g_assert (dbus_g_type_is_fixed (elt_gtype));
- subsignature_str = dbus_gtype_to_signature (elt_gtype);
+ g_assert (_dbus_g_type_is_fixed (elt_gtype));
+ subsignature_str = _dbus_gtype_to_signature (elt_gtype);
if (!subsignature_str)
{
g_warning ("Cannot marshal type \"%s\" in collection\n", g_type_name (elt_gtype));
return FALSE;
}
- elt_size = dbus_g_type_fixed_get_size (elt_gtype);
+ elt_size = _dbus_g_type_fixed_get_size (elt_gtype);
array = g_value_get_boxed (value);
@@ -1803,7 +1642,7 @@ marshal_collection_array (DBusMessageIter *iter,
}
gboolean
-dbus_gvalue_marshal (DBusMessageIter *iter,
+_dbus_gvalue_marshal (DBusMessageIter *iter,
const GValue *value)
{
GType gtype;
@@ -1823,7 +1662,7 @@ static void
assert_type_maps_to (GType gtype, const char *expected_sig)
{
char *sig;
- sig = dbus_gtype_to_signature (gtype);
+ sig = _dbus_gtype_to_signature (gtype);
g_assert (sig != NULL);
g_assert (!strcmp (expected_sig, sig));
g_free (sig);
@@ -1832,7 +1671,7 @@ assert_type_maps_to (GType gtype, const char *expected_sig)
static void
assert_signature_maps_to (const char *sig, GType expected_gtype)
{
- g_assert (dbus_gtype_from_signature (sig, TRUE) == expected_gtype);
+ g_assert (_dbus_gtype_from_signature (sig, TRUE) == expected_gtype);
}
static void
@@ -1850,7 +1689,7 @@ assert_bidirectional_mapping (GType gtype, const char *expected_sig)
gboolean
_dbus_gvalue_test (const char *test_data_dir)
{
- dbus_g_value_types_init ();
+ _dbus_g_value_types_init ();
assert_bidirectional_mapping (G_TYPE_STRING, DBUS_TYPE_STRING_AS_STRING);
assert_bidirectional_mapping (G_TYPE_UCHAR, DBUS_TYPE_BYTE_AS_STRING);
diff --git a/glib/dbus-gvalue.h b/glib/dbus-gvalue.h
index 99cfd07b..3b41747e 100644
--- a/glib/dbus-gvalue.h
+++ b/glib/dbus-gvalue.h
@@ -14,36 +14,27 @@ typedef struct {
DBusGProxy *proxy;
} DBusGValueMarshalCtx;
-void dbus_g_value_types_init (void);
+void _dbus_g_value_types_init (void);
-GType dbus_gtype_from_signature (const char *signature,
- gboolean is_client);
+char * _dbus_gtype_to_signature (GType type);
-GType dbus_gtype_from_signature_iter (DBusSignatureIter *sigiter,
- gboolean is_client);
-
-char * dbus_gtype_to_signature (GType type);
-
-GArray * dbus_gtypes_from_arg_signature (const char *signature,
- gboolean is_client);
-
-gboolean dbus_gvalue_demarshal (DBusGValueMarshalCtx *context,
+gboolean _dbus_gvalue_demarshal (DBusGValueMarshalCtx *context,
DBusMessageIter *iter,
GValue *value,
GError **error);
-gboolean dbus_gvalue_demarshal_variant (DBusGValueMarshalCtx *context,
+gboolean _dbus_gvalue_demarshal_variant (DBusGValueMarshalCtx *context,
DBusMessageIter *iter,
GValue *value,
GError **error);
-GValueArray * dbus_gvalue_demarshal_message (DBusGValueMarshalCtx *context,
+GValueArray * _dbus_gvalue_demarshal_message (DBusGValueMarshalCtx *context,
DBusMessage *message,
guint n_params,
const GType *types,
GError **error);
-gboolean dbus_gvalue_marshal (DBusMessageIter *iter,
+gboolean _dbus_gvalue_marshal (DBusMessageIter *iter,
const GValue *value);
G_END_DECLS