[gnome-boxes/wip/ricotz/vala: 2/2] Handle libarchive binding changes with valac 0.41+
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes/wip/ricotz/vala: 2/2] Handle libarchive binding changes with valac 0.41+
- Date: Wed, 25 Apr 2018 14:51:37 +0000 (UTC)
commit a582c205c45ceeb601be08aa59f290236bcf6dc5
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Wed Apr 25 09:04:49 2018 +0200
Handle libarchive binding changes with valac 0.41+
src/archive-writer.vala | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/src/archive-writer.vala b/src/archive-writer.vala
index a870d692..29cf6edf 100644
--- a/src/archive-writer.vala
+++ b/src/archive-writer.vala
@@ -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 ());
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]