From 9bc02d92b317a23b0d81f823f14ecbb4e58171e6 Mon Sep 17 00:00:00 2001 From: Rico Tzschichholz Date: Wed, 28 Oct 2015 13:55:55 +0100 Subject: [PATCH] gio-2.0: MemoryIn/OutputStream, use a default destroy-function for uint8[] data --- vapi/gio-2.0.vapi | 10 ++++++---- vapi/metadata/Gio-2.0-custom.vala | 7 +++++-- vapi/metadata/Gio-2.0.metadata | 4 ++++ 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/vapi/gio-2.0.vapi b/vapi/gio-2.0.vapi index 6ac0b0b3d..79cdab3de 100644 --- a/vapi/gio-2.0.vapi +++ b/vapi/gio-2.0.vapi @@ -1405,16 +1405,16 @@ namespace GLib { [CCode (has_construct_function = false, type = "GInputStream*")] public MemoryInputStream (); public void add_bytes (GLib.Bytes bytes); - public void add_data ([CCode (array_length_cname = "len", array_length_pos = 1.5, array_length_type = "gssize")] owned uint8[] data, GLib.DestroyNotify? destroy); + public void add_data ([CCode (array_length_cname = "len", array_length_pos = 1.5, array_length_type = "gssize")] owned uint8[] data, GLib.DestroyNotify? destroy = GLib.g_free); [CCode (has_construct_function = false, type = "GInputStream*")] public MemoryInputStream.from_bytes (GLib.Bytes bytes); [CCode (has_construct_function = false, type = "GInputStream*")] - public MemoryInputStream.from_data ([CCode (array_length_cname = "len", array_length_pos = 1.5, array_length_type = "gssize")] owned uint8[] data, GLib.DestroyNotify? destroy); + public MemoryInputStream.from_data ([CCode (array_length_cname = "len", array_length_pos = 1.5, array_length_type = "gssize")] owned uint8[] data, GLib.DestroyNotify? destroy = GLib.g_free); } [CCode (cheader_filename = "gio/gio.h")] public class MemoryOutputStream : GLib.OutputStream, GLib.PollableOutputStream, GLib.Seekable { [CCode (has_construct_function = false, type = "GOutputStream*")] - public MemoryOutputStream ([CCode (array_length_type = "gsize")] owned uint8[]? data, GLib.ReallocFunc? realloc_function, GLib.DestroyNotify? destroy_function); + public MemoryOutputStream ([CCode (array_length_type = "gsize")] owned uint8[]? data, GLib.ReallocFunc? realloc_function = GLib.g_realloc, GLib.DestroyNotify? destroy_function = GLib.g_free); [CCode (array_length = false)] public unowned uint8[] get_data (); public size_t get_data_size (); @@ -2418,7 +2418,7 @@ namespace GLib { public void set_flags (GLib.TlsPasswordFlags flags); public void set_value ([CCode (array_length_cname = "length", array_length_pos = 1.1, array_length_type = "gssize", type = "const guchar*")] uint8[] value); [CCode (vfunc_name = "set_value")] - public virtual void set_value_full ([CCode (array_length_cname = "length", array_length_pos = 1.5, array_length_type = "gssize", type = "guchar*")] owned uint8[] value, GLib.DestroyNotify? notify = GLib.free); + public virtual void set_value_full ([CCode (array_length_cname = "length", array_length_pos = 1.5, array_length_type = "gssize", type = "guchar*")] owned uint8[] value, GLib.DestroyNotify? notify = GLib.g_free); public void set_warning (string warning); public string description { get; set; } public GLib.TlsPasswordFlags flags { get; set; } @@ -3828,6 +3828,8 @@ namespace GLib { [CCode (cheader_filename = "gio/gio.h")] [Deprecated (replacement = "File.hash", since = "vala-0.16")] public static GLib.HashFunc file_hash; + [CCode (cheader_filename = "glib.h", cname = "g_realloc")] + public static GLib.ReallocFunc g_realloc; [CCode (cheader_filename = "gio/gio.h")] [Deprecated (replacement = "FileAttribute.ACCESS_CAN_DELETE", since = "vala-0.16")] public const string FILE_ATTRIBUTE_ACCESS_CAN_DELETE; diff --git a/vapi/metadata/Gio-2.0-custom.vala b/vapi/metadata/Gio-2.0-custom.vala index 3a8692d2f..7c43724ac 100644 --- a/vapi/metadata/Gio-2.0-custom.vala +++ b/vapi/metadata/Gio-2.0-custom.vala @@ -1,4 +1,7 @@ namespace GLib { + [CCode (cheader_filename = "glib.h", cname = "g_realloc")] + public static GLib.ReallocFunc g_realloc; + [CCode (cheader_filename = "gio/gio.h")] namespace Bus { public async GLib.DBusConnection get (GLib.BusType bus_type, GLib.Cancellable? cancellable = null) throws GLib.IOError; @@ -100,7 +103,7 @@ namespace GLib { public class MemoryOutputStream : GLib.OutputStream { [CCode (has_construct_function = false, type = "GOutputStream*")] - public MemoryOutputStream ([CCode (array_length_type = "gsize")] owned uint8[]? data, GLib.ReallocFunc? realloc_function, GLib.DestroyNotify? destroy_function); + public MemoryOutputStream ([CCode (array_length_type = "gsize")] owned uint8[]? data, GLib.ReallocFunc? realloc_function = GLib.g_realloc, GLib.DestroyNotify? destroy_function = GLib.g_free); } [CCode (cheader_filename = "gio/gio.h", type_id = "g_native_socket_address_get_type ()")] @@ -175,7 +178,7 @@ namespace GLib { public class TlsPassword : GLib.Object { [CCode (vfunc_name = "set_value")] - public virtual void set_value_full ([CCode (array_length_cname = "length", array_length_pos = 1.5, array_length_type = "gssize", type = "guchar*")] owned uint8[] value, GLib.DestroyNotify? notify = GLib.free); + public virtual void set_value_full ([CCode (array_length_cname = "length", array_length_pos = 1.5, array_length_type = "gssize", type = "guchar*")] owned uint8[] value, GLib.DestroyNotify? notify = GLib.g_free); } public class VolumeMonitor : GLib.Object { diff --git a/vapi/metadata/Gio-2.0.metadata b/vapi/metadata/Gio-2.0.metadata index 1c2eb7708..2a52f62c6 100644 --- a/vapi/metadata/Gio-2.0.metadata +++ b/vapi/metadata/Gio-2.0.metadata @@ -143,6 +143,10 @@ InputStream ListModel .get_item#virtual_method skip .get_item#method skip=false abstract +MemoryInputStream + .add_data.destroy default=GLib.g_free +MemoryInputStream + .new_from_data.destroy default=GLib.g_free MemoryOutputStream .get_data type="unowned uint8[]" .steal_data type="uint8[]" -- 2.47.2