Compare commits

...
11 Commits
46 changed files with 201 additions and 153 deletions
+1 -1
View File
@@ -32,7 +32,7 @@ set(INSTALL_MAN_DIR ${CMAKE_INSTALL_MANDIR} CACHE PATH "Installation directory f
set(INSTALL_PKGCONFIG_DIR ${CMAKE_INSTALL_LIBDIR}/pkgconfig CACHE PATH "Installation directory for pkgconfig (.pc) files")
set(INSTALL_CMAKE_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/minizip CACHE PATH "Installation directory for cmake files.")
set(VERSION "2.3.4")
set(VERSION "2.3.5")
# Set cmake debug postfix to d
set(CMAKE_DEBUG_POSTFIX "d")
+1 -1
View File
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'Minizip'
s.version = '2.3.4'
s.version = '2.3.5'
s.license = 'zlib'
s.summary = 'Minizip contrib in zlib with the latest bug fixes and advanced features'
s.description = <<-DESC
+1 -1
View File
@@ -1,4 +1,4 @@
# Minizip 2.3.4
# Minizip 2.3.5
This library is a refactoring of the minizip contribution found in the zlib distribution and is supported on Windows, macOS, and Linux. The motivation for this work has been the inclusion of advanced features, improvements in code maintainability and readability, and the reduction of duplicate code. It is based on the original work of [Gilles Vollant](http://www.winimage.com/zLibDll/minizip.html) that has been contributed to by many people over the years.
+5 -1
View File
@@ -219,7 +219,11 @@
*/
#ifndef lzma_nothrow
# if defined(__cplusplus)
# define lzma_nothrow throw()
# if __cplusplus >= 201103L
# define lzma_nothrow noexcept
# else
# define lzma_nothrow throw()
# endif
# elif __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)
# define lzma_nothrow __attribute__((__nothrow__))
# else
+6 -1
View File
@@ -644,11 +644,16 @@ extern LZMA_API(uint64_t) lzma_memlimit_get(const lzma_stream *strm)
* This function is supported only when *strm has been initialized with
* a function that takes a memlimit argument.
*
* liblzma 5.2.3 and earlier has a bug where memlimit value of 0 causes
* this function to do nothing (leaving the limit unchanged) and still
* return LZMA_OK. Later versions treat 0 as if 1 had been specified (so
* lzma_memlimit_get() will return 1 even if you specify 0 here).
*
* \return - LZMA_OK: New memory usage limit successfully set.
* - LZMA_MEMLIMIT_ERROR: The new limit is too small.
* The limit was not changed.
* - LZMA_PROG_ERROR: Invalid arguments, e.g. *strm doesn't
* support memory usage limit or memlimit was zero.
* support memory usage limit.
*/
extern LZMA_API(lzma_ret) lzma_memlimit_set(
lzma_stream *strm, uint64_t memlimit) lzma_nothrow;
+17 -4
View File
@@ -520,7 +520,10 @@ extern LZMA_API(lzma_ret) lzma_stream_buffer_encode(
*
* \param strm Pointer to properly prepared lzma_stream
* \param memlimit Memory usage limit as bytes. Use UINT64_MAX
* to effectively disable the limiter.
* to effectively disable the limiter. liblzma
* 5.2.3 and earlier don't allow 0 here and return
* LZMA_PROG_ERROR; later versions treat 0 as if 1
* had been specified.
* \param flags Bitwise-or of zero or more of the decoder flags:
* LZMA_TELL_NO_CHECK, LZMA_TELL_UNSUPPORTED_CHECK,
* LZMA_TELL_ANY_CHECK, LZMA_CONCATENATED
@@ -544,7 +547,10 @@ extern LZMA_API(lzma_ret) lzma_stream_decoder(
*
* \param strm Pointer to properly prepared lzma_stream
* \param memlimit Memory usage limit as bytes. Use UINT64_MAX
* to effectively disable the limiter.
* to effectively disable the limiter. liblzma
* 5.2.3 and earlier don't allow 0 here and return
* LZMA_PROG_ERROR; later versions treat 0 as if 1
* had been specified.
* \param flags Bitwise-or of flags, or zero for no flags.
*
* \return - LZMA_OK: Initialization was successful.
@@ -560,9 +566,16 @@ extern LZMA_API(lzma_ret) lzma_auto_decoder(
/**
* \brief Initialize .lzma decoder (legacy file format)
*
* \param strm Pointer to properly prepared lzma_stream
* \param memlimit Memory usage limit as bytes. Use UINT64_MAX
* to effectively disable the limiter. liblzma
* 5.2.3 and earlier don't allow 0 here and return
* LZMA_PROG_ERROR; later versions treat 0 as if 1
* had been specified.
*
* Valid `action' arguments to lzma_code() are LZMA_RUN and LZMA_FINISH.
* There is no need to use LZMA_FINISH, but allowing it may simplify
* certain types of applications.
* There is no need to use LZMA_FINISH, but it's allowed because it may
* simplify certain types of applications.
*
* \return - LZMA_OK
* - LZMA_MEM_ERROR
+1 -1
View File
@@ -22,7 +22,7 @@
*/
#define LZMA_VERSION_MAJOR 5
#define LZMA_VERSION_MINOR 2
#define LZMA_VERSION_PATCH 3
#define LZMA_VERSION_PATCH 4
#define LZMA_VERSION_STABILITY LZMA_VERSION_STABILITY_STABLE
#ifndef LZMA_VERSION_COMMIT
+3 -3
View File
@@ -109,9 +109,9 @@ extern const uint64_t lzma_crc64_table[4][256];
/// \brief Initialize *check depending on type
///
/// \param check LZMA_OK on success. LZMA_UNSUPPORTED_CHECK if the type
/// is not supported by the current version or build of
/// liblzma. LZMA_PROG_ERROR if type > LZMA_CHECK_ID_MAX.
/// \return LZMA_OK on success. LZMA_UNSUPPORTED_CHECK if the type is not
/// supported by the current version or build of liblzma.
/// LZMA_PROG_ERROR if type > LZMA_CHECK_ID_MAX.
extern void lzma_check_init(lzma_check_state *check, lzma_check type);
/// Update the check state
+1 -4
View File
@@ -184,9 +184,6 @@ lzma_alone_decoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
{
lzma_next_coder_init(&lzma_alone_decoder_init, next, allocator);
if (memlimit == 0)
return LZMA_PROG_ERROR;
lzma_alone_coder *coder = next->coder;
if (coder == NULL) {
@@ -208,7 +205,7 @@ lzma_alone_decoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
coder->options.preset_dict = NULL;
coder->options.preset_dict_size = 0;
coder->uncompressed_size = 0;
coder->memlimit = memlimit;
coder->memlimit = my_max(1, memlimit);
coder->memusage = LZMA_MEMUSAGE_BASE;
return LZMA_OK;
+4 -2
View File
@@ -435,8 +435,10 @@ lzma_memlimit_set(lzma_stream *strm, uint64_t new_memlimit)
|| strm->internal->next.memconfig == NULL)
return LZMA_PROG_ERROR;
if (new_memlimit != 0 && new_memlimit < LZMA_MEMUSAGE_BASE)
return LZMA_MEMLIMIT_ERROR;
// Zero is a special value that cannot be used as an actual limit.
// If 0 was specified, use 1 instead.
if (new_memlimit == 0)
new_memlimit = 1;
return strm->internal->next.memconfig(strm->internal->next.coder,
&memusage, &old_memlimit, new_memlimit);
+6
View File
@@ -16,6 +16,12 @@
#include "lzma_decoder.h"
#include "range_decoder.h"
// The macros unroll loops with switch statements.
// Silence warnings about missing fall-through comments.
#if TUKLIB_GNUC_REQ(7, 0)
# pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
#endif
#ifdef HAVE_SMALL
+54 -61
View File
@@ -1,5 +1,5 @@
/* minizip.c
Version 2.3.4, June 19, 2018
Version 2.3.5, July 9, 2018
part of the MiniZip project
Copyright (C) 2010-2018 Nathan Moinvaziri
@@ -101,7 +101,6 @@ int32_t minizip_add_path(void *handle, const char *path, const char *filenameinz
filenameinzip += 1;
// Get information about the file on disk so we can store it in zip
printf("Adding: %s\n", filenameinzip);
file_info.version_madeby = MZ_VERSION_MADEBY;
file_info.compression_method = options->compress_method;
@@ -117,6 +116,8 @@ int32_t minizip_add_path(void *handle, const char *path, const char *filenameinz
&file_info.creation_date);
mz_os_get_file_attribs(path, &file_info.external_fa);
printf("Adding: %s\n", file_info.filename);
// Add to zip
err = mz_zip_entry_write_open(handle, &file_info, options->compress_level, password);
if (err != MZ_OK)
@@ -427,8 +428,8 @@ int32_t minizip_extract_currentfile(void *handle, const char *destination, const
if (err == MZ_OK)
{
// Some zips don't contain directory alone before file
if ((mz_stream_os_open(stream, out_path, MZ_OPEN_MODE_CREATE) != MZ_OK) &&
(filename != file_info->filename))
err = mz_stream_os_open(stream, out_path, MZ_OPEN_MODE_CREATE);
if ((err != MZ_OK) && (filename != file_info->filename))
{
// Create the directory of the output path
strncpy(directory, out_path, sizeof(directory));
@@ -436,12 +437,12 @@ int32_t minizip_extract_currentfile(void *handle, const char *destination, const
mz_path_remove_filename(directory);
mz_make_dir(directory);
mz_stream_os_open(stream, out_path, MZ_OPEN_MODE_CREATE);
err = mz_stream_os_open(stream, out_path, MZ_OPEN_MODE_CREATE);
}
}
// Read from the zip, unzip to buffer, and write to disk
if (mz_stream_os_is_open(stream) == MZ_OK)
if (err == MZ_OK)
{
printf(" Extracting: %s\n", out_path);
while (1)
@@ -473,7 +474,7 @@ int32_t minizip_extract_currentfile(void *handle, const char *destination, const
}
else
{
printf("Error opening %s\n", out_path);
printf("Error %d opening %s\n", err, out_path);
}
mz_stream_os_delete(&stream);
@@ -570,65 +571,57 @@ int main(int argc, char *argv[])
// Parse command line options
for (i = 1; i < argc; i += 1)
{
if ((*argv[i]) == '-')
if (argv[i][0] == '-')
{
const char *p = argv[i] + 1;
while ((*p) != '\0')
char c = argv[i][1];
if ((c == 'l') || (c == 'L'))
do_list = 1;
if ((c == 'x') || (c == 'X'))
do_extract = 1;
if ((c == 'a') || (c == 'A'))
append = 1;
if ((c == 'u') || (c == 'U'))
buffered = 1;
if ((c == 'o') || (c == 'O'))
options.overwrite = 1;
if ((c == 'i') || (c == 'I'))
options.include_path = 1;
if ((c >= '0') && (c <= '9'))
{
char c = *(p++);
if ((c == 'l') || (c == 'L'))
do_list = 1;
if ((c == 'x') || (c == 'X'))
do_extract = 1;
if ((c == 'a') || (c == 'A'))
append = 1;
if ((c == 'u') || (c == 'U'))
buffered = 1;
if ((c == 'o') || (c == 'O'))
options.overwrite = 1;
if ((c == 'i') || (c == 'I'))
options.include_path = 1;
if ((c >= '0') && (c <= '9'))
{
options.compress_level = (c - '0');
if (options.compress_level == 0)
options.compress_method = MZ_COMPRESS_METHOD_RAW;
}
#ifdef HAVE_BZIP2
if ((c == 'b') || (c == 'B'))
options.compress_method = MZ_COMPRESS_METHOD_BZIP2;
#endif
#ifdef HAVE_LZMA
if ((c == 'm') || (c == 'M'))
options.compress_method = MZ_COMPRESS_METHOD_LZMA;
#endif
#ifdef HAVE_AES
if ((c == 's') || (c == 'S'))
options.aes = 1;
#endif
if (((c == 'k') || (c == 'K')) && (i + 1 < argc))
{
disk_size = atoi(argv[i + 1]) * 1024;
i += 1;
}
if (((c == 'd') || (c == 'D')) && (i + 1 < argc))
{
destination = argv[i + 1];
i += 1;
}
if (((c == 'p') || (c == 'P')) && (i + 1 < argc))
{
password = argv[i + 1];
i += 1;
}
options.compress_level = (c - '0');
if (options.compress_level == 0)
options.compress_method = MZ_COMPRESS_METHOD_RAW;
}
continue;
#ifdef HAVE_BZIP2
if ((c == 'b') || (c == 'B'))
options.compress_method = MZ_COMPRESS_METHOD_BZIP2;
#endif
#ifdef HAVE_LZMA
if ((c == 'm') || (c == 'M'))
options.compress_method = MZ_COMPRESS_METHOD_LZMA;
#endif
#ifdef HAVE_AES
if ((c == 's') || (c == 'S'))
options.aes = 1;
#endif
if (((c == 'k') || (c == 'K')) && (i + 1 < argc))
{
disk_size = atoi(argv[i + 1]) * 1024;
i += 1;
}
if (((c == 'd') || (c == 'D')) && (i + 1 < argc))
{
destination = argv[i + 1];
i += 1;
}
if (((c == 'p') || (c == 'P')) && (i + 1 < argc))
{
password = argv[i + 1];
i += 1;
}
}
if (path_arg == 0)
else if (path_arg == 0)
path_arg = i;
}
+2 -2
View File
@@ -1,5 +1,5 @@
/* mz.h -- Errors codes, zip flags and magic
Version 2.3.4, June 19, 2018
Version 2.3.5, July 9, 2018
part of the MiniZip project
Copyright (C) 2010-2018 Nathan Moinvaziri
@@ -19,7 +19,7 @@ extern "C" {
/***************************************************************************/
// MZ_VERSION
#define MZ_VERSION ("2.3.4")
#define MZ_VERSION ("2.3.5")
// MZ_ERROR
#define MZ_OK (0)
+1 -1
View File
@@ -1,5 +1,5 @@
/* mz_compat.c -- Backwards compatible interface for older versions
Version 2.3.4, June 19, 2018
Version 2.3.5, July 9, 2018
part of the MiniZip project
Copyright (C) 2010-2018 Nathan Moinvaziri
+1 -1
View File
@@ -1,5 +1,5 @@
/* mz_compat.h -- Backwards compatible interface for older versions
Version 2.3.4, June 19, 2018
Version 2.3.5, July 9, 2018
part of the MiniZip project
Copyright (C) 2010-2018 Nathan Moinvaziri
+1 -1
View File
@@ -1,5 +1,5 @@
/* mz_os.c -- System functions
Version 2.3.4, June 19, 2018
Version 2.3.5, July 9, 2018
part of the MiniZip project
Copyright (C) 2010-2018 Nathan Moinvaziri
+1 -3
View File
@@ -1,11 +1,9 @@
/* mz_os.h -- System functions
Version 2.3.4, June 19, 2018
Version 2.3.5, July 9, 2018
part of the MiniZip project
Copyright (C) 2010-2018 Nathan Moinvaziri
https://github.com/nmoinvaz/minizip
Copyright (C) 1998-2010 Gilles Vollant
http://www.winimage.com/zLibDll/minizip.html
This program is distributed under the terms of the same license as zlib.
See the accompanying LICENSE file for the full text of the license.
+1 -1
View File
@@ -1,5 +1,5 @@
/* mz_os_posix.c -- System functions for posix
Version 2.3.4, June 19, 2018
Version 2.3.5, July 9, 2018
part of the MiniZip project
Copyright (C) 2010-2018 Nathan Moinvaziri
+1 -1
View File
@@ -1,5 +1,5 @@
/* mz_os_posix.h -- System functions for posix
Version 2.3.4, June 19, 2018
Version 2.3.5, July 9, 2018
part of the MiniZip project
Copyright (C) 2010-2018 Nathan Moinvaziri
+1 -1
View File
@@ -1,5 +1,5 @@
/* mz_os_win32.c -- System functions for Windows
Version 2.3.4, June 19, 2018
Version 2.3.5, July 9, 2018
part of the MiniZip project
Copyright (C) 2010-2018 Nathan Moinvaziri
+1 -1
View File
@@ -1,5 +1,5 @@
/* mz_os_win32.h -- System functions for Windows
Version 2.3.4, June 19, 2018
Version 2.3.5, July 9, 2018
part of the MiniZip project
Copyright (C) 2010-2018 Nathan Moinvaziri
+4 -2
View File
@@ -1,5 +1,5 @@
/* mz_strm.c -- Stream interface
Version 2.3.4, June 19, 2018
Version 2.3.5, July 9, 2018
part of the MiniZip project
Copyright (C) 2010-2018 Nathan Moinvaziri
@@ -325,8 +325,10 @@ int32_t mz_stream_crc32_read(void *stream, void *buf, int32_t size)
int32_t read = 0;
read = mz_stream_read(crc32x->stream.base, buf, size);
if (read > 0)
{
crc32x->value = crc32x->update(crc32x->value, buf, read);
crc32x->total_in += read;
crc32x->total_in += read;
}
return read;
}
+1 -1
View File
@@ -1,5 +1,5 @@
/* mz_strm.h -- Stream interface
Version 2.3.4, June 19, 2018
Version 2.3.5, July 9, 2018
part of the MiniZip project
Copyright (C) 2010-2018 Nathan Moinvaziri
+19 -2
View File
@@ -1,5 +1,5 @@
/* mz_strm_aes.c -- Stream for WinZip AES encryption
Version 2.3.4, June 19, 2018
Version 2.3.5, July 9, 2018
part of the MiniZip project
Copyright (C) 2010-2018 Nathan Moinvaziri
@@ -50,7 +50,7 @@ static mz_stream_vtbl mz_stream_aes_vtbl = {
mz_stream_aes_create,
mz_stream_aes_delete,
mz_stream_aes_get_prop_int64,
NULL
mz_stream_aes_set_prop_int64
};
/***************************************************************************/
@@ -62,6 +62,7 @@ typedef struct mz_stream_aes_s {
int16_t initialized;
uint8_t buffer[INT16_MAX];
int64_t total_in;
int64_t max_total_in;
int64_t total_out;
int16_t encryption_mode;
const char *password;
@@ -269,6 +270,7 @@ int32_t mz_stream_aes_close(void *stream)
aes->total_in += MZ_AES_AUTHCODE_SIZE;
// If entire entry was not read this will fail
if (memcmp(authcode, verify_authcode, MZ_AES_AUTHCODE_SIZE) != 0)
return MZ_CRC_ERROR;
}
@@ -306,6 +308,9 @@ int32_t mz_stream_aes_get_prop_int64(void *stream, int32_t prop, int64_t *value)
case MZ_STREAM_PROP_TOTAL_OUT:
*value = aes->total_out;
return MZ_OK;
case MZ_STREAM_PROP_TOTAL_IN_MAX:
*value = aes->max_total_in;
return MZ_OK;
case MZ_STREAM_PROP_HEADER_SIZE:
*value = MZ_AES_SALT_LENGTH(aes->encryption_mode) + MZ_AES_PW_VERIFY_SIZE;
return MZ_OK;
@@ -316,6 +321,18 @@ int32_t mz_stream_aes_get_prop_int64(void *stream, int32_t prop, int64_t *value)
return MZ_EXIST_ERROR;
}
int32_t mz_stream_aes_set_prop_int64(void *stream, int32_t prop, int64_t value)
{
mz_stream_aes *aes = (mz_stream_aes *)stream;
switch (prop)
{
case MZ_STREAM_PROP_TOTAL_IN_MAX:
aes->max_total_in = value;
return MZ_OK;
}
return MZ_EXIST_ERROR;
}
void *mz_stream_aes_create(void **stream)
{
mz_stream_aes *aes = NULL;
+2 -1
View File
@@ -1,5 +1,5 @@
/* mz_strm_aes.h -- Stream for WinZIP AES encryption
Version 2.3.4, June 19, 2018
Version 2.3.5, July 9, 2018
part of the MiniZip project
Copyright (C) 2010-2018 Nathan Moinvaziri
@@ -33,6 +33,7 @@ void mz_stream_aes_set_password(void *stream, const char *password);
void mz_stream_aes_set_encryption_mode(void *stream, int16_t encryption_mode);
int32_t mz_stream_aes_get_prop_int64(void *stream, int32_t prop, int64_t *value);
int32_t mz_stream_aes_set_prop_int64(void *stream, int32_t prop, int64_t value);
void* mz_stream_aes_create(void **stream);
void mz_stream_aes_delete(void **stream);
+1 -1
View File
@@ -1,5 +1,5 @@
/* mz_strm_buf.c -- Stream for buffering reads/writes
Version 2.3.4, June 19, 2018
Version 2.3.5, July 9, 2018
part of the MiniZip project
This version of ioapi is designed to buffer IO.
+1 -1
View File
@@ -1,5 +1,5 @@
/* mz_strm_buf.h -- Stream for buffering reads/writes
Version 2.3.4, June 19, 2018
Version 2.3.5, July 9, 2018
part of the MiniZip project
This version of ioapi is designed to buffer IO.
+9 -3
View File
@@ -1,5 +1,5 @@
/* mz_strm_bzip.c -- Stream for bzip inflate/deflate
Version 2.3.4, June 19, 2018
Version 2.3.5, July 9, 2018
part of the MiniZip project
Copyright (C) 2010-2018 Nathan Moinvaziri
@@ -305,8 +305,11 @@ int32_t mz_stream_bzip_close(void *stream)
#ifdef MZ_ZIP_DECOMPRESS_ONLY
return MZ_SUPPORT_ERROR;
#else
mz_stream_bzip_compress(stream, BZ_FINISH);
mz_stream_bzip_flush(stream);
if (bzip->total_in > 0)
{
mz_stream_bzip_compress(stream, BZ_FINISH);
mz_stream_bzip_flush(stream);
}
BZ2_bzCompressEnd(&bzip->bzstream);
#endif
@@ -341,6 +344,9 @@ int32_t mz_stream_bzip_get_prop_int64(void *stream, int32_t prop, int64_t *value
case MZ_STREAM_PROP_TOTAL_IN:
*value = bzip->total_in;
return MZ_OK;
case MZ_STREAM_PROP_TOTAL_IN_MAX:
*value = bzip->max_total_in;
return MZ_OK;
case MZ_STREAM_PROP_TOTAL_OUT:
*value = bzip->total_out;
return MZ_OK;
+1 -1
View File
@@ -1,5 +1,5 @@
/* mz_strm_bzip.h -- Stream for bzip inflate/deflate
Version 2.3.4, June 19, 2018
Version 2.3.5, July 9, 2018
part of the MiniZip project
Copyright (C) 2010-2018 Nathan Moinvaziri
+13 -4
View File
@@ -1,5 +1,5 @@
/* mz_strm_lzma.c -- Stream for lzma inflate/deflate
Version 2.3.4, June 19, 2018
Version 2.3.5, July 9, 2018
part of the MiniZip project
Copyright (C) 2010-2018 Nathan Moinvaziri
@@ -275,7 +275,7 @@ static int32_t mz_stream_lzma_code(void *stream, int32_t flush)
lzma->buffer_len += out_bytes;
lzma->total_out += out_bytes;
}
while (lzma->lstream.avail_in > 0);
while ((lzma->lstream.avail_in > 0) || (flush == LZMA_FINISH && err == LZMA_OK));
return MZ_OK;
}
@@ -324,8 +324,11 @@ int32_t mz_stream_lzma_close(void *stream)
#ifdef MZ_ZIP_DECOMPRESS_ONLY
return MZ_SUPPORT_ERROR;
#else
mz_stream_lzma_code(stream, LZMA_FINISH);
mz_stream_lzma_flush(stream);
if (lzma->total_in > 0)
{
mz_stream_lzma_code(stream, LZMA_FINISH);
mz_stream_lzma_flush(stream);
}
lzma_end(&lzma->lstream);
#endif
@@ -360,9 +363,15 @@ int32_t mz_stream_lzma_get_prop_int64(void *stream, int32_t prop, int64_t *value
case MZ_STREAM_PROP_TOTAL_IN:
*value = lzma->total_in;
return MZ_OK;
case MZ_STREAM_PROP_TOTAL_IN_MAX:
*value = lzma->max_total_in;
return MZ_OK;
case MZ_STREAM_PROP_TOTAL_OUT:
*value = lzma->total_out;
return MZ_OK;
case MZ_STREAM_PROP_TOTAL_OUT_MAX:
*value = lzma->max_total_out;
return MZ_OK;
case MZ_STREAM_PROP_HEADER_SIZE:
*value = MZ_LZMA_HEADER_SIZE;
return MZ_OK;
+1 -1
View File
@@ -1,5 +1,5 @@
/* mz_strm_lzma.h -- Stream for lzma inflate/deflate
Version 2.3.4, June 19, 2018
Version 2.3.5, July 9, 2018
part of the MiniZip project
Copyright (C) 2010-2018 Nathan Moinvaziri
+1 -1
View File
@@ -1,5 +1,5 @@
/* mz_strm_mem.c -- Stream for memory access
Version 2.3.4, June 19, 2018
Version 2.3.5, July 9, 2018
part of the MiniZip project
This interface is designed to access memory rather than files.
+1 -3
View File
@@ -1,11 +1,9 @@
/* mz_strm_mem.h -- Stream for memory access
Version 2.3.4, June 19, 2018
Version 2.3.5, July 9, 2018
part of MiniZip project
Copyright (C) 2010-2018 Nathan Moinvaziri
https://github.com/nmoinvaz/minizip
Copyright (C) 2003 Justin Fletcher
Copyright (C) 1998-2003 Gilles Vollant
This program is distributed under the terms of the same license as zlib.
See the accompanying LICENSE file for the full text of the license.
+8 -2
View File
@@ -1,5 +1,5 @@
/* mz_strm_pkcrypt.c -- Code for traditional PKWARE encryption
Version 2.3.4, June 19, 2018
Version 2.3.5, July 9, 2018
part of the MiniZip project
Copyright (C) 2010-2018 Nathan Moinvaziri
@@ -44,7 +44,7 @@
/***************************************************************************/
#define RAND_HEAD_LEN 12
#define RAND_HEAD_LEN (12)
/***************************************************************************/
@@ -315,6 +315,12 @@ int32_t mz_stream_pkcrypt_get_prop_int64(void *stream, int32_t prop, int64_t *va
case MZ_STREAM_PROP_TOTAL_OUT:
*value = pkcrypt->total_out;
return MZ_OK;
case MZ_STREAM_PROP_HEADER_SIZE:
*value = RAND_HEAD_LEN;
return MZ_OK;
case MZ_STREAM_PROP_FOOTER_SIZE:
*value = 0;
return MZ_OK;
}
return MZ_EXIST_ERROR;
}
+1 -9
View File
@@ -1,17 +1,9 @@
/* mz_strm_pkcrypt.h -- Code for traditional PKWARE encryption
Version 2.3.4, June 19, 2018
Version 2.3.5, July 9, 2018
part of the MiniZip project
Copyright (C) 2010-2018 Nathan Moinvaziri
https://github.com/nmoinvaz/minizip
Copyright (C) 1998-2005 Gilles Vollant
Modifications for Info-ZIP crypting
http://www.winimage.com/zLibDll/minizip.html
Copyright (C) 2003 Terry Thorsen
This code is a modified version of crypting code in Info-ZIP distribution
Copyright (C) 1990-2000 Info-ZIP. All rights reserved.
This program is distributed under the terms of the same license as zlib.
See the accompanying LICENSE file for the full text of the license.
+1 -1
View File
@@ -1,5 +1,5 @@
/* mz_strm_posix.c -- Stream for filesystem access for posix/linux
Version 2.3.4, June 19, 2018
Version 2.3.5, July 9, 2018
part of the MiniZip project
Copyright (C) 2010-2018 Nathan Moinvaziri
+1 -6
View File
@@ -1,14 +1,9 @@
/* mz_strm_posix.h -- Stream for filesystem access for posix/linux
Version 2.3.4, June 19, 2018
Version 2.3.5, July 9, 2018
part of the MiniZip project
Copyright (C) 2010-2018 Nathan Moinvaziri
https://github.com/nmoinvaz/minizip
Copyright (C) 2009-2010 Mathias Svensson
Modifications for Zip64 support
http://result42.com
Copyright (C) 1998-2010 Gilles Vollant
http://www.winimage.com/zLibDll/minizip.html
This program is distributed under the terms of the same license as zlib.
See the accompanying LICENSE file for the full text of the license.
+1 -1
View File
@@ -1,5 +1,5 @@
/* mz_strm_split.c -- Stream for split files
Version 2.3.4, June 19, 2018
Version 2.3.5, July 9, 2018
part of the MiniZip project
Copyright (C) 2010-2018 Nathan Moinvaziri
+1 -1
View File
@@ -1,5 +1,5 @@
/* mz_strm_split.h -- Stream for split files
Version 2.3.4, June 19, 2018
Version 2.3.5, July 9, 2018
part of MiniZip project
Copyright (C) 2010-2018 Nathan Moinvaziri
+1 -1
View File
@@ -1,5 +1,5 @@
/* mz_strm_win32.c -- Stream for filesystem access for windows
Version 2.3.4, June 19, 2018
Version 2.3.5, July 9, 2018
part of the MiniZip project
Copyright (C) 2010-2018 Nathan Moinvaziri
+1 -6
View File
@@ -1,14 +1,9 @@
/* mz_sstrm_win32.h -- Stream for filesystem access for windows
Version 2.3.4, June 19, 2018
Version 2.3.5, July 9, 2018
part of the MiniZip project
Copyright (C) 2010-2018 Nathan Moinvaziri
https://github.com/nmoinvaz/minizip
Copyright (C) 2009-2010 Mathias Svensson
Modifications for Zip64 support
http://result42.com
Copyright (C) 1998-2010 Gilles Vollant
http://www.winimage.com/zLibDll/minizip.html
This program is distributed under the terms of the same license as zlib.
See the accompanying LICENSE file for the full text of the license.
+9 -3
View File
@@ -1,5 +1,5 @@
/* mz_strm_zlib.c -- Stream for zlib inflate/deflate
Version 2.3.4, June 19, 2018
Version 2.3.5, July 9, 2018
part of the MiniZip project
Copyright (C) 2010-2018 Nathan Moinvaziri
@@ -308,8 +308,11 @@ int32_t mz_stream_zlib_close(void *stream)
#ifdef MZ_ZIP_DECOMPRESS_ONLY
return MZ_SUPPORT_ERROR;
#else
mz_stream_zlib_deflate(stream, Z_FINISH);
mz_stream_zlib_flush(stream);
if (zlib->total_in > 0)
{
mz_stream_zlib_deflate(stream, Z_FINISH);
mz_stream_zlib_flush(stream);
}
deflateEnd(&zlib->zstream);
#endif
@@ -344,6 +347,9 @@ int32_t mz_stream_zlib_get_prop_int64(void *stream, int32_t prop, int64_t *value
case MZ_STREAM_PROP_TOTAL_IN:
*value = zlib->total_in;
return MZ_OK;
case MZ_STREAM_PROP_TOTAL_IN_MAX:
*value = zlib->max_total_in;
return MZ_OK;
case MZ_STREAM_PROP_TOTAL_OUT:
*value = zlib->total_out;
return MZ_OK;
+1 -1
View File
@@ -1,5 +1,5 @@
/* mz_strm_zlib.h -- Stream for zlib inflate/deflate
Version 2.3.4, June 19, 2018
Version 2.3.5, July 9, 2018
part of the MiniZip project
Copyright (C) 2010-2018 Nathan Moinvaziri
+11 -8
View File
@@ -1,5 +1,5 @@
/* zip.c -- Zip manipulation
Version 2.3.4, June 19, 2018
Version 2.3.5, July 9, 2018
part of the MiniZip project
Copyright (C) 2010-2018 Nathan Moinvaziri
@@ -86,7 +86,6 @@ typedef struct mz_zip_s
uint16_t entry_scanned;
uint16_t entry_opened; // 1 if a file in the zip is currently writ.
uint64_t entry_read;
int64_t number_entry;
@@ -1075,7 +1074,7 @@ static int32_t mz_zip_entry_open_int(void *handle, int16_t compression_method, i
{
mz_zip *zip = (mz_zip *)handle;
int64_t max_total_in = 0;
int64_t total_in = 0;
int64_t header_size = 0;
int64_t footer_size = 0;
int32_t err = MZ_OK;
@@ -1185,10 +1184,13 @@ static int32_t mz_zip_entry_open_int(void *handle, int16_t compression_method, i
if (zip->compression_method == MZ_COMPRESS_METHOD_RAW || zip->file_info.flag & MZ_ZIP_FLAG_ENCRYPTED)
{
max_total_in = zip->file_info.compressed_size;
mz_stream_set_prop_int64(zip->crypt_stream, MZ_STREAM_PROP_TOTAL_IN_MAX, max_total_in);
if (mz_stream_get_prop_int64(zip->crypt_stream, MZ_STREAM_PROP_HEADER_SIZE, &header_size) == MZ_OK)
max_total_in -= header_size;
if (mz_stream_get_prop_int64(zip->crypt_stream, MZ_STREAM_PROP_FOOTER_SIZE, &footer_size) == MZ_OK)
max_total_in -= footer_size;
if (mz_stream_get_prop_int64(zip->crypt_stream, MZ_STREAM_PROP_TOTAL_IN, &total_in) == MZ_OK)
max_total_in -= total_in;
mz_stream_set_prop_int64(zip->compress_stream, MZ_STREAM_PROP_TOTAL_IN_MAX, max_total_in);
}
if (zip->compression_method == MZ_COMPRESS_METHOD_LZMA && (zip->file_info.flag & MZ_ZIP_FLAG_LZMA_EOS_MARKER) == 0)
@@ -1356,8 +1358,6 @@ extern int32_t mz_zip_entry_read(void *handle, void *buf, uint32_t len)
if (len == 0 || zip->file_info.uncompressed_size == 0)
return 0;
read = mz_stream_read(zip->crc32_stream, buf, len);
if (read > 0)
zip->entry_read += read;
return read;
}
@@ -1394,6 +1394,7 @@ extern int32_t mz_zip_entry_close_raw(void *handle, uint64_t uncompressed_size,
{
mz_zip *zip = (mz_zip *)handle;
uint64_t compressed_size = 0;
int64_t total_in = 0;
int32_t err = MZ_OK;
if (zip == NULL || zip->entry_opened == 0)
@@ -1410,7 +1411,9 @@ extern int32_t mz_zip_entry_close_raw(void *handle, uint64_t uncompressed_size,
if (zip->file_info.aes_version <= 0x0001)
#endif
{
if ((zip->entry_read > 0) && (zip->compression_method != MZ_COMPRESS_METHOD_RAW))
mz_stream_crc32_get_prop_int64(zip->crc32_stream, MZ_STREAM_PROP_TOTAL_IN, &total_in);
// If entire entry was not read this will fail
if ((total_in > 0) && (zip->compression_method != MZ_COMPRESS_METHOD_RAW))
{
if (crc32 != zip->file_info.crc)
err = MZ_CRC_ERROR;
+1 -1
View File
@@ -1,5 +1,5 @@
/* mz_zip.h -- Zip manipulation
Version 2.3.4, June 19, 2018
Version 2.3.5, July 9, 2018
part of the MiniZip project
Copyright (C) 2010-2018 Nathan Moinvaziri
View File