updated copyright
This commit is contained in:
@@ -913,12 +913,9 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
|
||||
+ (NSDate *)_dateWithMSDOSFormat:(UInt32)msdosDateTime
|
||||
{
|
||||
/*
|
||||
// the whole `_dateWithMSDOSFormat:` method is equivalent but faster than those four lines,
|
||||
// the whole `_dateWithMSDOSFormat:` method is equivalent but faster than this one line,
|
||||
// essentially because `mktime` is slow:
|
||||
struct tm ptm;
|
||||
dosdate_to_tm(msdosDateTime, &ptm);
|
||||
ptm.tm_year -= 1900;
|
||||
NSDate *date = [NSDate dateWithTimeIntervalSince1970:mktime(&ptm)];
|
||||
NSDate *date = [NSDate dateWithTimeIntervalSince1970:dosdate_to_time_t(msdosDateTime)];
|
||||
*/
|
||||
static const UInt32 kYearMask = 0xFE000000;
|
||||
static const UInt32 kMonthMask = 0x1E00000;
|
||||
|
||||
@@ -30,7 +30,8 @@ Issue Date: 20/12/2007
|
||||
#elif defined( __FreeBSD__ ) || defined( __OpenBSD__ ) || defined( __NetBSD__ )
|
||||
# include <sys/endian.h>
|
||||
#elif defined( BSD ) && ( BSD >= 199103 ) || defined( __APPLE__ ) || \
|
||||
defined( __CYGWIN32__ ) || defined( __DJGPP__ ) || defined( __osf__ )
|
||||
defined( __CYGWIN32__ ) || defined( __DJGPP__ ) || defined( __osf__ ) || \
|
||||
defined(__pnacl__)
|
||||
# include <machine/endian.h>
|
||||
#elif defined( __linux__ ) || defined( __GNUC__ ) || defined( __GNU_LIBRARY__ )
|
||||
# if !defined( __MINGW32__ ) && !defined( _AIX )
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
*/
|
||||
|
||||
#include <memory.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "fileenc.h"
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ This is an implementation of HMAC, the FIPS standard keyed hash function
|
||||
#define _HMAC2_H
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <memory.h>
|
||||
#include <string.h>
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C"
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
its location in memory.
|
||||
*/
|
||||
|
||||
#include <memory.h>
|
||||
#include <string.h>
|
||||
#include "prng.h"
|
||||
|
||||
#if defined(__cplusplus)
|
||||
|
||||
@@ -21,7 +21,7 @@ This is an implementation of RFC2898, which specifies key derivation from
|
||||
a password and a salt value.
|
||||
*/
|
||||
|
||||
#include <memory.h>
|
||||
#include <string.h>
|
||||
#include "hmac.h"
|
||||
|
||||
#if defined(__cplusplus)
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
/* crypt.c -- base code for traditional PKWARE encryption
|
||||
Version 1.01e, February 12th, 2005
|
||||
Version 1.2.0, September 16th, 2017
|
||||
|
||||
Copyright (C) 2012-2017 Nathan Moinvaziri
|
||||
https://github.com/nmoinvaz/minizip
|
||||
Copyright (C) 1998-2005 Gilles Vollant
|
||||
Modifications for Info-ZIP crypting
|
||||
Copyright (C) 2003 Terry Thorsen
|
||||
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
|
||||
|
||||
@@ -129,7 +132,7 @@ int cryptrand(unsigned char *buf, unsigned int len)
|
||||
return rlen;
|
||||
}
|
||||
|
||||
int crypthead(const char *passwd, uint8_t *buf, int buf_size, uint32_t *pkeys,
|
||||
int crypthead(const char *passwd, uint8_t *buf, int buf_size, uint32_t *pkeys,
|
||||
const z_crc_t *pcrc_32_tab, uint8_t verify1, uint8_t verify2)
|
||||
{
|
||||
uint8_t n = 0; /* index in random header */
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
/* crypt.h -- base code for traditional PKWARE encryption
|
||||
Version 1.01e, February 12th, 2005
|
||||
Version 1.2.0, September 16th, 2017
|
||||
|
||||
Copyright (C) 2012-2017 Nathan Moinvaziri
|
||||
https://github.com/nmoinvaz/minizip
|
||||
Copyright (C) 1998-2005 Gilles Vollant
|
||||
Modifications for Info-ZIP crypting
|
||||
Copyright (C) 2003 Terry Thorsen
|
||||
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
|
||||
|
||||
@@ -49,7 +52,7 @@ void init_keys(const char *passwd, uint32_t *pkeys, const z_crc_t *pcrc_32_tab);
|
||||
int cryptrand(unsigned char *buf, unsigned int len);
|
||||
|
||||
/* Create encryption header */
|
||||
int crypthead(const char *passwd, uint8_t *buf, int buf_size, uint32_t *pkeys,
|
||||
int crypthead(const char *passwd, uint8_t *buf, int buf_size, uint32_t *pkeys,
|
||||
const z_crc_t *pcrc_32_tab, uint8_t verify1, uint8_t verify2);
|
||||
|
||||
/***************************************************************************/
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
/* ioapi.c -- IO base function header for compress/uncompress .zip
|
||||
part of the MiniZip project
|
||||
|
||||
Copyright (C) 1998-2010 Gilles Vollant
|
||||
http://www.winimage.com/zLibDll/minizip.html
|
||||
Copyright (C) 2012-2017 Nathan Moinvaziri
|
||||
https://github.com/nmoinvaz/minizip
|
||||
Modifications for Zip64 support
|
||||
Copyright (C) 2009-2010 Mathias Svensson
|
||||
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,11 +1,13 @@
|
||||
/* ioapi.h -- IO base function header for compress/uncompress .zip
|
||||
part of the MiniZip project
|
||||
|
||||
Copyright (C) 2012-2017 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
|
||||
Modifications for Zip64 support
|
||||
Copyright (C) 2009-2010 Mathias Svensson
|
||||
http://result42.com
|
||||
|
||||
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.
|
||||
@@ -25,7 +27,7 @@
|
||||
# define ftello64 ftell
|
||||
# define fseeko64 fseek
|
||||
#else
|
||||
# if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || defined(__OpenBSD__) || defined(__APPLE__)
|
||||
# if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || defined(__OpenBSD__) || defined(__APPLE__) || defined(__ANDROID__)
|
||||
# define fopen64 fopen
|
||||
# define ftello64 ftello
|
||||
# define fseeko64 fseeko
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
#ifndef IOBUF_BUFFERSIZE
|
||||
# define IOBUF_BUFFERSIZE (UINT16_MAX)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
# include <conio.h>
|
||||
@@ -73,7 +73,7 @@ typedef struct ourstream_s {
|
||||
# define print_buf(o,s,f,...) print_buf_internal(o,s,f,__VA_ARGS__);
|
||||
#else
|
||||
# define print_buf(o,s,f,...)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void print_buf_internal(voidpf opaque, voidpf stream, char *format, ...)
|
||||
{
|
||||
@@ -137,7 +137,7 @@ long fflush_buf(voidpf opaque, voidpf stream)
|
||||
uint32_t bytes_to_write = streamio->writebuf_len;
|
||||
uint32_t bytes_left_to_write = streamio->writebuf_len;
|
||||
long bytes_written = 0;
|
||||
|
||||
|
||||
while (bytes_left_to_write > 0)
|
||||
{
|
||||
if (bufio->filefunc64.zwrite_file != NULL)
|
||||
@@ -264,7 +264,7 @@ uint32_t ZCALLBACK fwrite_buf_func(voidpf opaque, voidpf stream, const void *buf
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
memcpy(streamio->writebuf + streamio->writebuf_pos, (char *)buf + (bytes_to_write - bytes_left_to_write), bytes_to_copy);
|
||||
|
||||
print_buf(opaque, stream, "write copy [remaining %d write %d:%d len %d]\n", bytes_to_copy, bytes_to_write, bytes_left_to_write, streamio->writebuf_len);
|
||||
@@ -344,7 +344,7 @@ int fseek_buf_internal_func(voidpf opaque, voidpf stream, uint64_t offset, int o
|
||||
{
|
||||
streamio->readbuf_pos += (uint32_t)offset;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
offset -= (streamio->readbuf_len - streamio->readbuf_pos);
|
||||
streamio->position += offset;
|
||||
}
|
||||
@@ -419,7 +419,7 @@ int ZCALLBACK fclose_buf_func(voidpf opaque, voidpf stream)
|
||||
print_buf(opaque, stream, "write efficency %.02f%%\n", (streamio->writebuf_hits / ((float)streamio->writebuf_hits + streamio->writebuf_misses)) * 100);
|
||||
if (bufio->filefunc64.zclose_file != NULL)
|
||||
ret = bufio->filefunc64.zclose_file(bufio->filefunc64.opaque, streamio->stream);
|
||||
else
|
||||
else
|
||||
ret = bufio->filefunc.zclose_file(bufio->filefunc.opaque, streamio->stream);
|
||||
free(streamio);
|
||||
return ret;
|
||||
|
||||
@@ -11,8 +11,11 @@
|
||||
|
||||
Based on Unzip ioapi.c version 0.22, May 19th, 2003
|
||||
|
||||
Copyright (C) 2012-2017 Nathan Moinvaziri
|
||||
https://github.com/nmoinvaz/minizip
|
||||
Copyright (C) 2003 Justin Fletcher
|
||||
Copyright (C) 1998-2003 Gilles Vollant
|
||||
(C) 2003 Justin Fletcher
|
||||
http://www.winimage.com/zLibDll/minizip.html
|
||||
|
||||
This file is under the same license as the Unzip tool it is distributed
|
||||
with.
|
||||
@@ -30,14 +33,14 @@
|
||||
|
||||
#ifndef IOMEM_BUFFERSIZE
|
||||
# define IOMEM_BUFFERSIZE (UINT16_MAX)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
voidpf ZCALLBACK fopen_mem_func(voidpf opaque, const char *filename, int mode)
|
||||
{
|
||||
ourmemory_t *mem = (ourmemory_t *)opaque;
|
||||
if (mem == NULL)
|
||||
return NULL; /* Mem structure passed in was null */
|
||||
|
||||
|
||||
if (mode & ZLIB_FILEFUNC_MODE_CREATE)
|
||||
{
|
||||
if (mem->grow)
|
||||
@@ -128,7 +131,7 @@ long ZCALLBACK fseek_mem_func(voidpf opaque, voidpf stream, uint32_t offset, int
|
||||
case ZLIB_FILEFUNC_SEEK_SET:
|
||||
new_pos = offset;
|
||||
break;
|
||||
default:
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,8 +4,9 @@
|
||||
This version of ioapi is designed to access memory rather than files.
|
||||
We do use a region of memory to put data in to and take it out of.
|
||||
|
||||
Copyright (C) 1998-2003 Gilles Vollant
|
||||
Copyright (C) 2012-2017 Nathan Moinvaziri (https://github.com/nmoinvaz/minizip)
|
||||
(C) 2003 Justin Fletcher
|
||||
(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.
|
||||
|
||||
@@ -90,16 +90,13 @@ void change_file_date(const char *path, uint32_t dos_date)
|
||||
}
|
||||
#else
|
||||
struct utimbuf ut;
|
||||
struct tm newdate;
|
||||
|
||||
dosdate_to_tm(dos_date, &newdate);
|
||||
|
||||
ut.actime = ut.modtime = mktime(&newdate);
|
||||
ut.actime = ut.modtime = dosdate_to_time_t(dos_date);
|
||||
utime(path, &ut);
|
||||
#endif
|
||||
}
|
||||
|
||||
int dosdate_to_tm(uint64_t dos_date, struct tm *ptm)
|
||||
// convertion without validation
|
||||
void dosdate_to_raw_tm(uint64_t dos_date, struct tm *ptm)
|
||||
{
|
||||
uint64_t date = (uint64_t)(dos_date >> 16);
|
||||
|
||||
@@ -110,19 +107,28 @@ int dosdate_to_tm(uint64_t dos_date, struct tm *ptm)
|
||||
ptm->tm_min = (uint16_t)((dos_date & 0x7E0) / 0x20);
|
||||
ptm->tm_sec = (uint16_t)(2 * (dos_date & 0x1f));
|
||||
ptm->tm_isdst = -1;
|
||||
|
||||
}
|
||||
|
||||
int invalid_date(const struct tm *ptm)
|
||||
{
|
||||
#define datevalue_in_range(min, max, value) ((min) <= (value) && (value) <= (max))
|
||||
if (!datevalue_in_range(0, 11, ptm->tm_mon) ||
|
||||
!datevalue_in_range(1, 31, ptm->tm_mday) ||
|
||||
!datevalue_in_range(0, 23, ptm->tm_hour) ||
|
||||
!datevalue_in_range(0, 59, ptm->tm_min) ||
|
||||
!datevalue_in_range(0, 59, ptm->tm_sec))
|
||||
{
|
||||
/* Invalid date stored, so don't return it. */
|
||||
return (!datevalue_in_range(0, 11, ptm->tm_mon) ||
|
||||
!datevalue_in_range(1, 31, ptm->tm_mday) ||
|
||||
!datevalue_in_range(0, 23, ptm->tm_hour) ||
|
||||
!datevalue_in_range(0, 59, ptm->tm_min) ||
|
||||
!datevalue_in_range(0, 59, ptm->tm_sec));
|
||||
#undef datevalue_in_range
|
||||
}
|
||||
|
||||
int dosdate_to_tm(uint64_t dos_date, struct tm *ptm)
|
||||
{
|
||||
dosdate_to_raw_tm(dos_date, ptm);
|
||||
|
||||
if (invalid_date(ptm)) {
|
||||
// Invalid date stored, so don't return it.
|
||||
memset(ptm, 0, sizeof(struct tm));
|
||||
return -1;
|
||||
}
|
||||
#undef datevalue_in_range
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -139,11 +145,7 @@ uint32_t tm_to_dosdate(const struct tm *ptm)
|
||||
Due to the date format limitations, only years between 1980 and 2107 can be stored.
|
||||
*/
|
||||
if (!(datevalue_in_range(1980, 2107, ptm->tm_year) || datevalue_in_range(0, 207, ptm->tm_year)) ||
|
||||
!datevalue_in_range(0, 11, ptm->tm_mon) ||
|
||||
!datevalue_in_range(1, 31, ptm->tm_mday) ||
|
||||
!datevalue_in_range(0, 23, ptm->tm_hour) ||
|
||||
!datevalue_in_range(0, 59, ptm->tm_min) ||
|
||||
!datevalue_in_range(0, 59, ptm->tm_sec))
|
||||
invalid_date(ptm))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -161,6 +163,15 @@ uint32_t tm_to_dosdate(const struct tm *ptm)
|
||||
((ptm->tm_sec / 2) + (32 * ptm->tm_min) + (2048 * (uint32_t)ptm->tm_hour));
|
||||
}
|
||||
|
||||
time_t dosdate_to_time_t(uint64_t dos_date)
|
||||
{
|
||||
struct tm ptm;
|
||||
dosdate_to_raw_tm(dos_date, &ptm);
|
||||
// standard is year 1900 indexed struct tm, but dosdate_to_raw_tm returns a year 0 indexed struct tm
|
||||
ptm.tm_year %= 1900;
|
||||
return mktime(&ptm);
|
||||
}
|
||||
|
||||
int makedir(const char *newdir)
|
||||
{
|
||||
char *buffer = NULL;
|
||||
|
||||
@@ -27,6 +27,9 @@ int dosdate_to_tm(uint64_t dos_date, struct tm *ptm);
|
||||
/* Convert struct tm to dos date/time format */
|
||||
uint32_t tm_to_dosdate(const struct tm *ptm);
|
||||
|
||||
/* Convert dos date/time format to time_t */
|
||||
time_t dosdate_to_time_t(uint64_t dos_date);
|
||||
|
||||
/* Create a directory and all subdirectories */
|
||||
int makedir(const char *newdir);
|
||||
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
/* unzip.c -- IO for uncompress .zip files using zlib
|
||||
Version 1.1, February 14h, 2010
|
||||
Version 1.2.0, September 16th, 2017
|
||||
part of the MiniZip project
|
||||
|
||||
Copyright (C) 2010-2017 Nathan Moinvaziri
|
||||
Modifications for AES, PKWARE disk spanning
|
||||
https://github.com/nmoinvaz/minizip
|
||||
Copyright (C) 2009-2010 Mathias Svensson
|
||||
Modifications for Zip64 support on both zip and unzip
|
||||
http://result42.com
|
||||
Copyright (C) 2007-2008 Even Rouault
|
||||
Modifications of Unzip for Zip64
|
||||
Copyright (C) 1998-2010 Gilles Vollant
|
||||
http://www.winimage.com/zLibDll/minizip.html
|
||||
Modifications of Unzip for Zip64
|
||||
Copyright (C) 2007-2008 Even Rouault
|
||||
Modifications for Zip64 support on both zip and unzip
|
||||
Copyright (C) 2009-2010 Mathias Svensson
|
||||
http://result42.com
|
||||
Modifications for AES, PKWARE disk spanning
|
||||
Copyright (C) 2010-2014 Nathan Moinvaziri
|
||||
|
||||
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.
|
||||
@@ -73,8 +74,7 @@
|
||||
# define TRYFREE(p) {if (p) free(p);}
|
||||
#endif
|
||||
|
||||
const char unz_copyright[] =
|
||||
" unzip 1.01 Copyright 1998-2004 Gilles Vollant - http://www.winimage.com/zLibDll";
|
||||
const char unz_copyright[] = " unzip 1.2.0 Copyright 1998-2017 - https://github.com/nmoinvaz/minizip";
|
||||
|
||||
/* unz_file_info_internal contain internal info about a file in zipfile*/
|
||||
typedef struct unz_file_info64_internal_s
|
||||
@@ -354,9 +354,6 @@ static unzFile unzOpenInternal(const void *path, zlib_filefunc64_32_def *pzlib_f
|
||||
voidpf filestream = NULL;
|
||||
int err = UNZ_OK;
|
||||
|
||||
if (unz_copyright[0] != ' ')
|
||||
return NULL;
|
||||
|
||||
us.filestream = NULL;
|
||||
us.filestream_with_CD = NULL;
|
||||
us.z_filefunc.zseek32_file = NULL;
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
/* unzip.h -- IO for uncompress .zip files using zlib
|
||||
Version 1.1, February 14h, 2010
|
||||
Version 1.2.0, September 16th, 2017
|
||||
part of the MiniZip project
|
||||
|
||||
Copyright (C) 2012-2017 Nathan Moinvaziri
|
||||
https://github.com/nmoinvaz/minizip
|
||||
Copyright (C) 2009-2010 Mathias Svensson
|
||||
Modifications for Zip64 support on both zip and unzip
|
||||
http://result42.com
|
||||
Copyright (C) 2007-2008 Even Rouault
|
||||
Modifications of Unzip for Zip64
|
||||
Copyright (C) 1998-2010 Gilles Vollant
|
||||
http://www.winimage.com/zLibDll/minizip.html
|
||||
Modifications of Unzip for Zip64
|
||||
Copyright (C) 2007-2008 Even Rouault
|
||||
Modifications for Zip64 support on both zip and unzip
|
||||
Copyright (C) 2009-2010 Mathias Svensson
|
||||
http://result42.com
|
||||
|
||||
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,14 +1,15 @@
|
||||
/* zip.c -- IO on .zip files using zlib
|
||||
Version 1.1, February 14h, 2010
|
||||
Version 1.2.0, September 16th, 2017
|
||||
part of the MiniZip project
|
||||
|
||||
Copyright (C) 2010-2017 Nathan Moinvaziri
|
||||
Modifications for AES, PKWARE disk spanning
|
||||
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
|
||||
Modifications for Zip64 support
|
||||
Copyright (C) 2009-2010 Mathias Svensson
|
||||
http://result42.com
|
||||
Modifications for AES, PKWARE disk spanning
|
||||
Copyright (C) 2010-2014 Nathan Moinvaziri
|
||||
|
||||
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.
|
||||
@@ -912,7 +913,7 @@ extern zipFile ZEXPORT zipOpen64(const void *path, int append)
|
||||
extern int ZEXPORT zipOpenNewFileInZip4_64(zipFile file, const char *filename, const zip_fileinfo *zipfi,
|
||||
const void *extrafield_local, uint16_t size_extrafield_local, const void *extrafield_global,
|
||||
uint16_t size_extrafield_global, const char *comment, uint16_t method, int level, int raw, int windowBits, int memLevel,
|
||||
int strategy, const char *password, uint32_t crc_for_crypting, uint16_t version_madeby, uint16_t flag_base, int zip64)
|
||||
int strategy, const char *password, ZIP_UNUSED uint32_t crc_for_crypting, uint16_t version_madeby, uint16_t flag_base, int zip64)
|
||||
{
|
||||
zip64_internal *zi = NULL;
|
||||
uint64_t size_available = 0;
|
||||
@@ -924,7 +925,6 @@ extern int ZEXPORT zipOpenNewFileInZip4_64(zipFile file, const char *filename, c
|
||||
int err = ZIP_OK;
|
||||
|
||||
#ifdef NOCRYPT
|
||||
(crc_for_crypting);
|
||||
if (password != NULL)
|
||||
return ZIP_PARAMERROR;
|
||||
#endif
|
||||
@@ -1237,10 +1237,7 @@ extern int ZEXPORT zipOpenNewFileInZip4_64(zipFile file, const char *filename, c
|
||||
/*
|
||||
Info-ZIP modification to ZipCrypto format:
|
||||
If bit 3 of the general purpose bit flag is set, it uses high byte of 16-bit File Time.
|
||||
|
||||
verify1 = (uint8_t)((crc_for_crypting >> 16) & 0xff);
|
||||
verify2 = (uint8_t)((crc_for_crypting >> 24) & 0xff); */
|
||||
|
||||
*/
|
||||
verify1 = (uint8_t)((zi->ci.dos_date >> 16) & 0xff);
|
||||
verify2 = (uint8_t)((zi->ci.dos_date >> 8) & 0xff);
|
||||
|
||||
@@ -1261,7 +1258,7 @@ extern int ZEXPORT zipOpenNewFileInZip4_64(zipFile file, const char *filename, c
|
||||
extern int ZEXPORT zipOpenNewFileInZip4(zipFile file, const char *filename, const zip_fileinfo *zipfi,
|
||||
const void *extrafield_local, uint16_t size_extrafield_local, const void *extrafield_global,
|
||||
uint16_t size_extrafield_global, const char *comment, uint16_t method, int level, int raw, int windowBits,
|
||||
int memLevel, int strategy, const char *password, uint32_t crc_for_crypting, uint16_t version_madeby, uint16_t flag_base)
|
||||
int memLevel, int strategy, const char *password, ZIP_UNUSED uint32_t crc_for_crypting, uint16_t version_madeby, uint16_t flag_base)
|
||||
{
|
||||
return zipOpenNewFileInZip4_64(file, filename, zipfi, extrafield_local, size_extrafield_local,
|
||||
extrafield_global, size_extrafield_global, comment, method, level, raw, windowBits, memLevel,
|
||||
@@ -1271,7 +1268,7 @@ extern int ZEXPORT zipOpenNewFileInZip4(zipFile file, const char *filename, cons
|
||||
extern int ZEXPORT zipOpenNewFileInZip3(zipFile file, const char *filename, const zip_fileinfo *zipfi,
|
||||
const void *extrafield_local, uint16_t size_extrafield_local, const void *extrafield_global,
|
||||
uint16_t size_extrafield_global, const char *comment, uint16_t method, int level, int raw, int windowBits,
|
||||
int memLevel, int strategy, const char *password, uint32_t crc_for_crypting)
|
||||
int memLevel, int strategy, const char *password, ZIP_UNUSED uint32_t crc_for_crypting)
|
||||
{
|
||||
return zipOpenNewFileInZip4_64(file, filename, zipfi, extrafield_local, size_extrafield_local,
|
||||
extrafield_global, size_extrafield_global, comment, method, level, raw, windowBits, memLevel,
|
||||
@@ -1281,7 +1278,7 @@ extern int ZEXPORT zipOpenNewFileInZip3(zipFile file, const char *filename, cons
|
||||
extern int ZEXPORT zipOpenNewFileInZip3_64(zipFile file, const char *filename, const zip_fileinfo *zipfi,
|
||||
const void *extrafield_local, uint16_t size_extrafield_local, const void *extrafield_global,
|
||||
uint16_t size_extrafield_global, const char *comment, uint16_t method, int level, int raw, int windowBits,
|
||||
int memLevel, int strategy, const char *password, uint32_t crc_for_crypting, int zip64)
|
||||
int memLevel, int strategy, const char *password, ZIP_UNUSED uint32_t crc_for_crypting, int zip64)
|
||||
{
|
||||
return zipOpenNewFileInZip4_64(file, filename, zipfi, extrafield_local, size_extrafield_local,
|
||||
extrafield_global, size_extrafield_global, comment, method, level, raw, windowBits, memLevel, strategy,
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
/* zip.h -- IO on .zip files using zlib
|
||||
Version 1.1, February 14h, 2010
|
||||
Version 1.2.0, September 16th, 2017
|
||||
part of the MiniZip project
|
||||
|
||||
Copyright (C) 2012-2017 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
|
||||
Modifications for Zip64 support
|
||||
Copyright (C) 2009-2010 Mathias Svensson
|
||||
http://result42.com
|
||||
|
||||
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.
|
||||
@@ -51,6 +53,12 @@ typedef voidp zipFile;
|
||||
#define ZIP_BADZIPFILE (-103)
|
||||
#define ZIP_INTERNALERROR (-104)
|
||||
|
||||
#ifdef __GNUC__
|
||||
# define ZIP_UNUSED __attribute__((__unused__))
|
||||
#else
|
||||
# define ZIP_UNUSED
|
||||
#endif
|
||||
|
||||
#ifndef DEF_MEM_LEVEL
|
||||
# if MAX_MEM_LEVEL >= 8
|
||||
# define DEF_MEM_LEVEL 8
|
||||
@@ -140,28 +148,28 @@ extern int ZEXPORT zipOpenNewFileInZip2_64(zipFile file, const char *filename, c
|
||||
extern int ZEXPORT zipOpenNewFileInZip3(zipFile file, const char *filename, const zip_fileinfo *zipfi,
|
||||
const void *extrafield_local, uint16_t size_extrafield_local, const void *extrafield_global,
|
||||
uint16_t size_extrafield_global, const char *comment, uint16_t method, int level, int raw, int windowBits, int memLevel,
|
||||
int strategy, const char *password, uint32_t crcForCrypting);
|
||||
int strategy, const char *password, ZIP_UNUSED uint32_t crc_for_crypting);
|
||||
/* Same as zipOpenNewFileInZip2, except
|
||||
windowBits, memLevel, strategy : see parameter strategy in deflateInit2
|
||||
password : crypting password (NULL for no crypting)
|
||||
crcForCrypting : crc of file to compress (needed for crypting) */
|
||||
crc_for_crypting : crc of file to compress (needed for crypting) */
|
||||
|
||||
extern int ZEXPORT zipOpenNewFileInZip3_64(zipFile file, const char *filename, const zip_fileinfo *zipfi,
|
||||
const void *extrafield_local, uint16_t size_extrafield_local, const void *extrafield_global,
|
||||
uint16_t size_extrafield_global, const char *comment, uint16_t method, int level, int raw, int windowBits, int memLevel,
|
||||
int strategy, const char *password, uint32_t crc_for_crypting, int zip64);
|
||||
int strategy, const char *password, ZIP_UNUSED uint32_t crc_for_crypting, int zip64);
|
||||
/* Same as zipOpenNewFileInZip3 with zip64 support */
|
||||
|
||||
extern int ZEXPORT zipOpenNewFileInZip4(zipFile file, const char *filename, const zip_fileinfo *zipfi,
|
||||
const void *extrafield_local, uint16_t size_extrafield_local, const void *extrafield_global,
|
||||
uint16_t size_extrafield_global, const char *comment, uint16_t method, int level, int raw, int windowBits, int memLevel,
|
||||
int strategy, const char *password, uint32_t crc_for_crypting, uint16_t version_madeby, uint16_t flag_base);
|
||||
int strategy, const char *password, ZIP_UNUSED uint32_t crc_for_crypting, uint16_t version_madeby, uint16_t flag_base);
|
||||
/* Same as zipOpenNewFileInZip3 except versionMadeBy & flag fields */
|
||||
|
||||
extern int ZEXPORT zipOpenNewFileInZip4_64(zipFile file, const char *filename, const zip_fileinfo *zipfi,
|
||||
const void *extrafield_local, uint16_t size_extrafield_local, const void *extrafield_global,
|
||||
uint16_t size_extrafield_global, const char *comment, uint16_t method, int level, int raw, int windowBits, int memLevel,
|
||||
int strategy, const char *password, uint32_t crc_for_crypting, uint16_t version_madeby, uint16_t flag_base, int zip64);
|
||||
int strategy, const char *password, ZIP_UNUSED uint32_t crc_for_crypting, uint16_t version_madeby, uint16_t flag_base, int zip64);
|
||||
/* Same as zipOpenNewFileInZip4 with zip64 support */
|
||||
|
||||
extern int ZEXPORT zipWriteInFileInZip(zipFile file, const void *buf, uint32_t len);
|
||||
|
||||
Reference in New Issue
Block a user