[vala/staging: 2/2] libarchive: Update to 3.0



commit 10ed4ac50dffab178df3f5e747d5af41d0738fa3
Author: Corentin Noël <corentin elementary io>
Date:   Sun Apr 8 19:27:31 2018 +0100

    libarchive: Update to 3.0
    
    https://bugzilla.gnome.org/show_bug.cgi?id=795079

 vapi/libarchive.vapi |  174 +++++++++++++++++++++-----------------------------
 1 files changed, 73 insertions(+), 101 deletions(-)
---
diff --git a/vapi/libarchive.vapi b/vapi/libarchive.vapi
index 7cd5e30..97d0885 100644
--- a/vapi/libarchive.vapi
+++ b/vapi/libarchive.vapi
@@ -1,4 +1,4 @@
-/* libarchive.vapi - Bindings for libarchive(3) (version 2).
+/* libarchive.vapi - Bindings for libarchive(3) (version 3).
  *
  * Copyright (C) 2009 Julian Andres Klode <jak jak-linux org>
  *
@@ -30,11 +30,11 @@ namespace Archive {
        public unowned string version_string ();
 
        [CCode (instance_pos = 1.9, cname="archive_read_callback")]
-       public delegate ssize_t ReadCallback (Archive archive, out void* buffer);
+       public delegate ssize_t ReadCallback (Archive archive,[CCode (array_length = false)] out uint8[] 
buffer);
        [CCode (instance_pos = 1.9, cname="archive_skip_callback")]
-       public delegate Posix.off_t SkipCallback (Archive archive, Posix.off_t request);
+       public delegate int64_t SkipCallback (Archive archive, int64_t request);
        [CCode (instance_pos = 1.9, cname="archive_write_callback")]
-       public delegate ssize_t WriteCallback (Archive archive, void* buffer, size_t length);
+       public delegate ssize_t WriteCallback (Archive archive,[CCode (array_length_type = "size_t")] uint8[] 
buffer);
        [CCode (instance_pos = 1.9, cname="archive_open_callback")]
        public delegate int OpenCallback (Archive archive);
 
@@ -73,22 +73,6 @@ namespace Archive {
        }
 
        [CCode (cname="int", has_type_id = false)]
-       [Version (deprecated_since="3.0", replacement="Filter")]
-       public enum Compression {
-               NONE,
-               GZIP,
-               BZIP2,
-               COMPRESS,
-               PROGRAM,
-               LZMA,
-               XZ,
-               UU,
-               RPM,
-               LZIP,
-               LRZIP
-       }
-
-       [CCode (cname="int", has_type_id = false)]
        public enum Format {
                BASE_MASK,
                CPIO,
@@ -132,14 +116,18 @@ namespace Archive {
                SPARSE
        }
 
+       [SimpleType]
+       [IntegerType (rank = 9)]
+       [CCode (cname="la_int64_t")]
+       public struct int64_t {
+       }
+
        [Compact]
        [CCode (cname="struct archive", cprefix="archive_")]
        public class Archive {
-               public int64 position_compressed ();
-               public int64 position_uncompressed ();
+               public int64_t position_compressed ();
+               public int64_t position_uncompressed ();
 
-               [Version (deprecated_since="3.0", replacement="Archive.filter_code (0)")]
-               public Compression compression ();
                public Format format ();
                // Filter #0 is the one closest to the format, -1 is a synonym
                // for the last filter, which is always the pseudo-filter that
@@ -148,7 +136,7 @@ namespace Archive {
 
                public unowned string compression_name ();
                public unowned string format_name ();
-               public unowned string filter_name (int filter_no);
+               public unowned string filter_name (int filter_no = 0);
 
                public int filter_count ();
                public int file_count ();
@@ -162,24 +150,9 @@ namespace Archive {
 
 
        [Compact]
-       [CCode (cname="struct archive", free_function="archive_read_finish")]
+       [CCode (cname="struct archive", free_function="archive_read_free")]
        public class Read : Archive {
                public Read ();
-               // see 
https://github.com/libarchive/libarchive/wiki/Libarchive3#functions-that-are-being-renamed
-               [Version (deprecated_since="3.0", replacement="Archive.Read.support_filter_all ()")]
-               public Result support_compression_all ();
-               [Version (deprecated_since="3.0", replacement="Archive.Read.support_filter_bzip2 ()")]
-               public Result support_compression_bzip2 ();
-               [Version (deprecated_since="3.0", replacement="Archive.Read.support_filter_compress ()")]
-               public Result support_compression_compress ();
-               [Version (deprecated_since="3.0", replacement="Archive.Read.support_filter_gzip ()")]
-               public Result support_compression_gzip ();
-               [Version (deprecated_since="3.0", replacement="Archive.Read.support_filter_lzma ()")]
-               public Result support_compression_lzma ();
-               [Version (deprecated_since="3.0", replacement="Archive.Read.support_filter_none ()")]
-               public Result support_compression_none ();
-               [Version (deprecated_since="3.0", replacement="Archive.Read.support_filter_program (string 
command)")]
-               public Result support_compression_program (string command);
                public Result support_filter_all ();
                public Result support_filter_bzip2 ();
                public Result support_filter_compress ();
@@ -232,48 +205,46 @@ namespace Archive {
                        [CCode (delegate_target_pos = 0.9)] CloseCallback ccb
                );
 
-               public Result open_filename (string filename, size_t _block_size);
-               public Result open_memory (void* buff, size_t size);
+               public Result open_filename (string filename, size_t block_size);
+               public Result open_memory ([CCode (array_length_type = "size_t")] uint8[] buffer);
                public Result open_fd (int fd, size_t block_size);
                public Result open_FILE (GLib.FileStream file);
                public Result next_header (out unowned Entry entry);
-               public int64 header_position ();
+               public int64_t header_position ();
 
                [CCode (cname="archive_read_data")]
-               public ssize_t read_data (void* buffer, size_t size);
+               public ssize_t read_data ([CCode (array_length_type = "size_t")] uint8[] buffer);
                [CCode (cname="archive_read_data_block")]
-               public Result read_data_block (out void* buff, out size_t size, out Posix.off_t offset);
+               public Result read_data_block ([CCode (array_length_type = "size_t")] out uint8[] buffer, out 
int64_t offset);
                [CCode (cname="archive_read_data_skip")]
                public Result read_data_skip ();
-               [CCode (cname="archive_read_data_into_buffer")]
-               public Result read_data_into_buffer (void* buffer, ssize_t len);
                [CCode (cname="archive_read_data_into_fd")]
                public Result read_data_into_fd (int fd);
 
                public Result extract (Entry entry, ExtractFlags? flags=0);
                public Result extract2 (Entry entry, Write dest);
                public void extract_set_progress_callback (ExtractProgressCallback cb);
-               public void extract_set_skip_file (Posix.dev_t dev, Posix.ino_t ino);
+               public void extract_set_skip_file (int64_t dev, int64_t ino);
                public Result close ();
        }
 
        [Compact]
-       [CCode (cname = "struct archive", free_function="archive_read_finish")]
+       [CCode (cname = "struct archive", free_function="archive_read_free")]
        public class ReadDisk : Read {
                public ReadDisk ();
                public Result set_symlink_logical ();
                public Result set_symlink_physical ();
                public Result set_symlink_hybrid ();
                public Result entry_from_file (Entry entry, int fd, Posix.Stat stat);
-               public unowned string gname (Posix.gid_t gid);
-               public unowned string uname (Posix.uid_t uid);
+               public unowned string gname (int64_t gid);
+               public unowned string uname (int64_t uid);
                public Result set_standard_lookup ();
 
                // HACK, they have no name in C. May not work correctly.
                [CCode (instance_pos = 0, cname="void")]
-               public delegate unowned string GNameLookup (Posix.gid_t gid);
+               public delegate unowned string GNameLookup (int64_t gid);
                [CCode (instance_pos = 0, cname="void")]
-               public delegate unowned string UNameLookup (Posix.uid_t uid);
+               public delegate unowned string UNameLookup (int64_t uid);
                [CCode (instance_pos = 0, cname="void")]
                public delegate void Cleanup ();
 
@@ -288,21 +259,9 @@ namespace Archive {
                );
        }
 
-       [CCode (cname = "struct archive", free_function="archive_write_finish")]
+       [CCode (cname = "struct archive", free_function="archive_write_free")]
        public class Write : Archive {
                public Write ();
-               // see 
https://github.com/libarchive/libarchive/wiki/Libarchive3#functions-that-are-being-renamed
-               [Version (deprecated_since="3.0", replacement="Archive.Write.add_filter_bzip2 ()")]
-               public Result set_compression_bzip2 ();
-               [Version (deprecated_since="3.0", replacement="Archive.Write.add_filter_compress ()")]
-               public Result set_compression_compress ();
-               [Version (deprecated_since="3.0", replacement="Archive.Write.add_filter_gzip ()")]
-               public Result set_compression_gzip ();
-               [Version (deprecated_since="3.0", replacement="Archive.Write.add_filter_lzma ()")]
-               public Result set_compression_lzma ();
-               [Version (deprecated_since="3.0", replacement="Archive.Write.add_filter_none ()")]
-               public Result set_compression_none ();
-               public Result set_compression_program (string cmd);
                public Result add_filter (Filter filter_code);
                public Result add_filter_by_name (string name);
                public Result add_filter_b64encode ();
@@ -343,7 +302,7 @@ namespace Archive {
                public int get_bytes_per_block ();
                public Result set_bytes_in_last_block (int bytes_in_last_block);
                public int get_bytes_in_last_block ();
-               public Result set_skip_file (Posix.dev_t dev, Posix.ino_t ino);
+               public Result set_skip_file (int64_t dev, int64_t ino);
 
                public Result open (
                        [CCode (delegate_target_pos = 0.9)] OpenCallback ocb,
@@ -353,34 +312,34 @@ namespace Archive {
                public Result open_fd (int fd);
                public Result open_filename (string filename);
                public Result open_FILE (GLib.FileStream file);
-               public Result open_memory (void* buffer, size_t buff_size, out size_t used);
+               public Result open_memory ([CCode (array_length_type = "size_t")] uint8[] buffer, out size_t 
used);
 
                [CCode (cname="archive_write_header")]
                public Result write_header (Entry entry);
                [CCode (cname="archive_write_data")]
-               public ssize_t write_data (void* data, size_t size);
+               public ssize_t write_data ([CCode (array_length_type = "size_t")] uint8[] data);
                [CCode (cname="archive_write_data_block")]
-               public ssize_t write_data_block (void* data, size_t size, Posix.off_t offset);
+               public ssize_t write_data_block ([CCode (array_length_type = "size_t")] uint8[] data, int64_t 
offset);
 
                public Result finish_entry ();
                public Result close ();
        }
 
        [Compact]
-       [CCode (cname = "struct archive", free_function="archive_write_finish")]
+       [CCode (cname = "struct archive", free_function="archive_write_free")]
        public class WriteDisk : Write {
                public WriteDisk ();
 
-               public Result set_skip_file (Posix.dev_t dev, Posix.ino_t ino);
+               public Result set_skip_file (int64_t dev, int64_t ino);
                public Result set_options (ExtractFlags flags);
                public Result set_standard_lookup ();
 
-               // "gid_t (*)(void *, const char *, gid_t)"
+               // "la_int64_t (*)(void *, const char *, la_int64_t)"
                [CCode (has_typedef = false, instance_pos = 0)]
-               public delegate Posix.gid_t GroupLookup (string group, Posix.gid_t gid);
-               // "uid_t (*)(void *, const char *, uid_t)"
+               public delegate int64_t GroupLookup (string group, int64_t gid);
+               // "la_int64_t (*)(void *, const char *, la_int64_t)"
                [CCode (has_typedef = false, instance_pos = 0)]
-               public delegate Posix.uid_t UserLookup (string user, Posix.uid_t uid);
+               public delegate int64_t UserLookup (string user, int64_t uid);
                // "void (*)(void *)"
                [CCode (has_typedef = false, instance_pos = 0)]
                public delegate void Cleanup ();
@@ -396,10 +355,23 @@ namespace Archive {
                );
        }
 
+       [CCode (cheader_filename = "archive_entry.h", cprefix = "AE_", cname = "__LA_MODE_T", has_type_id = 
false)]
+       public enum FileType {
+               IFMT,
+               IFREG,
+               IFLNK,
+               IFSOCK,
+               IFCHR,
+               IFBLK,
+               IFDIR,
+               IFIFO
+       }
+
        [Compact]
        [CCode (cname = "struct archive_entry", cheader_filename = "archive_entry.h")]
        public class Entry {
-               public Entry ();
+               [CCode (cname="archive_entry_new2")]
+               public Entry (Archive? archive = null);
                public time_t atime ();
                public long atime_nsec ();
                public bool atime_is_set ();
@@ -409,30 +381,30 @@ namespace Archive {
                public time_t ctime ();
                public long ctime_nsec ();
                public bool ctime_is_set ();
-               public Posix.dev_t dev ();
-               public Posix.dev_t devmajor ();
-               public Posix.dev_t devminor ();
-               public Posix.mode_t filetype ();
+               public int64_t dev ();
+               public int64_t devmajor ();
+               public int64_t devminor ();
+               public FileType filetype ();
                public unowned string fflags_text ();
-               public Posix.gid_t gid ();
+               public int64_t gid ();
                public unowned string gname ();
                public unowned string hardlink ();
-               public Posix.ino_t ino ();
-               public Posix.mode_t mode ();
+               public int64_t ino ();
+               public FileType mode ();
                public time_t mtime ();
                public long mtime_nsec ();
                public bool mtime_is_set ();
                public uint nlink ();
                public unowned string pathname ();
-               public Posix.dev_t rdev ();
-               public Posix.dev_t rdevmajor ();
-               public Posix.dev_t rdevminor ();
+               public int64_t rdev ();
+               public int64_t rdevmajor ();
+               public int64_t rdevminor ();
                public unowned string sourcepath ();
-               public int64 size ();
+               public int64_t size ();
                public bool size_is_set ();
                public unowned string strmode ();
                public unowned string symlink ();
-               public Posix.uid_t uid ();
+               public int64_t uid ();
                public unowned string uname ();
                public void set_atime (time_t atime, long blah);
                public void unset_atime ();
@@ -440,34 +412,34 @@ namespace Archive {
                public void unset_birthtime ();
                public void set_ctime (time_t atime, long blah);
                public void unset_ctime ();
-               public void set_dev (Posix.dev_t dev);
-               public void set_devmajor (Posix.dev_t major);
-               public void set_devminor (Posix.dev_t major);
+               public void set_dev (int64_t dev);
+               public void set_devmajor (int64_t major);
+               public void set_devminor (int64_t major);
                public void set_filetype (uint filetype);
                public void set_fflags (ulong set, ulong clear);
                public unowned string copy_fflags_text (string text);
-               public void set_gid (Posix.gid_t gid);
+               public void set_gid (int64_t gid);
                public void set_gname (string gname);
                public Result update_gname_utf8 (string gname);
                public void set_hardlink (string link);
                public void set_ino (ulong ino);
                public void set_link (string link);
                public Result update_link_utf8 (string link);
-               public void set_mode (Posix.mode_t mode);
+               public void set_mode (FileType mode);
                public void set_mtime (time_t mtime, long blah);
                public void unset_mtime ();
                public void set_nlink (uint nlink);
                public void set_pathname (string pathname);
                public Result  update_pathname_utf8 (string pathname);
-               public void set_perm (Posix.mode_t mode);
-               public void set_rdev (Posix.dev_t dev);
-               public void set_rdevmajor (Posix.dev_t devmajor);
-               public void set_rdevminor (Posix.dev_t devminor);
-               public void set_size (int64 size);
+               public void set_perm (FileType mode);
+               public void set_rdev (int64_t dev);
+               public void set_rdevmajor (int64_t devmajor);
+               public void set_rdevminor (int64_t devminor);
+               public void set_size (int64_t size);
                public void unset_size ();
                public void copy_sourcepath (string sourcepath);
                public void set_symlink (string symlink);
-               public void set_uid (Posix.uid_t uid);
+               public void set_uid (int64_t uid);
                public void set_uname (string uname);
                public Result update_uname_utf8 (string uname);
 


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