Commit a582c205 authored by Rico Tzschichholz's avatar Rico Tzschichholz Committed by Rico Tzschichholz

Handle libarchive binding changes with valac 0.41+

parent f5017291
Pipeline #9732 passed with stage
in 3 minutes and 11 seconds
......@@ -72,7 +72,11 @@ public void import_read_archive (ArchiveReader archive_reader,
execute_libarchive_function (archive, () => { return archive.write_header (iterator); });
if (len > 0) {
var buf = new uint8[len];
#if VALA_0_42
insert_data (buf, archive_reader.archive.read_data (buf));
#else
insert_data (buf, archive_reader.archive.read_data (buf, (size_t) len));
#endif
}
}
......@@ -104,7 +108,7 @@ public void insert_file (string src, string dest) throws GLib.IOError {
var filestream = GLib.FileStream.open (src, "r");
filestream.read ((uint8[]) buf, (size_t) len);
execute_libarchive_function (archive, () => { return archive.write_header(entry); });
insert_data ((uint8[]) buf, len);
insert_data (buf, len);
}
private void prepare_archive () throws GLib.IOError {
......@@ -122,8 +126,12 @@ private void copy_filters_from_read_archive (Archive.Read read_archive) {
filters.append (read_archive.filter_code (i - 1));
}
private void insert_data (void* data, int64 len) throws GLib.IOError {
if (archive.write_data (data, (size_t) len) != len)
private void insert_data (uint8[] data, int64 len) throws GLib.IOError {
#if VALA_0_42
if (archive.write_data (data) != len)
#else
if (archive.write_data (data, (size_t) data.length) != len)
#endif
throw new GLib.IOError.FAILED ("Failed writing data to archive. Message: '%s'.",
archive.error_string ());
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment