diff options
Diffstat (limited to 'contrib/minizip/miniunz.c')
-rw-r--r-- | contrib/minizip/miniunz.c | 54 |
1 files changed, 11 insertions, 43 deletions
diff --git a/contrib/minizip/miniunz.c b/contrib/minizip/miniunz.c index 0dc9b50..52b0909 100644 --- a/contrib/minizip/miniunz.c +++ b/contrib/minizip/miniunz.c | |||
@@ -81,11 +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 */ |
84 | static void change_file_date(filename,dosdate,tmu_date) | 84 | static void change_file_date(const char *filename, uLong dosdate, tm_unz tmu_date) { |
85 | const char *filename; | ||
86 | uLong dosdate; | ||
87 | tm_unz tmu_date; | ||
88 | { | ||
89 | #ifdef _WIN32 | 85 | #ifdef _WIN32 |
90 | HANDLE hFile; | 86 | HANDLE hFile; |
91 | FILETIME ftm,ftLocal,ftCreate,ftLastAcc,ftLastWrite; | 87 | FILETIME ftm,ftLocal,ftCreate,ftLastAcc,ftLastWrite; |
@@ -123,9 +119,7 @@ static void change_file_date(filename,dosdate,tmu_date) | |||
123 | /* mymkdir and change_file_date are not 100 % portable | 119 | /* mymkdir and change_file_date are not 100 % portable |
124 | As I don't know well Unix, I wait feedback for the unix portion */ | 120 | As I don't know well Unix, I wait feedback for the unix portion */ |
125 | 121 | ||
126 | static int mymkdir(dirname) | 122 | static int mymkdir(const char* dirname) { |
127 | const char* dirname; | ||
128 | { | ||
129 | int ret=0; | 123 | int ret=0; |
130 | #ifdef _WIN32 | 124 | #ifdef _WIN32 |
131 | ret = _mkdir(dirname); | 125 | ret = _mkdir(dirname); |
@@ -137,9 +131,7 @@ static int mymkdir(dirname) | |||
137 | return ret; | 131 | return ret; |
138 | } | 132 | } |
139 | 133 | ||
140 | static int makedir (newdir) | 134 | static int makedir(const char *newdir) { |
141 | const char *newdir; | ||
142 | { | ||
143 | char *buffer ; | 135 | char *buffer ; |
144 | char *p; | 136 | char *p; |
145 | size_t len = strlen(newdir); | 137 | size_t len = strlen(newdir); |
@@ -187,14 +179,12 @@ static int makedir (newdir) | |||
187 | return 1; | 179 | return 1; |
188 | } | 180 | } |
189 | 181 | ||
190 | static void do_banner() | 182 | static void do_banner(void) { |
191 | { | ||
192 | printf("MiniUnz 1.01b, demo of zLib + Unz package written by Gilles Vollant\n"); | 183 | 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"); | 184 | printf("more info at http://www.winimage.com/zLibDll/unzip.html\n\n"); |
194 | } | 185 | } |
195 | 186 | ||
196 | static void do_help() | 187 | static void do_help(void) { |
197 | { | ||
198 | printf("Usage : miniunz [-e] [-x] [-v] [-l] [-o] [-p password] file.zip [file_to_extr.] [-d extractdir]\n\n" \ | 188 | 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" \ | 189 | " -e Extract without pathname (junk paths)\n" \ |
200 | " -x Extract with pathname\n" \ | 190 | " -x Extract with pathname\n" \ |
@@ -205,8 +195,7 @@ static void do_help() | |||
205 | " -p extract crypted file using password\n\n"); | 195 | " -p extract crypted file using password\n\n"); |
206 | } | 196 | } |
207 | 197 | ||
208 | static void Display64BitsSize(ZPOS64_T n, int size_char) | 198 | static void Display64BitsSize(ZPOS64_T n, int size_char) { |
209 | { | ||
210 | /* to avoid compatibility problem , we do here the conversion */ | 199 | /* to avoid compatibility problem , we do here the conversion */ |
211 | char number[21]; | 200 | char number[21]; |
212 | int offset=19; | 201 | int offset=19; |
@@ -233,9 +222,7 @@ static void Display64BitsSize(ZPOS64_T n, int size_char) | |||
233 | printf("%s",&number[pos_string]); | 222 | printf("%s",&number[pos_string]); |
234 | } | 223 | } |
235 | 224 | ||
236 | static int do_list(uf) | 225 | static int do_list(unzFile uf) { |
237 | unzFile uf; | ||
238 | { | ||
239 | uLong i; | 226 | uLong i; |
240 | unz_global_info64 gi; | 227 | unz_global_info64 gi; |
241 | int err; | 228 | int err; |
@@ -311,12 +298,7 @@ static int do_list(uf) | |||
311 | } | 298 | } |
312 | 299 | ||
313 | 300 | ||
314 | static int do_extract_currentfile(uf,popt_extract_without_path,popt_overwrite,password) | 301 | static int do_extract_currentfile(unzFile uf, const int* popt_extract_without_path, int* popt_overwrite, const char* password) { |
315 | unzFile uf; | ||
316 | const int* popt_extract_without_path; | ||
317 | int* popt_overwrite; | ||
318 | const char* password; | ||
319 | { | ||
320 | char filename_inzip[256]; | 302 | char filename_inzip[256]; |
321 | char* filename_withoutpath; | 303 | char* filename_withoutpath; |
322 | char* p; | 304 | char* p; |
@@ -473,12 +455,7 @@ static int do_extract_currentfile(uf,popt_extract_without_path,popt_overwrite,pa | |||
473 | } | 455 | } |
474 | 456 | ||
475 | 457 | ||
476 | static int do_extract(uf,opt_extract_without_path,opt_overwrite,password) | 458 | static int do_extract(unzFile uf, int opt_extract_without_path, int opt_overwrite, const char* password) { |
477 | unzFile uf; | ||
478 | int opt_extract_without_path; | ||
479 | int opt_overwrite; | ||
480 | const char* password; | ||
481 | { | ||
482 | uLong i; | 459 | uLong i; |
483 | unz_global_info64 gi; | 460 | unz_global_info64 gi; |
484 | int err; | 461 | int err; |
@@ -508,13 +485,7 @@ static int do_extract(uf,opt_extract_without_path,opt_overwrite,password) | |||
508 | return 0; | 485 | return 0; |
509 | } | 486 | } |
510 | 487 | ||
511 | static int do_extract_onefile(uf,filename,opt_extract_without_path,opt_overwrite,password) | 488 | static int do_extract_onefile(unzFile uf, const char* filename, int opt_extract_without_path, int opt_overwrite, const char* password) { |
512 | unzFile uf; | ||
513 | const char* filename; | ||
514 | int opt_extract_without_path; | ||
515 | int opt_overwrite; | ||
516 | const char* password; | ||
517 | { | ||
518 | if (unzLocateFile(uf,filename,CASESENSITIVITY)!=UNZ_OK) | 489 | if (unzLocateFile(uf,filename,CASESENSITIVITY)!=UNZ_OK) |
519 | { | 490 | { |
520 | printf("file %s not found in the zipfile\n",filename); | 491 | printf("file %s not found in the zipfile\n",filename); |
@@ -530,10 +501,7 @@ static int do_extract_onefile(uf,filename,opt_extract_without_path,opt_overwrite | |||
530 | } | 501 | } |
531 | 502 | ||
532 | 503 | ||
533 | int main(argc,argv) | 504 | int main(int argc, char *argv[]) { |
534 | int argc; | ||
535 | char *argv[]; | ||
536 | { | ||
537 | const char *zipfilename=NULL; | 505 | const char *zipfilename=NULL; |
538 | const char *filename_to_extract=NULL; | 506 | const char *filename_to_extract=NULL; |
539 | const char *password=NULL; | 507 | const char *password=NULL; |