Although there were a few local syntactic fixups between the existing vendored minizip code and the version from upstream zlib v1.2.3.4, these do not appear to affect the code semantics - and so this changeset is a straightforward file copy of the relevant code files from upstream v1.3.1.
I've confirmed that this code builds and passes tests by running make, although as noted in d5b9d364b68a3226b87cac180a5f01ab0a8bd3d6 I did add define the NOCRYPT macro variable at compile-time to achieve that. That's also set in the configure script, so I hope that's an OK change to apply.
For pedantic reference, the changes between the vendored `minizip` in 6f2320aba9a75dd6857fe75edc0b95cde2785ff2 and `zlib` v1.2.3.4 `minizip` are included below.
```diff
--- third_party/minizip/unzip.c 2024-02-13 15:16:51.511995254 +0000
+++ ../zlib/contrib/minizip/unzip.c 2024-02-13 15:02:33.715998526 +0000
@@ -607,12 +607,11 @@
/* we check the magic */
- if (err==UNZ_OK) {
+ if (err==UNZ_OK)
if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK)
err=UNZ_ERRNO;
else if (uMagic!=0x02014b50)
err=UNZ_BADZIPFILE;
- }
if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.version) != UNZ_OK)
err=UNZ_ERRNO;
@@ -688,12 +687,11 @@
else
uSizeRead = extraFieldBufferSize;
- if (lSeek!=0) {
+ if (lSeek!=0)
if (ZSEEK(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
lSeek=0;
else
err=UNZ_ERRNO;
- }
if ((file_info.size_file_extra>0) && (extraFieldBufferSize>0))
if (ZREAD(s->z_filefunc, s->filestream,extraField,uSizeRead)!=uSizeRead)
err=UNZ_ERRNO;
@@ -714,12 +712,11 @@
else
uSizeRead = commentBufferSize;
- if (lSeek!=0) {
+ if (lSeek!=0)
if (ZSEEK(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
lSeek=0;
else
err=UNZ_ERRNO;
- }
if ((file_info.size_file_comment>0) && (commentBufferSize>0))
if (ZREAD(s->z_filefunc, s->filestream,szComment,uSizeRead)!=uSizeRead)
err=UNZ_ERRNO;
@@ -979,12 +976,11 @@
return UNZ_ERRNO;
- if (err==UNZ_OK) {
+ if (err==UNZ_OK)
if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK)
err=UNZ_ERRNO;
else if (uMagic!=0x04034b50)
err=UNZ_BADZIPFILE;
- }
if (unzlocal_getShort(&s->z_filefunc, s->filestream,&uData) != UNZ_OK)
err=UNZ_ERRNO;
@@ -1245,7 +1241,7 @@
return UNZ_PARAMERROR;
- if (pfile_in_zip_read_info->read_buffer == NULL)
+ if ((pfile_in_zip_read_info->read_buffer == NULL))
return UNZ_END_OF_LIST_OF_FILE;
if (len==0)
return 0;
@@ -1540,7 +1536,7 @@
char *szComment;
uLong uSizeBuf;
{
- //int err=UNZ_OK;
+ int err=UNZ_OK;
unz_s* s;
uLong uReadThis ;
if (file==NULL)
--- third_party/minizip/zip.c 2024-02-13 15:16:51.511995254 +0000
+++ ../zlib/contrib/minizip/zip.c 2024-02-13 15:02:33.715998526 +0000
@@ -758,9 +758,9 @@
zi->ci.flag = 0;
if ((level==8) || (level==9))
zi->ci.flag |= 2;
- if (level==2)
+ if ((level==2))
zi->ci.flag |= 4;
- if (level==1)
+ if ((level==1))
zi->ci.flag |= 6;
if (password != NULL)
zi->ci.flag |= 1;
```
Although there were a few local syntactic fixups between the existing vendored
minizip
code and the version from upstreamzlib
v1.2.3.4, these do not appear to affect the code semantics - and so this changeset is a straightforward file copy of the relevant code files from upstream v1.3.1.I've confirmed that this code builds and passes tests by running
make
, although as noted in d5b9d364b68a3226b87cac180a5f01ab0a8bd3d6 I did add define theNOCRYPT
macro variable at compile-time to achieve that. That's also set in theconfigure
script, so I hope that's an OK change to apply.For pedantic reference, the changes between the vendored `minizip` in 6f2320aba9a75dd6857fe75edc0b95cde2785ff2 and `zlib` v1.2.3.4 `minizip` are included below.
```diff --- third_party/minizip/unzip.c 2024-02-13 15:16:51.511995254 +0000 +++ ../zlib/contrib/minizip/unzip.c 2024-02-13 15:02:33.715998526 +0000 @@ -607,12 +607,11 @@ /* we check the magic */ - if (err==UNZ_OK) { + if (err==UNZ_OK) if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK) err=UNZ_ERRNO; else if (uMagic!=0x02014b50) err=UNZ_BADZIPFILE; - } if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.version) != UNZ_OK) err=UNZ_ERRNO; @@ -688,12 +687,11 @@ else uSizeRead = extraFieldBufferSize; - if (lSeek!=0) { + if (lSeek!=0) if (ZSEEK(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0) lSeek=0; else err=UNZ_ERRNO; - } if ((file_info.size_file_extra>0) && (extraFieldBufferSize>0)) if (ZREAD(s->z_filefunc, s->filestream,extraField,uSizeRead)!=uSizeRead) err=UNZ_ERRNO; @@ -714,12 +712,11 @@ else uSizeRead = commentBufferSize; - if (lSeek!=0) { + if (lSeek!=0) if (ZSEEK(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0) lSeek=0; else err=UNZ_ERRNO; - } if ((file_info.size_file_comment>0) && (commentBufferSize>0)) if (ZREAD(s->z_filefunc, s->filestream,szComment,uSizeRead)!=uSizeRead) err=UNZ_ERRNO; @@ -979,12 +976,11 @@ return UNZ_ERRNO; - if (err==UNZ_OK) { + if (err==UNZ_OK) if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK) err=UNZ_ERRNO; else if (uMagic!=0x04034b50) err=UNZ_BADZIPFILE; - } if (unzlocal_getShort(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) err=UNZ_ERRNO; @@ -1245,7 +1241,7 @@ return UNZ_PARAMERROR; - if (pfile_in_zip_read_info->read_buffer == NULL) + if ((pfile_in_zip_read_info->read_buffer == NULL)) return UNZ_END_OF_LIST_OF_FILE; if (len==0) return 0; @@ -1540,7 +1536,7 @@ char *szComment; uLong uSizeBuf; { - //int err=UNZ_OK; + int err=UNZ_OK; unz_s* s; uLong uReadThis ; if (file==NULL) --- third_party/minizip/zip.c 2024-02-13 15:16:51.511995254 +0000 +++ ../zlib/contrib/minizip/zip.c 2024-02-13 15:02:33.715998526 +0000 @@ -758,9 +758,9 @@ zi->ci.flag = 0; if ((level==8) || (level==9)) zi->ci.flag |= 2; - if (level==2) + if ((level==2)) zi->ci.flag |= 4; - if (level==1) + if ((level==1)) zi->ci.flag |= 6; if (password != NULL) zi->ci.flag |= 1; ```