1
0
mirror of https://github.com/veracrypt/VeraCrypt.git synced 2025-12-31 19:09:44 -06:00

Windows: Update libzip to version 1.5.2

This commit is contained in:
Mounir IDRASSI
2019-10-04 21:13:31 +02:00
parent 9a895bedde
commit b6babc688d
112 changed files with 247 additions and 164 deletions

View File

@@ -1,6 +1,6 @@
/*
zip_source_window.c -- return part of lower source
Copyright (C) 2012-2017 Dieter Baron and Thomas Klausner
Copyright (C) 2012-2018 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
The authors can be contacted at <libzip@nih.at>
@@ -121,7 +121,6 @@ window_read(zip_source_t *src, void *_ctx, void *data, zip_uint64_t len, zip_sou
struct window *ctx;
zip_int64_t ret;
zip_uint64_t n, i;
char b[8192];
ctx = (struct window *)_ctx;
@@ -154,18 +153,30 @@ window_read(zip_source_t *src, void *_ctx, void *data, zip_uint64_t len, zip_sou
}
if (!ctx->needs_seek) {
DEFINE_BYTE_ARRAY(b, BUFSIZE);
if (!byte_array_init(b, BUFSIZE)) {
zip_error_set(&ctx->error, ZIP_ER_MEMORY, 0);
return -1;
}
for (n = 0; n < ctx->start; n += (zip_uint64_t)ret) {
i = (ctx->start - n > sizeof(b) ? sizeof(b) : ctx->start - n);
i = (ctx->start - n > BUFSIZE ? BUFSIZE : ctx->start - n);
if ((ret = zip_source_read(src, b, i)) < 0) {
_zip_error_set_from_source(&ctx->error, src);
byte_array_fini(b);
return -1;
}
if (ret == 0) {
zip_error_set(&ctx->error, ZIP_ER_EOF, 0);
byte_array_fini(b);
return -1;
}
}
byte_array_fini(b);
}
ctx->offset = ctx->start;
return 0;