From: Philipp Zabel Date: Tue, 20 Oct 2009 14:15:02 +0000 (+0200) Subject: libosso: fix struct Rpc bindings X-Git-Tag: 0.7.9~80 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=765719558d6816a3ae35bb13beeaa20e633cb2a2;p=thirdparty%2Fvala.git libosso: fix struct Rpc bindings osso_rpc_free_val should be destroy_function instead of unref_function. The value union contained in osso_rpc_t is not a GLib.Value Fixes bug 599052. --- diff --git a/vapi/libosso.vapi b/vapi/libosso.vapi index 1eaa7dc3a..d1bb35a30 100644 --- a/vapi/libosso.vapi +++ b/vapi/libosso.vapi @@ -224,10 +224,34 @@ namespace Osso { public DevMode sig_device_mode_ind; } - [CCode (unref_function = "osso_rpc_free_val", cname = "osso_rpc_t")] + [CCode (destroy_function = "osso_rpc_free_val", cname = "osso_rpc_t")] public struct Rpc { public int type; - public GLib.Value value; + [CCode (cname = "value.u")] + private uint32 u; + [CCode (cname = "value.i")] + private int32 i; + [CCode (cname = "value.b")] + private bool b; + [CCode (cname = "value.d")] + private double d; + [CCode (cname = "value.s")] + private string s; + public uint32 to_uint32 () requires (type == 'u') { + return u; + } + public int32 to_int32 () requires (type == 'i') { + return i; + } + public bool to_bool () requires (type == 'b') { + return b; + } + public double to_double () requires (type == 'd') { + return d; + } + public unowned string to_string () requires (type == 's') { + return s; + } } /* Enums */