summaryrefslogtreecommitdiff
path: root/vapi
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2021-12-28 13:18:46 +0100
committerRico Tzschichholz <ricotz@ubuntu.com>2021-12-28 15:36:28 +0100
commite556d70819d91c23d6a704466c418ef68ad92562 (patch)
tree0a932279e0ee08012be896c289137a6f8040e988 /vapi
parent929d3be56d2b3e9a39327635f30d0de74372b0bd (diff)
downloadvala-e556d70819d91c23d6a704466c418ef68ad92562.tar.gz
gio-2.0: Add custom MemoryOutputStream.with_*data() wrappers
Fixes https://gitlab.gnome.org/GNOME/vala/issues/1271
Diffstat (limited to 'vapi')
-rw-r--r--vapi/gio-2.0.vapi11
-rw-r--r--vapi/metadata/Gio-2.0-custom.vala11
2 files changed, 22 insertions, 0 deletions
diff --git a/vapi/gio-2.0.vapi b/vapi/gio-2.0.vapi
index b3dc8277d..92df9f787 100644
--- a/vapi/gio-2.0.vapi
+++ b/vapi/gio-2.0.vapi
@@ -1773,6 +1773,8 @@ namespace GLib {
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.g_realloc, GLib.DestroyNotify? destroy_function = GLib.g_free);
+ [CCode (cname = "g_memory_output_stream_new", has_construct_function = false, type = "GOutputStream*")]
+ public MemoryOutputStream.from_data (void* data, size_t size, GLib.ReallocFunc? realloc_function = null, GLib.DestroyNotify? destroy_function = null);
[CCode (array_length = false)]
public unowned uint8[] get_data ();
[Version (since = "2.18")]
@@ -1786,6 +1788,15 @@ namespace GLib {
[CCode (array_length = false)]
[Version (since = "2.26")]
public uint8[] steal_data ();
+ [CCode (cname = "vala_g_memory_output_stream_with_data")]
+ public static GLib.MemoryOutputStream with_data ([CCode (array_length_type = "gsize")] uint8[] data) {
+ return new GLib.MemoryOutputStream.from_data (data, data.length, null, null);
+ }
+ [CCode (cname = "vala_g_memory_output_stream_with_owned_data")]
+ public static GLib.MemoryOutputStream with_owned_data ([CCode (array_length_type = "gsize")] owned uint8[] data) {
+ size_t size = data.length;
+ return new GLib.MemoryOutputStream.from_data ((owned) data, size, GLib.g_realloc, GLib.g_free);
+ }
[Version (since = "2.24")]
public void* data { get; construct; }
[Version (since = "2.24")]
diff --git a/vapi/metadata/Gio-2.0-custom.vala b/vapi/metadata/Gio-2.0-custom.vala
index 9b3b83c5e..31dba848d 100644
--- a/vapi/metadata/Gio-2.0-custom.vala
+++ b/vapi/metadata/Gio-2.0-custom.vala
@@ -87,6 +87,17 @@ 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.g_realloc, GLib.DestroyNotify? destroy_function = GLib.g_free);
+ [CCode (cname = "g_memory_output_stream_new", has_construct_function = false, type = "GOutputStream*")]
+ public MemoryOutputStream.from_data (void* data, size_t size, GLib.ReallocFunc? realloc_function = null, GLib.DestroyNotify? destroy_function = null);
+ [CCode (cname = "vala_g_memory_output_stream_with_data")]
+ public static MemoryOutputStream with_data ([CCode (array_length_type = "gsize")] uint8[] data) {
+ return new MemoryOutputStream.from_data (data, data.length);
+ }
+ [CCode (cname = "vala_g_memory_output_stream_with_owned_data")]
+ public static MemoryOutputStream with_owned_data ([CCode (array_length_type = "gsize")] owned uint8[] data) {
+ size_t size = data.length;
+ return new MemoryOutputStream.from_data ((owned) data, size, GLib.g_realloc, GLib.g_free);
+ }
}
public abstract class NativeVolumeMonitor : GLib.VolumeMonitor {