aboutsummaryrefslogtreecommitdiff
path: root/contrib/minizip/minizip.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/minizip/minizip.c')
-rw-r--r--contrib/minizip/minizip.c30
1 files changed, 15 insertions, 15 deletions
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",