[vala] libosso: fix struct Rpc bindings



commit 765719558d6816a3ae35bb13beeaa20e633cb2a2
Author: Philipp Zabel <philipp zabel gmail com>
Date:   Tue Oct 20 16:15:02 2009 +0200

    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.

 vapi/libosso.vapi |   28 ++++++++++++++++++++++++++--
 1 files changed, 26 insertions(+), 2 deletions(-)
---
diff --git a/vapi/libosso.vapi b/vapi/libosso.vapi
index 1eaa7dc..d1bb35a 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 */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]