mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-03-15 20:25:12 +01:00
Bug 623810 – Message serialization bug
https://bugzilla.gnome.org/show_bug.cgi?id=623810 Signed-off-by: David Zeuthen <davidz@redhat.com>
This commit is contained in:
parent
44cf10adce
commit
48b1fe948c
@ -2048,7 +2048,7 @@ g_dbus_message_to_blob (GDBusMessage *message,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (signature != NULL)
|
if (signature != NULL && strlen (signature_str) > 0)
|
||||||
{
|
{
|
||||||
g_set_error (error,
|
g_set_error (error,
|
||||||
G_IO_ERROR,
|
G_IO_ERROR,
|
||||||
|
@ -484,12 +484,19 @@ get_body_signature (GVariant *value)
|
|||||||
gsize len;
|
gsize len;
|
||||||
gchar *ret;
|
gchar *ret;
|
||||||
|
|
||||||
|
if (value == NULL)
|
||||||
|
{
|
||||||
|
ret = g_strdup ("");
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
s = g_variant_get_type_string (value);
|
s = g_variant_get_type_string (value);
|
||||||
len = strlen (s);
|
len = strlen (s);
|
||||||
g_assert (len >= 2);
|
g_assert (len >= 2);
|
||||||
|
|
||||||
ret = g_strndup (s + 1, len - 2);
|
ret = g_strndup (s + 1, len - 2);
|
||||||
|
|
||||||
|
out:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -560,10 +567,16 @@ check_serialization (GVariant *value,
|
|||||||
blob_size,
|
blob_size,
|
||||||
G_DBUS_CAPABILITY_FLAGS_NONE,
|
G_DBUS_CAPABILITY_FLAGS_NONE,
|
||||||
&error);
|
&error);
|
||||||
g_assert_no_error (error);
|
|
||||||
g_assert (recovered_message != NULL);
|
g_assert (recovered_message != NULL);
|
||||||
g_assert (g_dbus_message_get_body (recovered_message) != NULL);
|
g_assert_no_error (error);
|
||||||
|
|
||||||
|
if (value == NULL)
|
||||||
|
{
|
||||||
|
g_assert (g_dbus_message_get_body (recovered_message) == NULL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_assert (g_dbus_message_get_body (recovered_message) != NULL);
|
||||||
if (!g_variant_equal (g_dbus_message_get_body (recovered_message), value))
|
if (!g_variant_equal (g_dbus_message_get_body (recovered_message), value))
|
||||||
{
|
{
|
||||||
s = g_variant_print (g_dbus_message_get_body (recovered_message), TRUE);
|
s = g_variant_print (g_dbus_message_get_body (recovered_message), TRUE);
|
||||||
@ -575,6 +588,7 @@ check_serialization (GVariant *value,
|
|||||||
g_free (s1);
|
g_free (s1);
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
g_object_unref (message);
|
g_object_unref (message);
|
||||||
g_object_unref (recovered_message);
|
g_object_unref (recovered_message);
|
||||||
}
|
}
|
||||||
@ -582,6 +596,8 @@ check_serialization (GVariant *value,
|
|||||||
static void
|
static void
|
||||||
message_serialize_basic (void)
|
message_serialize_basic (void)
|
||||||
{
|
{
|
||||||
|
check_serialization (NULL, "");
|
||||||
|
|
||||||
check_serialization (g_variant_new ("(sogybnqiuxtd)",
|
check_serialization (g_variant_new ("(sogybnqiuxtd)",
|
||||||
"this is a string",
|
"this is a string",
|
||||||
"/this/is/a/path",
|
"/this/is/a/path",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user