mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-05-09 07:18:03 +02:00
2005-03-14 Colin Walters <walters@verbum.org>
* bus/driver.c (write_args_for_direction): Use _dbus_string_get_const_data to retrieve string; _dbus_string_get_const_data_len doesn't actually return a NULL-terminated substring. * test/glib/test-service-glib.c: Include dbus-glib-bindings.h. (main): Change to use org_freedesktop_DBus_request_name instead of using g_proxy_begin_call/end_call.
This commit is contained in:
parent
bcdd185483
commit
6180ae6941
3 changed files with 34 additions and 22 deletions
11
ChangeLog
11
ChangeLog
|
|
@ -1,3 +1,14 @@
|
|||
2005-03-14 Colin Walters <walters@verbum.org>
|
||||
|
||||
* bus/driver.c (write_args_for_direction): Use
|
||||
_dbus_string_get_const_data to retrieve string;
|
||||
_dbus_string_get_const_data_len doesn't actually return
|
||||
a NULL-terminated substring.
|
||||
|
||||
* test/glib/test-service-glib.c: Include dbus-glib-bindings.h.
|
||||
(main): Change to use org_freedesktop_DBus_request_name
|
||||
instead of using g_proxy_begin_call/end_call.
|
||||
|
||||
2005-03-15 Joe Shaw <joeshaw@novell.com>
|
||||
|
||||
* mono/ProxyBuilder.cs (BuildFinalizer): Fix some invalid IL when
|
||||
|
|
|
|||
|
|
@ -1117,7 +1117,14 @@ write_args_for_direction (DBusString *xml,
|
|||
int start, len;
|
||||
|
||||
_dbus_type_reader_get_signature (&typereader, &subsig, &start, &len);
|
||||
if (!_dbus_string_append_printf (xml, " <arg direction=\"%s\" type=\"%s\"/>\n", in ? "in" : "out", _dbus_string_get_const_data_len (subsig, start, len)))
|
||||
if (!_dbus_string_append_printf (xml, " <arg direction=\"%s\" type=\"",
|
||||
in ? "in" : "out"))
|
||||
goto oom;
|
||||
if (!_dbus_string_append_len (xml,
|
||||
_dbus_string_get_const_data (subsig) + start,
|
||||
len))
|
||||
goto oom;
|
||||
if (!_dbus_string_append (xml, "\"/>\n"))
|
||||
goto oom;
|
||||
|
||||
_dbus_type_reader_next (&typereader);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
/* -*- mode: C; c-file-style: "gnu" -*- */
|
||||
#include <dbus/dbus-glib.h>
|
||||
/* NOTE - outside of D-BUS core this would be
|
||||
* include <dbus/dbus-glib-bindings.h>
|
||||
*/
|
||||
#include "glib/dbus-glib-bindings.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
|
@ -190,6 +194,8 @@ my_object_many_args (MyObject *obj, guint32 x, const char *str, double trouble,
|
|||
|
||||
static GMainLoop *loop;
|
||||
|
||||
#define TEST_SERVICE_NAME "org.freedesktop.DBus.TestSuiteGLibService"
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
|
|
@ -197,9 +203,7 @@ main (int argc, char **argv)
|
|||
GError *error;
|
||||
GObject *obj;
|
||||
DBusGProxy *driver_proxy;
|
||||
DBusGPendingCall *call;
|
||||
const char *v_STRING;
|
||||
guint32 v_UINT32;
|
||||
guint32 request_name_ret;
|
||||
|
||||
g_type_init ();
|
||||
|
||||
|
|
@ -231,34 +235,24 @@ main (int argc, char **argv)
|
|||
DBUS_PATH_DBUS,
|
||||
DBUS_INTERFACE_DBUS);
|
||||
|
||||
v_STRING = "org.freedesktop.DBus.TestSuiteGLibService";
|
||||
v_UINT32 = 0;
|
||||
call = dbus_g_proxy_begin_call (driver_proxy, "RequestName",
|
||||
DBUS_TYPE_STRING,
|
||||
&v_STRING,
|
||||
DBUS_TYPE_UINT32,
|
||||
&v_UINT32,
|
||||
DBUS_TYPE_INVALID);
|
||||
if (!dbus_g_proxy_end_call (driver_proxy, call,
|
||||
&error, DBUS_TYPE_UINT32, &v_UINT32,
|
||||
DBUS_TYPE_INVALID))
|
||||
if (!org_freedesktop_DBus_request_name (driver_proxy,
|
||||
TEST_SERVICE_NAME,
|
||||
0, &request_name_ret, &error))
|
||||
{
|
||||
g_assert (error != NULL);
|
||||
g_printerr ("Failed to get name: %s\n",
|
||||
error->message);
|
||||
g_error_free (error);
|
||||
error->message);
|
||||
g_clear_error (&error);
|
||||
exit (1);
|
||||
}
|
||||
g_assert (error == NULL);
|
||||
dbus_g_pending_call_unref (call);
|
||||
|
||||
if (!(v_UINT32 == DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER))
|
||||
if (!(request_name_ret == DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER))
|
||||
{
|
||||
g_printerr ("Got result code %u from requesting name\n", v_UINT32);
|
||||
g_printerr ("Got result code %u from requesting name\n", request_name_ret);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
g_printerr ("GLib test service has name '%s'\n", v_STRING);
|
||||
g_printerr ("GLib test service has name '%s'\n", TEST_SERVICE_NAME);
|
||||
g_printerr ("GLib test service entering main loop\n");
|
||||
|
||||
g_main_loop_run (loop);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue