summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Adler <madler@alumni.caltech.edu>2022-01-01 14:32:17 -0800
committerMark Adler <madler@alumni.caltech.edu>2022-01-01 14:55:47 -0800
commit2014a993addbc8f1b9785d97f55fd189792c2f78 (patch)
tree9a90875e93972077d00a434c69a045585dbcb9bc
parent58ca4e57ce7d76734d8b5afa03d205f694419b17 (diff)
downloadzlib-2014a993addbc8f1b9785d97f55fd189792c2f78.tar.gz
zlib-2014a993addbc8f1b9785d97f55fd189792c2f78.tar.bz2
zlib-2014a993addbc8f1b9785d97f55fd189792c2f78.zip
Clean up minizip to reduce warnings for testing.
Also fix Makefile test target and permit added compile options.
-rw-r--r--contrib/minizip/Makefile12
-rw-r--r--contrib/minizip/crypt.h18
-rw-r--r--contrib/minizip/ioapi.c8
-rw-r--r--contrib/minizip/miniunz.c26
-rw-r--r--contrib/minizip/minizip.c30
-rw-r--r--contrib/minizip/unzip.c28
-rw-r--r--contrib/minizip/unzip.h12
-rw-r--r--contrib/minizip/zip.c32
-rw-r--r--contrib/minizip/zip.h17
9 files changed, 96 insertions, 87 deletions
diff --git a/contrib/minizip/Makefile b/contrib/minizip/Makefile
index 84eaad2..aac76e0 100644
--- a/contrib/minizip/Makefile
+++ b/contrib/minizip/Makefile
@@ -1,5 +1,5 @@
1CC=cc 1CC=cc
2CFLAGS=-O -I../.. 2CFLAGS := $(CFLAGS) -O -I../..
3 3
4UNZ_OBJS = miniunz.o unzip.o ioapi.o ../../libz.a 4UNZ_OBJS = miniunz.o unzip.o ioapi.o ../../libz.a
5ZIP_OBJS = minizip.o zip.o ioapi.o ../../libz.a 5ZIP_OBJS = minizip.o zip.o ioapi.o ../../libz.a
@@ -16,10 +16,14 @@ minizip: $(ZIP_OBJS)
16 $(CC) $(CFLAGS) -o $@ $(ZIP_OBJS) 16 $(CC) $(CFLAGS) -o $@ $(ZIP_OBJS)
17 17
18test: miniunz minizip 18test: miniunz minizip
19 ./minizip test readme.txt 19 @rm -f test.*
20 @echo hello hello hello > test.txt
21 ./minizip test test.txt
20 ./miniunz -l test.zip 22 ./miniunz -l test.zip
21 mv readme.txt readme.old 23 @mv test.txt test.old
22 ./miniunz test.zip 24 ./miniunz test.zip
25 @cmp test.txt test.old
26 @rm -f test.*
23 27
24clean: 28clean:
25 /bin/rm -f *.o *~ minizip miniunz 29 /bin/rm -f *.o *~ minizip miniunz test.*
diff --git a/contrib/minizip/crypt.h b/contrib/minizip/crypt.h
index 131543f..9da1537 100644
--- a/contrib/minizip/crypt.h
+++ b/contrib/minizip/crypt.h
@@ -78,24 +78,24 @@ static void init_keys(const char* passwd,unsigned long* pkeys,const z_crc_t* pcr
78 (update_keys(pkeys,pcrc_32_tab,c ^= decrypt_byte(pkeys,pcrc_32_tab))) 78 (update_keys(pkeys,pcrc_32_tab,c ^= decrypt_byte(pkeys,pcrc_32_tab)))
79 79
80#define zencode(pkeys,pcrc_32_tab,c,t) \ 80#define zencode(pkeys,pcrc_32_tab,c,t) \
81 (t=decrypt_byte(pkeys,pcrc_32_tab), update_keys(pkeys,pcrc_32_tab,c), t^(c)) 81 (t=decrypt_byte(pkeys,pcrc_32_tab), update_keys(pkeys,pcrc_32_tab,c), (Byte)t^(c))
82 82
83#ifdef INCLUDECRYPTINGCODE_IFCRYPTALLOWED 83#ifdef INCLUDECRYPTINGCODE_IFCRYPTALLOWED
84 84
85#define RAND_HEAD_LEN 12 85#define RAND_HEAD_LEN 12
86 /* "last resort" source for second part of crypt seed pattern */ 86 /* "last resort" source for second part of crypt seed pattern */
87# ifndef ZCR_SEED2 87# ifndef ZCR_SEED2
88# define ZCR_SEED2 3141592654UL /* use PI as default pattern */ 88# define ZCR_SEED2 3141592654L /* use PI as default pattern */
89# endif 89# endif
90 90
91static int crypthead(const char* passwd, /* password string */ 91static unsigned crypthead(const char* passwd, /* password string */
92 unsigned char* buf, /* where to write header */ 92 unsigned char* buf, /* where to write header */
93 int bufSize, 93 int bufSize,
94 unsigned long* pkeys, 94 unsigned long* pkeys,
95 const z_crc_t* pcrc_32_tab, 95 const z_crc_t* pcrc_32_tab,
96 unsigned long crcForCrypting) 96 unsigned long crcForCrypting)
97{ 97{
98 int n; /* index in random header */ 98 unsigned n; /* index in random header */
99 int t; /* temporary */ 99 int t; /* temporary */
100 int c; /* random byte */ 100 int c; /* random byte */
101 unsigned char header[RAND_HEAD_LEN-2]; /* random header */ 101 unsigned char header[RAND_HEAD_LEN-2]; /* random header */
diff --git a/contrib/minizip/ioapi.c b/contrib/minizip/ioapi.c
index 1571914..d666e5a 100644
--- a/contrib/minizip/ioapi.c
+++ b/contrib/minizip/ioapi.c
@@ -58,7 +58,7 @@ ZPOS64_T call_ztell64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream
58 return (*(pfilefunc->zfile_func64.ztell64_file)) (pfilefunc->zfile_func64.opaque,filestream); 58 return (*(pfilefunc->zfile_func64.ztell64_file)) (pfilefunc->zfile_func64.opaque,filestream);
59 else 59 else
60 { 60 {
61 uLong tell_uLong = (*(pfilefunc->ztell32_file))(pfilefunc->zfile_func64.opaque,filestream); 61 uLong tell_uLong = (uLong)(*(pfilefunc->ztell32_file))(pfilefunc->zfile_func64.opaque,filestream);
62 if ((tell_uLong) == MAXU32) 62 if ((tell_uLong) == MAXU32)
63 return (ZPOS64_T)-1; 63 return (ZPOS64_T)-1;
64 else 64 else
@@ -160,7 +160,7 @@ static ZPOS64_T ZCALLBACK ftell64_file_func (voidpf opaque, voidpf stream)
160{ 160{
161 (void)opaque; 161 (void)opaque;
162 ZPOS64_T ret; 162 ZPOS64_T ret;
163 ret = FTELLO_FUNC((FILE *)stream); 163 ret = (ZPOS64_T)FTELLO_FUNC((FILE *)stream);
164 return ret; 164 return ret;
165} 165}
166 166
@@ -183,7 +183,7 @@ static long ZCALLBACK fseek_file_func (voidpf opaque, voidpf stream, uLong offs
183 default: return -1; 183 default: return -1;
184 } 184 }
185 ret = 0; 185 ret = 0;
186 if (fseek((FILE *)stream, offset, fseek_origin) != 0) 186 if (fseek((FILE *)stream, (long)offset, fseek_origin) != 0)
187 ret = -1; 187 ret = -1;
188 return ret; 188 return ret;
189} 189}
@@ -208,7 +208,7 @@ static long ZCALLBACK fseek64_file_func (voidpf opaque, voidpf stream, ZPOS64_T
208 } 208 }
209 ret = 0; 209 ret = 0;
210 210
211 if(FSEEKO_FUNC((FILE *)stream, offset, fseek_origin) != 0) 211 if(FSEEKO_FUNC((FILE *)stream, (long)offset, fseek_origin) != 0)
212 ret = -1; 212 ret = -1;
213 213
214 return ret; 214 return ret;
diff --git a/contrib/minizip/miniunz.c b/contrib/minizip/miniunz.c
index 8e34bd9..f103815 100644
--- a/contrib/minizip/miniunz.c
+++ b/contrib/minizip/miniunz.c
@@ -81,7 +81,7 @@
81 filename : the filename of the file where date/time must be modified 81 filename : the filename of the file where date/time must be modified
82 dosdate : the new date at the MSDos format (4 bytes) 82 dosdate : the new date at the MSDos format (4 bytes)
83 tmu_date : the SAME new date at the tm_unz format */ 83 tmu_date : the SAME new date at the tm_unz format */
84void change_file_date(filename,dosdate,tmu_date) 84static void change_file_date(filename,dosdate,tmu_date)
85 const char *filename; 85 const char *filename;
86 uLong dosdate; 86 uLong dosdate;
87 tm_unz tmu_date; 87 tm_unz tmu_date;
@@ -123,7 +123,7 @@ void change_file_date(filename,dosdate,tmu_date)
123/* mymkdir and change_file_date are not 100 % portable 123/* mymkdir and change_file_date are not 100 % portable
124 As I don't know well Unix, I wait feedback for the unix portion */ 124 As I don't know well Unix, I wait feedback for the unix portion */
125 125
126int mymkdir(dirname) 126static int mymkdir(dirname)
127 const char* dirname; 127 const char* dirname;
128{ 128{
129 int ret=0; 129 int ret=0;
@@ -137,14 +137,14 @@ int mymkdir(dirname)
137 return ret; 137 return ret;
138} 138}
139 139
140int makedir (newdir) 140static int makedir (newdir)
141 const char *newdir; 141 const char *newdir;
142{ 142{
143 char *buffer ; 143 char *buffer ;
144 char *p; 144 char *p;
145 int len = (int)strlen(newdir); 145 size_t len = strlen(newdir);
146 146
147 if (len <= 0) 147 if (len == 0)
148 return 0; 148 return 0;
149 149
150 buffer = (char*)malloc(len+1); 150 buffer = (char*)malloc(len+1);
@@ -187,13 +187,13 @@ int makedir (newdir)
187 return 1; 187 return 1;
188} 188}
189 189
190void do_banner() 190static void do_banner()
191{ 191{
192 printf("MiniUnz 1.01b, demo of zLib + Unz package written by Gilles Vollant\n"); 192 printf("MiniUnz 1.01b, demo of zLib + Unz package written by Gilles Vollant\n");
193 printf("more info at http://www.winimage.com/zLibDll/unzip.html\n\n"); 193 printf("more info at http://www.winimage.com/zLibDll/unzip.html\n\n");
194} 194}
195 195
196void do_help() 196static void do_help()
197{ 197{
198 printf("Usage : miniunz [-e] [-x] [-v] [-l] [-o] [-p password] file.zip [file_to_extr.] [-d extractdir]\n\n" \ 198 printf("Usage : miniunz [-e] [-x] [-v] [-l] [-o] [-p password] file.zip [file_to_extr.] [-d extractdir]\n\n" \
199 " -e Extract without pathname (junk paths)\n" \ 199 " -e Extract without pathname (junk paths)\n" \
@@ -205,7 +205,7 @@ void do_help()
205 " -p extract crypted file using password\n\n"); 205 " -p extract crypted file using password\n\n");
206} 206}
207 207
208void Display64BitsSize(ZPOS64_T n, int size_char) 208static void Display64BitsSize(ZPOS64_T n, int size_char)
209{ 209{
210 /* to avoid compatibility problem , we do here the conversion */ 210 /* to avoid compatibility problem , we do here the conversion */
211 char number[21]; 211 char number[21];
@@ -233,7 +233,7 @@ void Display64BitsSize(ZPOS64_T n, int size_char)
233 printf("%s",&number[pos_string]); 233 printf("%s",&number[pos_string]);
234} 234}
235 235
236int do_list(uf) 236static int do_list(uf)
237 unzFile uf; 237 unzFile uf;
238{ 238{
239 uLong i; 239 uLong i;
@@ -311,7 +311,7 @@ int do_list(uf)
311} 311}
312 312
313 313
314int do_extract_currentfile(uf,popt_extract_without_path,popt_overwrite,password) 314static int do_extract_currentfile(uf,popt_extract_without_path,popt_overwrite,password)
315 unzFile uf; 315 unzFile uf;
316 const int* popt_extract_without_path; 316 const int* popt_extract_without_path;
317 int* popt_overwrite; 317 int* popt_overwrite;
@@ -440,7 +440,7 @@ int do_extract_currentfile(uf,popt_extract_without_path,popt_overwrite,password)
440 break; 440 break;
441 } 441 }
442 if (err>0) 442 if (err>0)
443 if (fwrite(buf,err,1,fout)!=1) 443 if (fwrite(buf,(unsigned)err,1,fout)!=1)
444 { 444 {
445 printf("error in writing extracted file\n"); 445 printf("error in writing extracted file\n");
446 err=UNZ_ERRNO; 446 err=UNZ_ERRNO;
@@ -473,7 +473,7 @@ int do_extract_currentfile(uf,popt_extract_without_path,popt_overwrite,password)
473} 473}
474 474
475 475
476int do_extract(uf,opt_extract_without_path,opt_overwrite,password) 476static int do_extract(uf,opt_extract_without_path,opt_overwrite,password)
477 unzFile uf; 477 unzFile uf;
478 int opt_extract_without_path; 478 int opt_extract_without_path;
479 int opt_overwrite; 479 int opt_overwrite;
@@ -508,7 +508,7 @@ int do_extract(uf,opt_extract_without_path,opt_overwrite,password)
508 return 0; 508 return 0;
509} 509}
510 510
511int do_extract_onefile(uf,filename,opt_extract_without_path,opt_overwrite,password) 511static int do_extract_onefile(uf,filename,opt_extract_without_path,opt_overwrite,password)
512 unzFile uf; 512 unzFile uf;
513 const char* filename; 513 const char* filename;
514 int opt_extract_without_path; 514 int opt_extract_without_path;
diff --git a/contrib/minizip/minizip.c b/contrib/minizip/minizip.c
index 2a38549..7f937aa 100644
--- a/contrib/minizip/minizip.c
+++ b/contrib/minizip/minizip.c
@@ -71,7 +71,7 @@
71#define MAXFILENAME (256) 71#define MAXFILENAME (256)
72 72
73#ifdef _WIN32 73#ifdef _WIN32
74uLong filetime(f, tmzip, dt) 74static int filetime(f, tmzip, dt)
75 const char *f; /* name of file to get info on */ 75 const char *f; /* name of file to get info on */
76 tm_zip *tmzip; /* return value: access, modific. and creation times */ 76 tm_zip *tmzip; /* return value: access, modific. and creation times */
77 uLong *dt; /* dostime */ 77 uLong *dt; /* dostime */
@@ -95,7 +95,7 @@ uLong filetime(f, tmzip, dt)
95} 95}
96#else 96#else
97#if defined(unix) || defined(__APPLE__) 97#if defined(unix) || defined(__APPLE__)
98uLong filetime(f, tmzip, dt) 98static int filetime(f, tmzip, dt)
99 const char *f; /* name of file to get info on */ 99 const char *f; /* name of file to get info on */
100 tm_zip *tmzip; /* return value: access, modific. and creation times */ 100 tm_zip *tmzip; /* return value: access, modific. and creation times */
101 uLong *dt; /* dostime */ 101 uLong *dt; /* dostime */
@@ -109,7 +109,7 @@ uLong filetime(f, tmzip, dt)
109 if (strcmp(f,"-")!=0) 109 if (strcmp(f,"-")!=0)
110 { 110 {
111 char name[MAXFILENAME+1]; 111 char name[MAXFILENAME+1];
112 int len = strlen(f); 112 size_t len = strlen(f);
113 if (len > MAXFILENAME) 113 if (len > MAXFILENAME)
114 len = MAXFILENAME; 114 len = MAXFILENAME;
115 115
@@ -151,7 +151,7 @@ uLong filetime(f, tmzip, dt)
151 151
152 152
153 153
154int check_exist_file(filename) 154static int check_exist_file(filename)
155 const char* filename; 155 const char* filename;
156{ 156{
157 FILE* ftestexist; 157 FILE* ftestexist;
@@ -164,13 +164,13 @@ int check_exist_file(filename)
164 return ret; 164 return ret;
165} 165}
166 166
167void do_banner() 167static void do_banner()
168{ 168{
169 printf("MiniZip 1.1, demo of zLib + MiniZip64 package, written by Gilles Vollant\n"); 169 printf("MiniZip 1.1, demo of zLib + MiniZip64 package, written by Gilles Vollant\n");
170 printf("more info on MiniZip at http://www.winimage.com/zLibDll/minizip.html\n\n"); 170 printf("more info on MiniZip at http://www.winimage.com/zLibDll/minizip.html\n\n");
171} 171}
172 172
173void do_help() 173static void do_help()
174{ 174{
175 printf("Usage : minizip [-o] [-a] [-0 to -9] [-p password] [-j] file.zip [files_to_add]\n\n" \ 175 printf("Usage : minizip [-o] [-a] [-0 to -9] [-p password] [-j] file.zip [files_to_add]\n\n" \
176 " -o Overwrite existing file.zip\n" \ 176 " -o Overwrite existing file.zip\n" \
@@ -183,7 +183,7 @@ void do_help()
183 183
184/* calculate the CRC32 of a file, 184/* calculate the CRC32 of a file,
185 because to encrypt a file, we need known the CRC32 of the file before */ 185 because to encrypt a file, we need known the CRC32 of the file before */
186int getFileCrc(const char* filenameinzip,void*buf,unsigned long size_buf,unsigned long* result_crc) 186static int getFileCrc(const char* filenameinzip,void*buf,unsigned long size_buf,unsigned long* result_crc)
187{ 187{
188 unsigned long calculate_crc=0; 188 unsigned long calculate_crc=0;
189 int err=ZIP_OK; 189 int err=ZIP_OK;
@@ -200,7 +200,7 @@ int getFileCrc(const char* filenameinzip,void*buf,unsigned long size_buf,unsigne
200 do 200 do
201 { 201 {
202 err = ZIP_OK; 202 err = ZIP_OK;
203 size_read = (int)fread(buf,1,size_buf,fin); 203 size_read = fread(buf,1,size_buf,fin);
204 if (size_read < size_buf) 204 if (size_read < size_buf)
205 if (feof(fin)==0) 205 if (feof(fin)==0)
206 { 206 {
@@ -209,7 +209,7 @@ int getFileCrc(const char* filenameinzip,void*buf,unsigned long size_buf,unsigne
209 } 209 }
210 210
211 if (size_read>0) 211 if (size_read>0)
212 calculate_crc = crc32(calculate_crc,buf,size_read); 212 calculate_crc = crc32_z(calculate_crc,buf,size_read);
213 total_read += size_read; 213 total_read += size_read;
214 214
215 } while ((err == ZIP_OK) && (size_read>0)); 215 } while ((err == ZIP_OK) && (size_read>0));
@@ -222,7 +222,7 @@ int getFileCrc(const char* filenameinzip,void*buf,unsigned long size_buf,unsigne
222 return err; 222 return err;
223} 223}
224 224
225int isLargeFile(const char* filename) 225static int isLargeFile(const char* filename)
226{ 226{
227 int largeFile = 0; 227 int largeFile = 0;
228 ZPOS64_T pos = 0; 228 ZPOS64_T pos = 0;
@@ -231,7 +231,7 @@ int isLargeFile(const char* filename)
231 if(pFile != NULL) 231 if(pFile != NULL)
232 { 232 {
233 FSEEKO_FUNC(pFile, 0, SEEK_END); 233 FSEEKO_FUNC(pFile, 0, SEEK_END);
234 pos = FTELLO_FUNC(pFile); 234 pos = (ZPOS64_T)FTELLO_FUNC(pFile);
235 235
236 printf("File : %s is %lld bytes\n", filename, pos); 236 printf("File : %s is %lld bytes\n", filename, pos);
237 237
@@ -256,7 +256,7 @@ int main(argc,argv)
256 char filename_try[MAXFILENAME+16]; 256 char filename_try[MAXFILENAME+16];
257 int zipok; 257 int zipok;
258 int err=0; 258 int err=0;
259 int size_buf=0; 259 size_t size_buf=0;
260 void* buf=NULL; 260 void* buf=NULL;
261 const char* password=NULL; 261 const char* password=NULL;
262 262
@@ -397,7 +397,7 @@ int main(argc,argv)
397 (strlen(argv[i]) == 2))) 397 (strlen(argv[i]) == 2)))
398 { 398 {
399 FILE * fin; 399 FILE * fin;
400 int size_read; 400 size_t size_read;
401 const char* filenameinzip = argv[i]; 401 const char* filenameinzip = argv[i];
402 const char *savefilenameinzip; 402 const char *savefilenameinzip;
403 zip_fileinfo zi; 403 zip_fileinfo zi;
@@ -473,7 +473,7 @@ int main(argc,argv)
473 do 473 do
474 { 474 {
475 err = ZIP_OK; 475 err = ZIP_OK;
476 size_read = (int)fread(buf,1,size_buf,fin); 476 size_read = fread(buf,1,size_buf,fin);
477 if (size_read < size_buf) 477 if (size_read < size_buf)
478 if (feof(fin)==0) 478 if (feof(fin)==0)
479 { 479 {
@@ -483,7 +483,7 @@ int main(argc,argv)
483 483
484 if (size_read>0) 484 if (size_read>0)
485 { 485 {
486 err = zipWriteInFileInZip (zf,buf,size_read); 486 err = zipWriteInFileInZip (zf,buf,(unsigned)size_read);
487 if (err<0) 487 if (err<0)
488 { 488 {
489 printf("error in writing %s in the zipfile\n", 489 printf("error in writing %s in the zipfile\n",
diff --git a/contrib/minizip/unzip.c b/contrib/minizip/unzip.c
index b16a75e..5e12e47 100644
--- a/contrib/minizip/unzip.c
+++ b/contrib/minizip/unzip.c
@@ -455,7 +455,7 @@ local ZPOS64_T unz64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_f
455 if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) && 455 if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) &&
456 ((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06)) 456 ((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06))
457 { 457 {
458 uPosFound = uReadPos+i; 458 uPosFound = uReadPos+(unsigned)i;
459 break; 459 break;
460 } 460 }
461 461
@@ -523,7 +523,7 @@ local ZPOS64_T unz64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib
523 if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) && 523 if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) &&
524 ((*(buf+i+2))==0x06) && ((*(buf+i+3))==0x07)) 524 ((*(buf+i+2))==0x06) && ((*(buf+i+3))==0x07))
525 { 525 {
526 uPosFound = uReadPos+i; 526 uPosFound = uReadPos+(unsigned)i;
527 break; 527 break;
528 } 528 }
529 529
@@ -853,13 +853,13 @@ local void unz64local_DosDateToTmuDate (ZPOS64_T ulDosDate, tm_unz* ptm)
853{ 853{
854 ZPOS64_T uDate; 854 ZPOS64_T uDate;
855 uDate = (ZPOS64_T)(ulDosDate>>16); 855 uDate = (ZPOS64_T)(ulDosDate>>16);
856 ptm->tm_mday = (uInt)(uDate&0x1f) ; 856 ptm->tm_mday = (int)(uDate&0x1f) ;
857 ptm->tm_mon = (uInt)((((uDate)&0x1E0)/0x20)-1) ; 857 ptm->tm_mon = (int)((((uDate)&0x1E0)/0x20)-1) ;
858 ptm->tm_year = (uInt)(((uDate&0x0FE00)/0x0200)+1980) ; 858 ptm->tm_year = (int)(((uDate&0x0FE00)/0x0200)+1980) ;
859 859
860 ptm->tm_hour = (uInt) ((ulDosDate &0xF800)/0x800); 860 ptm->tm_hour = (int) ((ulDosDate &0xF800)/0x800);
861 ptm->tm_min = (uInt) ((ulDosDate&0x7E0)/0x20) ; 861 ptm->tm_min = (int) ((ulDosDate&0x7E0)/0x20) ;
862 ptm->tm_sec = (uInt) (2*(ulDosDate&0x1f)) ; 862 ptm->tm_sec = (int) (2*(ulDosDate&0x1f)) ;
863} 863}
864 864
865/* 865/*
@@ -993,7 +993,7 @@ local int unz64local_GetCurrentFileInfoInternal (unzFile file,
993 993
994 if (lSeek!=0) 994 if (lSeek!=0)
995 { 995 {
996 if (ZSEEK64(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0) 996 if (ZSEEK64(s->z_filefunc, s->filestream,(ZPOS64_T)lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
997 lSeek=0; 997 lSeek=0;
998 else 998 else
999 err=UNZ_ERRNO; 999 err=UNZ_ERRNO;
@@ -1018,7 +1018,7 @@ local int unz64local_GetCurrentFileInfoInternal (unzFile file,
1018 1018
1019 if (lSeek!=0) 1019 if (lSeek!=0)
1020 { 1020 {
1021 if (ZSEEK64(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0) 1021 if (ZSEEK64(s->z_filefunc, s->filestream,(ZPOS64_T)lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
1022 lSeek=0; 1022 lSeek=0;
1023 else 1023 else
1024 err=UNZ_ERRNO; 1024 err=UNZ_ERRNO;
@@ -1090,7 +1090,7 @@ local int unz64local_GetCurrentFileInfoInternal (unzFile file,
1090 1090
1091 if (lSeek!=0) 1091 if (lSeek!=0)
1092 { 1092 {
1093 if (ZSEEK64(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0) 1093 if (ZSEEK64(s->z_filefunc, s->filestream,(ZPOS64_T)lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
1094 lSeek=0; 1094 lSeek=0;
1095 else 1095 else
1096 err=UNZ_ERRNO; 1096 err=UNZ_ERRNO;
@@ -1767,7 +1767,7 @@ extern int ZEXPORT unzReadCurrentFile (unzFile file, voidp buf, unsigned len)
1767 1767
1768 if ((pfile_in_zip_read_info->stream.avail_in == 0) && 1768 if ((pfile_in_zip_read_info->stream.avail_in == 0) &&
1769 (pfile_in_zip_read_info->rest_read_compressed == 0)) 1769 (pfile_in_zip_read_info->rest_read_compressed == 0))
1770 return (iRead==0) ? UNZ_EOF : iRead; 1770 return (iRead==0) ? UNZ_EOF : (int)iRead;
1771 1771
1772 if (pfile_in_zip_read_info->stream.avail_out < 1772 if (pfile_in_zip_read_info->stream.avail_out <
1773 pfile_in_zip_read_info->stream.avail_in) 1773 pfile_in_zip_read_info->stream.avail_in)
@@ -1874,14 +1874,14 @@ extern int ZEXPORT unzReadCurrentFile (unzFile file, voidp buf, unsigned len)
1874 iRead += (uInt)(uTotalOutAfter - uTotalOutBefore); 1874 iRead += (uInt)(uTotalOutAfter - uTotalOutBefore);
1875 1875
1876 if (err==Z_STREAM_END) 1876 if (err==Z_STREAM_END)
1877 return (iRead==0) ? UNZ_EOF : iRead; 1877 return (iRead==0) ? UNZ_EOF : (int)iRead;
1878 if (err!=Z_OK) 1878 if (err!=Z_OK)
1879 break; 1879 break;
1880 } 1880 }
1881 } 1881 }
1882 1882
1883 if (err==Z_OK) 1883 if (err==Z_OK)
1884 return iRead; 1884 return (int)iRead;
1885 return err; 1885 return err;
1886} 1886}
1887 1887
diff --git a/contrib/minizip/unzip.h b/contrib/minizip/unzip.h
index 2104e39..6f95e94 100644
--- a/contrib/minizip/unzip.h
+++ b/contrib/minizip/unzip.h
@@ -83,12 +83,12 @@ typedef voidp unzFile;
83/* tm_unz contain date/time info */ 83/* tm_unz contain date/time info */
84typedef struct tm_unz_s 84typedef struct tm_unz_s
85{ 85{
86 uInt tm_sec; /* seconds after the minute - [0,59] */ 86 int tm_sec; /* seconds after the minute - [0,59] */
87 uInt tm_min; /* minutes after the hour - [0,59] */ 87 int tm_min; /* minutes after the hour - [0,59] */
88 uInt tm_hour; /* hours since midnight - [0,23] */ 88 int tm_hour; /* hours since midnight - [0,23] */
89 uInt tm_mday; /* day of the month - [1,31] */ 89 int tm_mday; /* day of the month - [1,31] */
90 uInt tm_mon; /* months since January - [0,11] */ 90 int tm_mon; /* months since January - [0,11] */
91 uInt tm_year; /* years - [1980..2044] */ 91 int tm_year; /* years - [1980..2044] */
92} tm_unz; 92} tm_unz;
93 93
94/* unz_global_info structure contain global data about the ZIPfile 94/* unz_global_info structure contain global data about the ZIPfile
diff --git a/contrib/minizip/zip.c b/contrib/minizip/zip.c
index a753c17..4e611e1 100644
--- a/contrib/minizip/zip.c
+++ b/contrib/minizip/zip.c
@@ -158,7 +158,7 @@ typedef struct
158#ifndef NOCRYPT 158#ifndef NOCRYPT
159 unsigned long keys[3]; /* keys defining the pseudo-random sequence */ 159 unsigned long keys[3]; /* keys defining the pseudo-random sequence */
160 const z_crc_t* pcrc_32_tab; 160 const z_crc_t* pcrc_32_tab;
161 int crypt_header_size; 161 unsigned crypt_header_size;
162#endif 162#endif
163} curfile64_info; 163} curfile64_info;
164 164
@@ -301,7 +301,7 @@ local int zip64local_putValue (const zlib_filefunc64_32_def* pzlib_filefunc_def,
301 } 301 }
302 } 302 }
303 303
304 if (ZWRITE64(*pzlib_filefunc_def,filestream,buf,nbByte)!=(uLong)nbByte) 304 if (ZWRITE64(*pzlib_filefunc_def,filestream,buf,(uLong)nbByte)!=(uLong)nbByte)
305 return ZIP_ERRNO; 305 return ZIP_ERRNO;
306 else 306 else
307 return ZIP_OK; 307 return ZIP_OK;
@@ -337,8 +337,8 @@ local uLong zip64local_TmzDateToDosDate(const tm_zip* ptm)
337 else if (year>=80) 337 else if (year>=80)
338 year-=80; 338 year-=80;
339 return 339 return
340 (uLong) (((ptm->tm_mday) + (32 * (ptm->tm_mon+1)) + (512 * year)) << 16) | 340 (uLong) (((uLong)(ptm->tm_mday) + (32 * (uLong)(ptm->tm_mon+1)) + (512 * year)) << 16) |
341 ((ptm->tm_sec/2) + (32* ptm->tm_min) + (2048 * (uLong)ptm->tm_hour)); 341 (((uLong)ptm->tm_sec/2) + (32 * (uLong)ptm->tm_min) + (2048 * (uLong)ptm->tm_hour));
342} 342}
343 343
344 344
@@ -522,7 +522,7 @@ local ZPOS64_T zip64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_f
522 if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) && 522 if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) &&
523 ((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06)) 523 ((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06))
524 { 524 {
525 uPosFound = uReadPos+i; 525 uPosFound = uReadPos+(unsigned)i;
526 break; 526 break;
527 } 527 }
528 528
@@ -586,7 +586,7 @@ local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib
586 // Signature "0x07064b50" Zip64 end of central directory locater 586 // Signature "0x07064b50" Zip64 end of central directory locater
587 if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) && ((*(buf+i+2))==0x06) && ((*(buf+i+3))==0x07)) 587 if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) && ((*(buf+i+2))==0x06) && ((*(buf+i+3))==0x07))
588 { 588 {
589 uPosFound = uReadPos+i; 589 uPosFound = uReadPos+(unsigned)i;
590 break; 590 break;
591 } 591 }
592 } 592 }
@@ -637,7 +637,7 @@ local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib
637 return relativeOffset; 637 return relativeOffset;
638} 638}
639 639
640int LoadCentralDirectoryRecord(zip64_internal* pziinit) 640local int LoadCentralDirectoryRecord(zip64_internal* pziinit)
641{ 641{
642 int err=ZIP_OK; 642 int err=ZIP_OK;
643 ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/ 643 ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
@@ -955,7 +955,7 @@ extern zipFile ZEXPORT zipOpen64 (const void* pathname, int append)
955 return zipOpen3(pathname,append,NULL,NULL); 955 return zipOpen3(pathname,append,NULL,NULL);
956} 956}
957 957
958int Write_LocalFileHeader(zip64_internal* zi, const char* filename, uInt size_extrafield_local, const void* extrafield_local) 958local int Write_LocalFileHeader(zip64_internal* zi, const char* filename, uInt size_extrafield_local, const void* extrafield_local)
959{ 959{
960 /* write the local header */ 960 /* write the local header */
961 int err; 961 int err;
@@ -1034,8 +1034,8 @@ int Write_LocalFileHeader(zip64_internal* zi, const char* filename, uInt size_ex
1034 // Remember position of Zip64 extended info for the local file header. (needed when we update size after done with file) 1034 // Remember position of Zip64 extended info for the local file header. (needed when we update size after done with file)
1035 zi->ci.pos_zip64extrainfo = ZTELL64(zi->z_filefunc,zi->filestream); 1035 zi->ci.pos_zip64extrainfo = ZTELL64(zi->z_filefunc,zi->filestream);
1036 1036
1037 err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (short)HeaderID,2); 1037 err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (ZPOS64_T)HeaderID,2);
1038 err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (short)DataSize,2); 1038 err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (ZPOS64_T)DataSize,2);
1039 1039
1040 err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (ZPOS64_T)UncompressedSize,8); 1040 err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (ZPOS64_T)UncompressedSize,8);
1041 err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (ZPOS64_T)CompressedSize,8); 1041 err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (ZPOS64_T)CompressedSize,8);
@@ -1516,7 +1516,7 @@ extern int ZEXPORT zipCloseFileInZipRaw64 (zipFile file, ZPOS64_T uncompressed_s
1516 zip64_internal* zi; 1516 zip64_internal* zi;
1517 ZPOS64_T compressed_size; 1517 ZPOS64_T compressed_size;
1518 uLong invalidValue = 0xffffffff; 1518 uLong invalidValue = 0xffffffff;
1519 short datasize = 0; 1519 unsigned datasize = 0;
1520 int err=ZIP_OK; 1520 int err=ZIP_OK;
1521 1521
1522 if (file == NULL) 1522 if (file == NULL)
@@ -1752,7 +1752,7 @@ extern int ZEXPORT zipCloseFileInZip (zipFile file)
1752 return zipCloseFileInZipRaw (file,0,0); 1752 return zipCloseFileInZipRaw (file,0,0);
1753} 1753}
1754 1754
1755int Write_Zip64EndOfCentralDirectoryLocator(zip64_internal* zi, ZPOS64_T zip64eocd_pos_inzip) 1755local int Write_Zip64EndOfCentralDirectoryLocator(zip64_internal* zi, ZPOS64_T zip64eocd_pos_inzip)
1756{ 1756{
1757 int err = ZIP_OK; 1757 int err = ZIP_OK;
1758 ZPOS64_T pos = zip64eocd_pos_inzip - zi->add_position_when_writing_offset; 1758 ZPOS64_T pos = zip64eocd_pos_inzip - zi->add_position_when_writing_offset;
@@ -1774,7 +1774,7 @@ int Write_Zip64EndOfCentralDirectoryLocator(zip64_internal* zi, ZPOS64_T zip64eo
1774 return err; 1774 return err;
1775} 1775}
1776 1776
1777int Write_Zip64EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip) 1777local int Write_Zip64EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip)
1778{ 1778{
1779 int err = ZIP_OK; 1779 int err = ZIP_OK;
1780 1780
@@ -1813,7 +1813,7 @@ int Write_Zip64EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centra
1813 } 1813 }
1814 return err; 1814 return err;
1815} 1815}
1816int Write_EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip) 1816local int Write_EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip)
1817{ 1817{
1818 int err = ZIP_OK; 1818 int err = ZIP_OK;
1819 1819
@@ -1861,7 +1861,7 @@ int Write_EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir,
1861 return err; 1861 return err;
1862} 1862}
1863 1863
1864int Write_GlobalComment(zip64_internal* zi, const char* global_comment) 1864local int Write_GlobalComment(zip64_internal* zi, const char* global_comment)
1865{ 1865{
1866 int err = ZIP_OK; 1866 int err = ZIP_OK;
1867 uInt size_global_comment = 0; 1867 uInt size_global_comment = 0;
@@ -1962,7 +1962,7 @@ extern int ZEXPORT zipRemoveExtraInfoBlock (char* pData, int* dataLen, short sHe
1962 if(pData == NULL || *dataLen < 4) 1962 if(pData == NULL || *dataLen < 4)
1963 return ZIP_PARAMERROR; 1963 return ZIP_PARAMERROR;
1964 1964
1965 pNewHeader = (char*)ALLOC(*dataLen); 1965 pNewHeader = (char*)ALLOC((unsigned)*dataLen);
1966 pTmp = pNewHeader; 1966 pTmp = pNewHeader;
1967 1967
1968 while(p < (pData + *dataLen)) 1968 while(p < (pData + *dataLen))
diff --git a/contrib/minizip/zip.h b/contrib/minizip/zip.h
index 8aaebb6..7e4509d 100644
--- a/contrib/minizip/zip.h
+++ b/contrib/minizip/zip.h
@@ -88,12 +88,12 @@ typedef voidp zipFile;
88/* tm_zip contain date/time info */ 88/* tm_zip contain date/time info */
89typedef struct tm_zip_s 89typedef struct tm_zip_s
90{ 90{
91 uInt tm_sec; /* seconds after the minute - [0,59] */ 91 int tm_sec; /* seconds after the minute - [0,59] */
92 uInt tm_min; /* minutes after the hour - [0,59] */ 92 int tm_min; /* minutes after the hour - [0,59] */
93 uInt tm_hour; /* hours since midnight - [0,23] */ 93 int tm_hour; /* hours since midnight - [0,23] */
94 uInt tm_mday; /* day of the month - [1,31] */ 94 int tm_mday; /* day of the month - [1,31] */
95 uInt tm_mon; /* months since January - [0,11] */ 95 int tm_mon; /* months since January - [0,11] */
96 uInt tm_year; /* years - [1980..2044] */ 96 int tm_year; /* years - [1980..2044] */
97} tm_zip; 97} tm_zip;
98 98
99typedef struct 99typedef struct
@@ -144,6 +144,11 @@ extern zipFile ZEXPORT zipOpen2_64 OF((const void *pathname,
144 zipcharpc* globalcomment, 144 zipcharpc* globalcomment,
145 zlib_filefunc64_def* pzlib_filefunc_def)); 145 zlib_filefunc64_def* pzlib_filefunc_def));
146 146
147extern zipFile ZEXPORT zipOpen3 OF((const void *pathname,
148 int append,
149 zipcharpc* globalcomment,
150 zlib_filefunc64_32_def* pzlib_filefunc64_32_def));
151
147extern int ZEXPORT zipOpenNewFileInZip OF((zipFile file, 152extern int ZEXPORT zipOpenNewFileInZip OF((zipFile file,
148 const char* filename, 153 const char* filename,
149 const zip_fileinfo* zipfi, 154 const zip_fileinfo* zipfi,