summaryrefslogtreecommitdiff
path: root/thirdparty/minizip
diff options
context:
space:
mode:
Diffstat (limited to 'thirdparty/minizip')
-rw-r--r--thirdparty/minizip/crypt.h19
-rw-r--r--thirdparty/minizip/ioapi.c18
-rw-r--r--thirdparty/minizip/ioapi.h8
-rw-r--r--thirdparty/minizip/patches/godot-seek.patch (renamed from thirdparty/minizip/godot-zlib-1.2.4-minizip-seek.patch)63
-rw-r--r--thirdparty/minizip/patches/unbreak-gentoo.patch (renamed from thirdparty/minizip/godot-zlib-1.2.4-minizip-unbreak-gentoo.patch)0
-rw-r--r--thirdparty/minizip/unzip.c60
-rw-r--r--thirdparty/minizip/unzip.h12
-rw-r--r--thirdparty/minizip/zip.c36
-rw-r--r--thirdparty/minizip/zip.h17
9 files changed, 128 insertions, 105 deletions
diff --git a/thirdparty/minizip/crypt.h b/thirdparty/minizip/crypt.h
index 1e9e8200b2..9da15373d8 100644
--- a/thirdparty/minizip/crypt.h
+++ b/thirdparty/minizip/crypt.h
@@ -38,6 +38,7 @@ static int decrypt_byte(unsigned long* pkeys, const z_crc_t* pcrc_32_tab)
* unpredictable manner on 16-bit systems; not a problem
* with any known compiler so far, though */
+ (void)pcrc_32_tab;
temp = ((unsigned)(*(pkeys+2)) & 0xffff) | 2;
return (int)(((temp * (temp ^ 1)) >> 8) & 0xff);
}
@@ -77,24 +78,24 @@ static void init_keys(const char* passwd,unsigned long* pkeys,const z_crc_t* pcr
(update_keys(pkeys,pcrc_32_tab,c ^= decrypt_byte(pkeys,pcrc_32_tab)))
#define zencode(pkeys,pcrc_32_tab,c,t) \
- (t=decrypt_byte(pkeys,pcrc_32_tab), update_keys(pkeys,pcrc_32_tab,c), t^(c))
+ (t=decrypt_byte(pkeys,pcrc_32_tab), update_keys(pkeys,pcrc_32_tab,c), (Byte)t^(c))
#ifdef INCLUDECRYPTINGCODE_IFCRYPTALLOWED
#define RAND_HEAD_LEN 12
/* "last resort" source for second part of crypt seed pattern */
# ifndef ZCR_SEED2
-# define ZCR_SEED2 3141592654UL /* use PI as default pattern */
+# define ZCR_SEED2 3141592654L /* use PI as default pattern */
# endif
-static int crypthead(const char* passwd, /* password string */
- unsigned char* buf, /* where to write header */
- int bufSize,
- unsigned long* pkeys,
- const z_crc_t* pcrc_32_tab,
- unsigned long crcForCrypting)
+static unsigned crypthead(const char* passwd, /* password string */
+ unsigned char* buf, /* where to write header */
+ int bufSize,
+ unsigned long* pkeys,
+ const z_crc_t* pcrc_32_tab,
+ unsigned long crcForCrypting)
{
- int n; /* index in random header */
+ unsigned n; /* index in random header */
int t; /* temporary */
int c; /* random byte */
unsigned char header[RAND_HEAD_LEN-2]; /* random header */
diff --git a/thirdparty/minizip/ioapi.c b/thirdparty/minizip/ioapi.c
index 9cb27c16db..db4c33b4b9 100644
--- a/thirdparty/minizip/ioapi.c
+++ b/thirdparty/minizip/ioapi.c
@@ -58,7 +58,7 @@ ZPOS64_T call_ztell64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream
return (*(pfilefunc->zfile_func64.ztell64_file)) (pfilefunc->zfile_func64.opaque,filestream);
else
{
- uLong tell_uLong = (*(pfilefunc->ztell32_file))(pfilefunc->zfile_func64.opaque,filestream);
+ uLong tell_uLong = (uLong)(*(pfilefunc->ztell32_file))(pfilefunc->zfile_func64.opaque,filestream);
if ((tell_uLong) == MAXU32)
return (ZPOS64_T)-1;
else
@@ -101,6 +101,7 @@ static int ZCALLBACK ferror_file_func OF((voidpf opaque, voidpf stream));
static voidpf ZCALLBACK fopen_file_func (voidpf opaque, const char* filename, int mode)
{
+ (void)opaque;
FILE* file = NULL;
const char* mode_fopen = NULL;
if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ)
@@ -119,6 +120,7 @@ static voidpf ZCALLBACK fopen_file_func (voidpf opaque, const char* filename, in
static voidpf ZCALLBACK fopen64_file_func (voidpf opaque, const void* filename, int mode)
{
+ (void)opaque;
FILE* file = NULL;
const char* mode_fopen = NULL;
if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ)
@@ -138,6 +140,7 @@ static voidpf ZCALLBACK fopen64_file_func (voidpf opaque, const void* filename,
static uLong ZCALLBACK fread_file_func (voidpf opaque, voidpf stream, void* buf, uLong size)
{
+ (void)opaque;
uLong ret;
ret = (uLong)fread(buf, 1, (size_t)size, (FILE *)stream);
return ret;
@@ -145,6 +148,7 @@ static uLong ZCALLBACK fread_file_func (voidpf opaque, voidpf stream, void* buf,
static uLong ZCALLBACK fwrite_file_func (voidpf opaque, voidpf stream, const void* buf, uLong size)
{
+ (void)opaque;
uLong ret;
ret = (uLong)fwrite(buf, 1, (size_t)size, (FILE *)stream);
return ret;
@@ -152,6 +156,7 @@ static uLong ZCALLBACK fwrite_file_func (voidpf opaque, voidpf stream, const voi
static long ZCALLBACK ftell_file_func (voidpf opaque, voidpf stream)
{
+ (void)opaque;
long ret;
ret = ftell((FILE *)stream);
return ret;
@@ -160,13 +165,15 @@ static long ZCALLBACK ftell_file_func (voidpf opaque, voidpf stream)
static ZPOS64_T ZCALLBACK ftell64_file_func (voidpf opaque, voidpf stream)
{
+ (void)opaque;
ZPOS64_T ret;
- ret = FTELLO_FUNC((FILE *)stream);
+ ret = (ZPOS64_T)FTELLO_FUNC((FILE *)stream);
return ret;
}
static long ZCALLBACK fseek_file_func (voidpf opaque, voidpf stream, uLong offset, int origin)
{
+ (void)opaque;
int fseek_origin=0;
long ret;
switch (origin)
@@ -183,13 +190,14 @@ static long ZCALLBACK fseek_file_func (voidpf opaque, voidpf stream, uLong offs
default: return -1;
}
ret = 0;
- if (fseek((FILE *)stream, offset, fseek_origin) != 0)
+ if (fseek((FILE *)stream, (long)offset, fseek_origin) != 0)
ret = -1;
return ret;
}
static long ZCALLBACK fseek64_file_func (voidpf opaque, voidpf stream, ZPOS64_T offset, int origin)
{
+ (void)opaque;
int fseek_origin=0;
long ret;
switch (origin)
@@ -207,7 +215,7 @@ static long ZCALLBACK fseek64_file_func (voidpf opaque, voidpf stream, ZPOS64_T
}
ret = 0;
- if(FSEEKO_FUNC((FILE *)stream, offset, fseek_origin) != 0)
+ if(FSEEKO_FUNC((FILE *)stream, (long)offset, fseek_origin) != 0)
ret = -1;
return ret;
@@ -216,6 +224,7 @@ static long ZCALLBACK fseek64_file_func (voidpf opaque, voidpf stream, ZPOS64_T
static int ZCALLBACK fclose_file_func (voidpf opaque, voidpf stream)
{
+ (void)opaque;
int ret;
ret = fclose((FILE *)stream);
return ret;
@@ -223,6 +232,7 @@ static int ZCALLBACK fclose_file_func (voidpf opaque, voidpf stream)
static int ZCALLBACK ferror_file_func (voidpf opaque, voidpf stream)
{
+ (void)opaque;
int ret;
ret = ferror((FILE *)stream);
return ret;
diff --git a/thirdparty/minizip/ioapi.h b/thirdparty/minizip/ioapi.h
index 4011e9cabb..e9e5899852 100644
--- a/thirdparty/minizip/ioapi.h
+++ b/thirdparty/minizip/ioapi.h
@@ -107,8 +107,7 @@ typedef 64BIT_INT_CUSTOM_TYPE ZPOS64_T;
typedef uint64_t ZPOS64_T;
#else
-/* Maximum unsigned 32-bit value used as placeholder for zip64 */
-#define MAXU32 0xffffffff
+
#if defined(_MSC_VER) || defined(__BORLANDC__)
typedef unsigned __int64 ZPOS64_T;
@@ -118,7 +117,10 @@ typedef unsigned long long int ZPOS64_T;
#endif
#endif
-
+/* Maximum unsigned 32-bit value used as placeholder for zip64 */
+#ifndef MAXU32
+#define MAXU32 (0xffffffff)
+#endif
#ifdef __cplusplus
extern "C" {
diff --git a/thirdparty/minizip/godot-zlib-1.2.4-minizip-seek.patch b/thirdparty/minizip/patches/godot-seek.patch
index 2162bafbbc..24838c252a 100644
--- a/thirdparty/minizip/godot-zlib-1.2.4-minizip-seek.patch
+++ b/thirdparty/minizip/patches/godot-seek.patch
@@ -1,8 +1,8 @@
diff --git a/thirdparty/minizip/ioapi.c b/thirdparty/minizip/ioapi.c
-index 49958f61f..0afbdc06a 100644
+index d666e5a228..db4c33b4b9 100644
--- a/thirdparty/minizip/ioapi.c
+++ b/thirdparty/minizip/ioapi.c
-@@ -68,8 +68,15 @@ void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filef
+@@ -80,8 +80,15 @@ void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filef
p_filefunc64_32->zfile_func64.opaque = p_filefunc32->opaque;
p_filefunc64_32->zseek32_file = p_filefunc32->zseek_file;
p_filefunc64_32->ztell32_file = p_filefunc32->ztell_file;
@@ -18,7 +18,7 @@ index 49958f61f..0afbdc06a 100644
static voidpf ZCALLBACK fopen_file_func OF((voidpf opaque, const char* filename, int mode));
-@@ -233,3 +240,6 @@ void fill_fopen64_filefunc (zlib_filefunc64_def* pzlib_filefunc_def)
+@@ -255,3 +262,6 @@ void fill_fopen64_filefunc (zlib_filefunc64_def* pzlib_filefunc_def)
pzlib_filefunc_def->zerror_file = ferror_file_func;
pzlib_filefunc_def->opaque = NULL;
}
@@ -26,10 +26,10 @@ index 49958f61f..0afbdc06a 100644
+*/
+/* GODOT end */
diff --git a/thirdparty/minizip/ioapi.h b/thirdparty/minizip/ioapi.h
-index 8309c4cf8..f25ab6464 100644
+index 114bfab762..2f24a5b6a0 100644
--- a/thirdparty/minizip/ioapi.h
+++ b/thirdparty/minizip/ioapi.h
-@@ -145,6 +145,10 @@ typedef struct zlib_filefunc_def_s
+@@ -155,6 +155,10 @@ typedef struct zlib_filefunc_def_s
close_file_func zclose_file;
testerror_file_func zerror_file;
voidpf opaque;
@@ -40,7 +40,7 @@ index 8309c4cf8..f25ab6464 100644
} zlib_filefunc_def;
typedef ZPOS64_T (ZCALLBACK *tell64_file_func) OF((voidpf opaque, voidpf stream));
-@@ -161,6 +165,10 @@ typedef struct zlib_filefunc64_def_s
+@@ -171,6 +175,10 @@ typedef struct zlib_filefunc64_def_s
close_file_func zclose_file;
testerror_file_func zerror_file;
voidpf opaque;
@@ -52,7 +52,7 @@ index 8309c4cf8..f25ab6464 100644
void fill_fopen64_filefunc OF((zlib_filefunc64_def* pzlib_filefunc_def));
diff --git a/thirdparty/minizip/unzip.c b/thirdparty/minizip/unzip.c
-index 7617f41f1..32e27bd65 100644
+index 5e12e47474..3b191e827c 100644
--- a/thirdparty/minizip/unzip.c
+++ b/thirdparty/minizip/unzip.c
@@ -157,6 +157,9 @@ typedef struct
@@ -98,32 +98,31 @@ index 7617f41f1..32e27bd65 100644
/*
Close a ZipFile opened with unzOpen.
If there is files inside the .Zip opened with unzOpenCurrentFile (see later),
-@@ -1018,10 +1034,20 @@ local int unz64local_GetCurrentFileInfoInternal (unzFile file,
+@@ -1018,10 +1034,23 @@ local int unz64local_GetCurrentFileInfoInternal (unzFile file,
if (lSeek!=0)
{
-- if (ZSEEK64(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
-- lSeek=0;
-- else
-- err=UNZ_ERRNO;
+ /* GODOT start */
+ if (lSeek<0) {
+ // WORKAROUND for backwards seeking
-+ z_off_t pos = ZTELL64(s->z_filefunc, s->filestream);
-+ if (ZSEEK64(s->z_filefunc, s->filestream,pos+lSeek,ZLIB_FILEFUNC_SEEK_SET)==0)
++ ZPOS64_T pos = ZTELL64(s->z_filefunc, s->filestream);
++ if (ZSEEK64(s->z_filefunc, s->filestream,pos+(ZPOS64_T)lSeek,ZLIB_FILEFUNC_SEEK_SET)==0)
+ lSeek=0;
+ else
+ err=UNZ_ERRNO;
+ } else {
-+ if (ZSEEK64(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
-+ lSeek=0;
-+ else
-+ err=UNZ_ERRNO;
++ /* GODOT end */
+ if (ZSEEK64(s->z_filefunc, s->filestream,(ZPOS64_T)lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
+ lSeek=0;
+ else
+ err=UNZ_ERRNO;
++ /* GODOT start */
+ }
++ /* GODOT end */
}
while(acc < file_info.size_file_extra)
-@@ -1575,8 +1601,10 @@ extern int ZEXPORT unzOpenCurrentFile3 (unzFile file, int* method,
+@@ -1575,8 +1604,10 @@ extern int ZEXPORT unzOpenCurrentFile3 (unzFile file, int* method,
}
else if ((s->cur_file_info.compression_method==Z_DEFLATED) && (!raw))
{
@@ -136,7 +135,7 @@ index 7617f41f1..32e27bd65 100644
pfile_in_zip_read_info->stream.opaque = (voidpf)0;
pfile_in_zip_read_info->stream.next_in = 0;
pfile_in_zip_read_info->stream.avail_in = 0;
-@@ -1608,6 +1636,9 @@ extern int ZEXPORT unzOpenCurrentFile3 (unzFile file, int* method,
+@@ -1608,6 +1639,9 @@ extern int ZEXPORT unzOpenCurrentFile3 (unzFile file, int* method,
iSizeVar;
pfile_in_zip_read_info->stream.avail_in = (uInt)0;
@@ -146,7 +145,7 @@ index 7617f41f1..32e27bd65 100644
s->pfile_in_zip_read = pfile_in_zip_read_info;
s->encrypted = 0;
-@@ -1638,6 +1669,85 @@ extern int ZEXPORT unzOpenCurrentFile3 (unzFile file, int* method,
+@@ -1638,6 +1672,85 @@ extern int ZEXPORT unzOpenCurrentFile3 (unzFile file, int* method,
return UNZ_OK;
}
@@ -165,7 +164,7 @@ index 7617f41f1..32e27bd65 100644
+
+ if (pfile_in_zip_read_info->compression_method==Z_BZIP2ED) { // don't know how to support bzip
+ return UNZ_INTERNALERROR;
-+ };
++ }
+
+ if ((pfile_in_zip_read_info->compression_method==0) || (pfile_in_zip_read_info->raw)) {
+
@@ -204,7 +203,7 @@ index 7617f41f1..32e27bd65 100644
+ pfile_in_zip_read_info->stream.avail_in = (uInt)0;
+ pfile_in_zip_read_info->stream.total_out = 0;
+ pfile_in_zip_read_info->stream.next_in = 0;
-+ };
++ }
+
+ // not sure where to read, so read on the stack
+ {
@@ -216,24 +215,24 @@ index 7617f41f1..32e27bd65 100644
+ int read = unzReadCurrentFile(file, buf, len);
+ if (read < 0) {
+ return read;
-+ };
++ }
+ to_read -= read;
+ if (read == UNZ_EOF) {
+ return pos;
-+ };
-+ };
-+ };
-+ };
++ }
++ }
++ }
++ }
+
+ return pos;
-+};
++}
+/* GODOT end */
+
extern int ZEXPORT unzOpenCurrentFile (unzFile file)
{
return unzOpenCurrentFile3(file, NULL, NULL, 0, NULL);
diff --git a/thirdparty/minizip/unzip.h b/thirdparty/minizip/unzip.h
-index 3183968b7..54e65ad8a 100644
+index 6f95e94d75..71a7d89692 100644
--- a/thirdparty/minizip/unzip.h
+++ b/thirdparty/minizip/unzip.h
@@ -202,6 +202,10 @@ extern int ZEXPORT unzClose OF((unzFile file));
@@ -262,7 +261,7 @@ index 3183968b7..54e65ad8a 100644
extern ZPOS64_T ZEXPORT unztell64 OF((unzFile file));
diff --git a/thirdparty/minizip/zip.c b/thirdparty/minizip/zip.c
-index 3c34fc8bd..d7093e745 100644
+index 4e611e1163..6d1c26d9f8 100644
--- a/thirdparty/minizip/zip.c
+++ b/thirdparty/minizip/zip.c
@@ -854,9 +854,11 @@ extern zipFile ZEXPORT zipOpen3 (const void *pathname, int append, zipcharpc* gl
@@ -280,7 +279,7 @@ index 3c34fc8bd..d7093e745 100644
ziinit.z_filefunc = *pzlib_filefunc64_32_def;
ziinit.filestream = ZOPEN64(ziinit.z_filefunc,
-@@ -1210,8 +1212,10 @@ extern int ZEXPORT zipOpenNewFileInZip4_64 (zipFile file, const char* filename,
+@@ -1211,8 +1213,10 @@ extern int ZEXPORT zipOpenNewFileInZip4_64 (zipFile file, const char* filename,
{
if(zi->ci.method == Z_DEFLATED)
{
diff --git a/thirdparty/minizip/godot-zlib-1.2.4-minizip-unbreak-gentoo.patch b/thirdparty/minizip/patches/unbreak-gentoo.patch
index 9292e32ac6..9292e32ac6 100644
--- a/thirdparty/minizip/godot-zlib-1.2.4-minizip-unbreak-gentoo.patch
+++ b/thirdparty/minizip/patches/unbreak-gentoo.patch
diff --git a/thirdparty/minizip/unzip.c b/thirdparty/minizip/unzip.c
index 31f8a5ff47..3b191e827c 100644
--- a/thirdparty/minizip/unzip.c
+++ b/thirdparty/minizip/unzip.c
@@ -458,7 +458,7 @@ local ZPOS64_T unz64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_f
if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) &&
((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06))
{
- uPosFound = uReadPos+i;
+ uPosFound = uReadPos+(unsigned)i;
break;
}
@@ -526,7 +526,7 @@ local ZPOS64_T unz64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib
if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) &&
((*(buf+i+2))==0x06) && ((*(buf+i+3))==0x07))
{
- uPosFound = uReadPos+i;
+ uPosFound = uReadPos+(unsigned)i;
break;
}
@@ -869,13 +869,13 @@ local void unz64local_DosDateToTmuDate (ZPOS64_T ulDosDate, tm_unz* ptm)
{
ZPOS64_T uDate;
uDate = (ZPOS64_T)(ulDosDate>>16);
- ptm->tm_mday = (uInt)(uDate&0x1f) ;
- ptm->tm_mon = (uInt)((((uDate)&0x1E0)/0x20)-1) ;
- ptm->tm_year = (uInt)(((uDate&0x0FE00)/0x0200)+1980) ;
+ ptm->tm_mday = (int)(uDate&0x1f) ;
+ ptm->tm_mon = (int)((((uDate)&0x1E0)/0x20)-1) ;
+ ptm->tm_year = (int)(((uDate&0x0FE00)/0x0200)+1980) ;
- ptm->tm_hour = (uInt) ((ulDosDate &0xF800)/0x800);
- ptm->tm_min = (uInt) ((ulDosDate&0x7E0)/0x20) ;
- ptm->tm_sec = (uInt) (2*(ulDosDate&0x1f)) ;
+ ptm->tm_hour = (int) ((ulDosDate &0xF800)/0x800);
+ ptm->tm_min = (int) ((ulDosDate&0x7E0)/0x20) ;
+ ptm->tm_sec = (int) (2*(ulDosDate&0x1f)) ;
}
/*
@@ -1009,7 +1009,7 @@ local int unz64local_GetCurrentFileInfoInternal (unzFile file,
if (lSeek!=0)
{
- if (ZSEEK64(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
+ if (ZSEEK64(s->z_filefunc, s->filestream,(ZPOS64_T)lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
lSeek=0;
else
err=UNZ_ERRNO;
@@ -1037,17 +1037,20 @@ local int unz64local_GetCurrentFileInfoInternal (unzFile file,
/* GODOT start */
if (lSeek<0) {
// WORKAROUND for backwards seeking
- z_off_t pos = ZTELL64(s->z_filefunc, s->filestream);
- if (ZSEEK64(s->z_filefunc, s->filestream,pos+lSeek,ZLIB_FILEFUNC_SEEK_SET)==0)
+ ZPOS64_T pos = ZTELL64(s->z_filefunc, s->filestream);
+ if (ZSEEK64(s->z_filefunc, s->filestream,pos+(ZPOS64_T)lSeek,ZLIB_FILEFUNC_SEEK_SET)==0)
lSeek=0;
else
err=UNZ_ERRNO;
} else {
- if (ZSEEK64(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
- lSeek=0;
- else
- err=UNZ_ERRNO;
+ /* GODOT end */
+ if (ZSEEK64(s->z_filefunc, s->filestream,(ZPOS64_T)lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
+ lSeek=0;
+ else
+ err=UNZ_ERRNO;
+ /* GODOT start */
}
+ /* GODOT end */
}
while(acc < file_info.size_file_extra)
@@ -1116,7 +1119,7 @@ local int unz64local_GetCurrentFileInfoInternal (unzFile file,
if (lSeek!=0)
{
- if (ZSEEK64(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
+ if (ZSEEK64(s->z_filefunc, s->filestream,(ZPOS64_T)lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
lSeek=0;
else
err=UNZ_ERRNO;
@@ -1684,7 +1687,7 @@ extern int ZEXPORT unzSeekCurrentFile(unzFile file, int pos) {
if (pfile_in_zip_read_info->compression_method==Z_BZIP2ED) { // don't know how to support bzip
return UNZ_INTERNALERROR;
- };
+ }
if ((pfile_in_zip_read_info->compression_method==0) || (pfile_in_zip_read_info->raw)) {
@@ -1723,7 +1726,7 @@ extern int ZEXPORT unzSeekCurrentFile(unzFile file, int pos) {
pfile_in_zip_read_info->stream.avail_in = (uInt)0;
pfile_in_zip_read_info->stream.total_out = 0;
pfile_in_zip_read_info->stream.next_in = 0;
- };
+ }
// not sure where to read, so read on the stack
{
@@ -1735,17 +1738,17 @@ extern int ZEXPORT unzSeekCurrentFile(unzFile file, int pos) {
int read = unzReadCurrentFile(file, buf, len);
if (read < 0) {
return read;
- };
+ }
to_read -= read;
if (read == UNZ_EOF) {
return pos;
- };
- };
- };
- };
+ }
+ }
+ }
+ }
return pos;
-};
+}
/* GODOT end */
extern int ZEXPORT unzOpenCurrentFile (unzFile file)
@@ -1877,7 +1880,7 @@ extern int ZEXPORT unzReadCurrentFile (unzFile file, voidp buf, unsigned len)
if ((pfile_in_zip_read_info->stream.avail_in == 0) &&
(pfile_in_zip_read_info->rest_read_compressed == 0))
- return (iRead==0) ? UNZ_EOF : iRead;
+ return (iRead==0) ? UNZ_EOF : (int)iRead;
if (pfile_in_zip_read_info->stream.avail_out <
pfile_in_zip_read_info->stream.avail_in)
@@ -1967,6 +1970,9 @@ extern int ZEXPORT unzReadCurrentFile (unzFile file, voidp buf, unsigned len)
err = Z_DATA_ERROR;
uTotalOutAfter = pfile_in_zip_read_info->stream.total_out;
+ /* Detect overflow, because z_stream.total_out is uLong (32 bits) */
+ if (uTotalOutAfter<uTotalOutBefore)
+ uTotalOutAfter += 1LL << 32; /* Add maximum value of uLong + 1 */
uOutThis = uTotalOutAfter-uTotalOutBefore;
pfile_in_zip_read_info->total_out_64 = pfile_in_zip_read_info->total_out_64 + uOutThis;
@@ -1981,14 +1987,14 @@ extern int ZEXPORT unzReadCurrentFile (unzFile file, voidp buf, unsigned len)
iRead += (uInt)(uTotalOutAfter - uTotalOutBefore);
if (err==Z_STREAM_END)
- return (iRead==0) ? UNZ_EOF : iRead;
+ return (iRead==0) ? UNZ_EOF : (int)iRead;
if (err!=Z_OK)
break;
}
}
if (err==Z_OK)
- return iRead;
+ return (int)iRead;
return err;
}
diff --git a/thirdparty/minizip/unzip.h b/thirdparty/minizip/unzip.h
index bab1cb939f..71a7d89692 100644
--- a/thirdparty/minizip/unzip.h
+++ b/thirdparty/minizip/unzip.h
@@ -83,12 +83,12 @@ typedef voidp unzFile;
/* tm_unz contain date/time info */
typedef struct tm_unz_s
{
- uInt tm_sec; /* seconds after the minute - [0,59] */
- uInt tm_min; /* minutes after the hour - [0,59] */
- uInt tm_hour; /* hours since midnight - [0,23] */
- uInt tm_mday; /* day of the month - [1,31] */
- uInt tm_mon; /* months since January - [0,11] */
- uInt tm_year; /* years - [1980..2044] */
+ int tm_sec; /* seconds after the minute - [0,59] */
+ int tm_min; /* minutes after the hour - [0,59] */
+ int tm_hour; /* hours since midnight - [0,23] */
+ int tm_mday; /* day of the month - [1,31] */
+ int tm_mon; /* months since January - [0,11] */
+ int tm_year; /* years - [1980..2044] */
} tm_unz;
/* unz_global_info structure contain global data about the ZIPfile
diff --git a/thirdparty/minizip/zip.c b/thirdparty/minizip/zip.c
index 2936e2b5d9..6d1c26d9f8 100644
--- a/thirdparty/minizip/zip.c
+++ b/thirdparty/minizip/zip.c
@@ -158,7 +158,7 @@ typedef struct
#ifndef NOCRYPT
unsigned long keys[3]; /* keys defining the pseudo-random sequence */
const z_crc_t* pcrc_32_tab;
- int crypt_header_size;
+ unsigned crypt_header_size;
#endif
} curfile64_info;
@@ -301,7 +301,7 @@ local int zip64local_putValue (const zlib_filefunc64_32_def* pzlib_filefunc_def,
}
}
- if (ZWRITE64(*pzlib_filefunc_def,filestream,buf,nbByte)!=(uLong)nbByte)
+ if (ZWRITE64(*pzlib_filefunc_def,filestream,buf,(uLong)nbByte)!=(uLong)nbByte)
return ZIP_ERRNO;
else
return ZIP_OK;
@@ -337,8 +337,8 @@ local uLong zip64local_TmzDateToDosDate(const tm_zip* ptm)
else if (year>=80)
year-=80;
return
- (uLong) (((ptm->tm_mday) + (32 * (ptm->tm_mon+1)) + (512 * year)) << 16) |
- ((ptm->tm_sec/2) + (32* ptm->tm_min) + (2048 * (uLong)ptm->tm_hour));
+ (uLong) (((uLong)(ptm->tm_mday) + (32 * (uLong)(ptm->tm_mon+1)) + (512 * year)) << 16) |
+ (((uLong)ptm->tm_sec/2) + (32 * (uLong)ptm->tm_min) + (2048 * (uLong)ptm->tm_hour));
}
@@ -522,12 +522,12 @@ local ZPOS64_T zip64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_f
if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) &&
((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06))
{
- uPosFound = uReadPos+i;
+ uPosFound = uReadPos+(unsigned)i;
break;
}
- if (uPosFound!=0)
- break;
+ if (uPosFound!=0)
+ break;
}
TRYFREE(buf);
return uPosFound;
@@ -586,7 +586,7 @@ local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib
// Signature "0x07064b50" Zip64 end of central directory locater
if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) && ((*(buf+i+2))==0x06) && ((*(buf+i+3))==0x07))
{
- uPosFound = uReadPos+i;
+ uPosFound = uReadPos+(unsigned)i;
break;
}
}
@@ -637,7 +637,7 @@ local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib
return relativeOffset;
}
-int LoadCentralDirectoryRecord(zip64_internal* pziinit)
+local int LoadCentralDirectoryRecord(zip64_internal* pziinit)
{
int err=ZIP_OK;
ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
@@ -957,7 +957,7 @@ extern zipFile ZEXPORT zipOpen64 (const void* pathname, int append)
return zipOpen3(pathname,append,NULL,NULL);
}
-int Write_LocalFileHeader(zip64_internal* zi, const char* filename, uInt size_extrafield_local, const void* extrafield_local)
+local int Write_LocalFileHeader(zip64_internal* zi, const char* filename, uInt size_extrafield_local, const void* extrafield_local)
{
/* write the local header */
int err;
@@ -1036,8 +1036,8 @@ int Write_LocalFileHeader(zip64_internal* zi, const char* filename, uInt size_ex
// Remember position of Zip64 extended info for the local file header. (needed when we update size after done with file)
zi->ci.pos_zip64extrainfo = ZTELL64(zi->z_filefunc,zi->filestream);
- err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (short)HeaderID,2);
- err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (short)DataSize,2);
+ err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (ZPOS64_T)HeaderID,2);
+ err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (ZPOS64_T)DataSize,2);
err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (ZPOS64_T)UncompressedSize,8);
err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (ZPOS64_T)CompressedSize,8);
@@ -1520,7 +1520,7 @@ extern int ZEXPORT zipCloseFileInZipRaw64 (zipFile file, ZPOS64_T uncompressed_s
zip64_internal* zi;
ZPOS64_T compressed_size;
uLong invalidValue = 0xffffffff;
- short datasize = 0;
+ unsigned datasize = 0;
int err=ZIP_OK;
if (file == NULL)
@@ -1756,7 +1756,7 @@ extern int ZEXPORT zipCloseFileInZip (zipFile file)
return zipCloseFileInZipRaw (file,0,0);
}
-int Write_Zip64EndOfCentralDirectoryLocator(zip64_internal* zi, ZPOS64_T zip64eocd_pos_inzip)
+local int Write_Zip64EndOfCentralDirectoryLocator(zip64_internal* zi, ZPOS64_T zip64eocd_pos_inzip)
{
int err = ZIP_OK;
ZPOS64_T pos = zip64eocd_pos_inzip - zi->add_position_when_writing_offset;
@@ -1778,7 +1778,7 @@ int Write_Zip64EndOfCentralDirectoryLocator(zip64_internal* zi, ZPOS64_T zip64eo
return err;
}
-int Write_Zip64EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip)
+local int Write_Zip64EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip)
{
int err = ZIP_OK;
@@ -1817,7 +1817,7 @@ int Write_Zip64EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centra
}
return err;
}
-int Write_EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip)
+local int Write_EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip)
{
int err = ZIP_OK;
@@ -1865,7 +1865,7 @@ int Write_EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir,
return err;
}
-int Write_GlobalComment(zip64_internal* zi, const char* global_comment)
+local int Write_GlobalComment(zip64_internal* zi, const char* global_comment)
{
int err = ZIP_OK;
uInt size_global_comment = 0;
@@ -1966,7 +1966,7 @@ extern int ZEXPORT zipRemoveExtraInfoBlock (char* pData, int* dataLen, short sHe
if(pData == NULL || *dataLen < 4)
return ZIP_PARAMERROR;
- pNewHeader = (char*)ALLOC(*dataLen);
+ pNewHeader = (char*)ALLOC((unsigned)*dataLen);
pTmp = pNewHeader;
while(p < (pData + *dataLen))
diff --git a/thirdparty/minizip/zip.h b/thirdparty/minizip/zip.h
index 8aaebb6234..7e4509d77b 100644
--- a/thirdparty/minizip/zip.h
+++ b/thirdparty/minizip/zip.h
@@ -88,12 +88,12 @@ typedef voidp zipFile;
/* tm_zip contain date/time info */
typedef struct tm_zip_s
{
- uInt tm_sec; /* seconds after the minute - [0,59] */
- uInt tm_min; /* minutes after the hour - [0,59] */
- uInt tm_hour; /* hours since midnight - [0,23] */
- uInt tm_mday; /* day of the month - [1,31] */
- uInt tm_mon; /* months since January - [0,11] */
- uInt tm_year; /* years - [1980..2044] */
+ int tm_sec; /* seconds after the minute - [0,59] */
+ int tm_min; /* minutes after the hour - [0,59] */
+ int tm_hour; /* hours since midnight - [0,23] */
+ int tm_mday; /* day of the month - [1,31] */
+ int tm_mon; /* months since January - [0,11] */
+ int tm_year; /* years - [1980..2044] */
} tm_zip;
typedef struct
@@ -144,6 +144,11 @@ extern zipFile ZEXPORT zipOpen2_64 OF((const void *pathname,
zipcharpc* globalcomment,
zlib_filefunc64_def* pzlib_filefunc_def));
+extern zipFile ZEXPORT zipOpen3 OF((const void *pathname,
+ int append,
+ zipcharpc* globalcomment,
+ zlib_filefunc64_32_def* pzlib_filefunc64_32_def));
+
extern int ZEXPORT zipOpenNewFileInZip OF((zipFile file,
const char* filename,
const zip_fileinfo* zipfi,