[vala-extra-vapis] msgpack: Explicitly set 'Unpacker.buffer' length from 'Unpacker.buffer_capacity'



commit 1e0ee48a7a2d6fcfca1c91d9afbfd6a22c02ca22
Author: Guillaume Poirier-Morency <guillaumepoiriermorency gmail com>
Date:   Mon Aug 15 22:41:41 2016 -0400

    msgpack: Explicitly set 'Unpacker.buffer' length from 'Unpacker.buffer_capacity'

 msgpack.vapi |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/msgpack.vapi b/msgpack.vapi
index 6b9dcb6..c1481ef 100644
--- a/msgpack.vapi
+++ b/msgpack.vapi
@@ -262,8 +262,9 @@ namespace MessagePack
        [CCode (cname = "msgpack_unpacked", has_type_id = false)]
        public struct Unpacked
        {
-               MessagePack.Zone zone;
                MessagePack.Object data;
+               MessagePack.Zone release_zone ();
+               [CCode (cname = "msgpack_unpack_next")]
                public MessagePack.UnpackReturn next ([CCode (array_length_type = "size_t")] uint8[] data, 
out size_t off);
        }
 
@@ -276,8 +277,15 @@ namespace MessagePack
        {
                public Unpacker (size_t initial_buffer_size = MessagePack.UNPACKER_INIT_BUFFER_SIZE);
                public bool reserve_buffer (size_t size = MessagePack.UNPACKER_RESERVE_SIZE);
-               [CCode (array_length = false)]
-               public unowned uint8[] buffer ();
+               [CCode (cname = "msgpack_unpacker_buffer", array_length = false)]
+               private unowned uint8[] _buffer ();
+               [CCode (cname = "vala_buffer")]
+               public unowned uint8[] buffer ()
+               {
+                       unowned uint8[] buf = _buffer ();
+                       buf.length = (int) buffer_capacity ();
+                       return buf;
+               }
                public size_t buffer_capacity ();
                public UnpackReturn next (out MessagePack.Unpacked pac);
                public int execute ();


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