[glib/wip/kdbus-junk: 31/37] GDBus: add support for GVariant floats to helpers
- From: Ryan Lortie <desrt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/wip/kdbus-junk: 31/37] GDBus: add support for GVariant floats to helpers
- Date: Wed, 10 Dec 2014 15:59:50 +0000 (UTC)
commit d3e998b3701480e729b102673322348eef3d6c27
Author: Ryan Lortie <desrt desrt ca>
Date: Tue Dec 2 14:35:21 2014 -0500
GDBus: add support for GVariant floats to helpers
Add support for G_VARIANT_TYPE_FLOAT to some helper functions.
We don't add support to the core serialiser because the sending side
already has a catch-all case for unsupported types (because of maybe
types) and the receiving side will never see floats on the wire.
https://bugzilla.gnome.org/show_bug.cgi?id=740897
gio/gdbusutils.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/gio/gdbusutils.c b/gio/gdbusutils.c
index 4e17749..1ecc57b 100644
--- a/gio/gdbusutils.c
+++ b/gio/gdbusutils.c
@@ -419,6 +419,11 @@ g_dbus_gvariant_to_gvalue (GVariant *value,
g_value_set_uint64 (out_gvalue, g_variant_get_uint64 (value));
break;
+ case G_VARIANT_CLASS_FLOAT:
+ g_value_init (out_gvalue, G_TYPE_FLOAT);
+ g_value_set_float (out_gvalue, g_variant_get_float (value));
+ break;
+
case G_VARIANT_CLASS_DOUBLE:
g_value_init (out_gvalue, G_TYPE_DOUBLE);
g_value_set_double (out_gvalue, g_variant_get_double (value));
@@ -593,6 +598,10 @@ g_dbus_gvalue_to_gvariant (const GValue *gvalue,
ret = g_variant_ref_sink (g_variant_new_uint64 (g_value_get_uint64 (gvalue)));
break;
+ case G_VARIANT_CLASS_FLOAT:
+ ret = g_variant_ref_sink (g_variant_new_float (g_value_get_float (gvalue)));
+ break;
+
case G_VARIANT_CLASS_DOUBLE:
ret = g_variant_ref_sink (g_variant_new_double (g_value_get_double (gvalue)));
break;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]