Commit 6da08ef1 authored by Rico Tzschichholz's avatar Rico Tzschichholz

update: Adapt to libarchive binding change since valac 0.42

Fixes #1
parent 70b9d78a
Pipeline #49851 failed with stage
in 32 seconds
......@@ -188,7 +188,12 @@ namespace HTTPSEverywhere {
Archive.Read zipreader = new Archive.Read();
zipreader.set_format(Archive.Format.ZIP);
#if VALA_0_42
output.length = (int) size_read;
zipreader.open_memory(output);
#else
zipreader.open_memory(output, size_read);
#endif
string json = "";
unowned Archive.Entry e = null;
......@@ -198,11 +203,15 @@ namespace HTTPSEverywhere {
found_ruleset_file = true;
uint8[] jsonblock = new uint8[1024*1024];
while (true) {
var r = zipreader.read_data(jsonblock, 1024*1024);
#if VALA_0_42
var r = zipreader.read_data(jsonblock);
#else
var r = zipreader.read_data(jsonblock, jsonblock.length);
#endif
if (r < 0) {
throw new UpdateError.CANT_READ_FROM_ARCHIVE("Failed reading archive stream");
}
if (r < 1024*1024 && r != 0) {
if (r < jsonblock.length && r != 0) {
uint8[] remainder = new uint8[r];
Memory.copy(remainder, jsonblock, r);
json += (string)remainder;
......
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