diff options
author | Mark Adler <madler@alumni.caltech.edu> | 2011-09-09 23:24:02 -0700 |
---|---|---|
committer | Mark Adler <madler@alumni.caltech.edu> | 2011-09-09 23:24:02 -0700 |
commit | 79fbcdc939b5d515218187a0d5f2526fb632075a (patch) | |
tree | dc82b3a452568093ab8a9f365126ba56a419eea1 /contrib/minizip | |
parent | 7a6955760ba950eb82f57929f8f6c9847c65f0af (diff) | |
download | zlib-1.2.2.tar.gz zlib-1.2.2.tar.bz2 zlib-1.2.2.zip |
zlib 1.2.2v1.2.2
Diffstat (limited to 'contrib/minizip')
-rw-r--r-- | contrib/minizip/ioapi.c | 4 | ||||
-rw-r--r-- | contrib/minizip/miniunz.c | 4 | ||||
-rw-r--r-- | contrib/minizip/mztools.c | 30 | ||||
-rw-r--r-- | contrib/minizip/mztools.h | 8 | ||||
-rw-r--r-- | contrib/minizip/unzip.c | 10 | ||||
-rw-r--r-- | contrib/minizip/zip.c | 6 |
6 files changed, 32 insertions, 30 deletions
diff --git a/contrib/minizip/ioapi.c b/contrib/minizip/ioapi.c index 6ddfd36..c9e69f2 100644 --- a/contrib/minizip/ioapi.c +++ b/contrib/minizip/ioapi.c | |||
@@ -94,7 +94,7 @@ uLong ZCALLBACK fread_file_func (opaque, stream, buf, size) | |||
94 | uLong size; | 94 | uLong size; |
95 | { | 95 | { |
96 | uLong ret; | 96 | uLong ret; |
97 | ret = fread(buf, 1, (size_t)size, (FILE *)stream); | 97 | ret = (uLong)fread(buf, 1, (size_t)size, (FILE *)stream); |
98 | return ret; | 98 | return ret; |
99 | } | 99 | } |
100 | 100 | ||
@@ -106,7 +106,7 @@ uLong ZCALLBACK fwrite_file_func (opaque, stream, buf, size) | |||
106 | uLong size; | 106 | uLong size; |
107 | { | 107 | { |
108 | uLong ret; | 108 | uLong ret; |
109 | ret = fwrite(buf, 1, (size_t)size, (FILE *)stream); | 109 | ret = (uLong)fwrite(buf, 1, (size_t)size, (FILE *)stream); |
110 | return ret; | 110 | return ret; |
111 | } | 111 | } |
112 | 112 | ||
diff --git a/contrib/minizip/miniunz.c b/contrib/minizip/miniunz.c index 11b7260..a6b06a2 100644 --- a/contrib/minizip/miniunz.c +++ b/contrib/minizip/miniunz.c | |||
@@ -317,7 +317,7 @@ int do_extract_currentfile(uf,popt_extract_without_path,popt_overwrite,password) | |||
317 | 317 | ||
318 | printf("The file %s exists. Overwrite ? [y]es, [n]o, [A]ll: ",write_filename); | 318 | printf("The file %s exists. Overwrite ? [y]es, [n]o, [A]ll: ",write_filename); |
319 | ret = scanf("%1s",answer); | 319 | ret = scanf("%1s",answer); |
320 | if (ret != 1) | 320 | if (ret != 1) |
321 | { | 321 | { |
322 | exit(EXIT_FAILURE); | 322 | exit(EXIT_FAILURE); |
323 | } | 323 | } |
@@ -567,7 +567,7 @@ int main(argc,argv) | |||
567 | return do_list(uf); | 567 | return do_list(uf); |
568 | else if (opt_do_extract==1) | 568 | else if (opt_do_extract==1) |
569 | { | 569 | { |
570 | if (opt_extractdir && chdir(dirname)) | 570 | if (opt_extractdir && chdir(dirname)) |
571 | { | 571 | { |
572 | printf("Error changing into %s, aborting\n", dirname); | 572 | printf("Error changing into %s, aborting\n", dirname); |
573 | exit(-1); | 573 | exit(-1); |
diff --git a/contrib/minizip/mztools.c b/contrib/minizip/mztools.c index 363ee13..c1266bc 100644 --- a/contrib/minizip/mztools.c +++ b/contrib/minizip/mztools.c | |||
@@ -62,7 +62,7 @@ uLong* bytesRecovered; | |||
62 | unsigned int fnsize = READ_16(header + 26); /* file name length */ | 62 | unsigned int fnsize = READ_16(header + 26); /* file name length */ |
63 | unsigned int extsize = READ_16(header + 28); /* extra field length */ | 63 | unsigned int extsize = READ_16(header + 28); /* extra field length */ |
64 | filename[0] = extra[0] = '\0'; | 64 | filename[0] = extra[0] = '\0'; |
65 | 65 | ||
66 | /* Header */ | 66 | /* Header */ |
67 | if (fwrite(header, 1, 30, fpOut) == 30) { | 67 | if (fwrite(header, 1, 30, fpOut) == 30) { |
68 | offset += 30; | 68 | offset += 30; |
@@ -70,7 +70,7 @@ uLong* bytesRecovered; | |||
70 | err = Z_ERRNO; | 70 | err = Z_ERRNO; |
71 | break; | 71 | break; |
72 | } | 72 | } |
73 | 73 | ||
74 | /* Filename */ | 74 | /* Filename */ |
75 | if (fnsize > 0) { | 75 | if (fnsize > 0) { |
76 | if (fread(filename, 1, fnsize, fpZip) == fnsize) { | 76 | if (fread(filename, 1, fnsize, fpZip) == fnsize) { |
@@ -103,7 +103,7 @@ uLong* bytesRecovered; | |||
103 | break; | 103 | break; |
104 | } | 104 | } |
105 | } | 105 | } |
106 | 106 | ||
107 | /* Data */ | 107 | /* Data */ |
108 | { | 108 | { |
109 | int dataSize = cpsize; | 109 | int dataSize = cpsize; |
@@ -133,7 +133,7 @@ uLong* bytesRecovered; | |||
133 | } | 133 | } |
134 | } | 134 | } |
135 | } | 135 | } |
136 | 136 | ||
137 | /* Central directory entry */ | 137 | /* Central directory entry */ |
138 | { | 138 | { |
139 | char header[46]; | 139 | char header[46]; |
@@ -159,7 +159,7 @@ uLong* bytesRecovered; | |||
159 | /* Header */ | 159 | /* Header */ |
160 | if (fwrite(header, 1, 46, fpOutCD) == 46) { | 160 | if (fwrite(header, 1, 46, fpOutCD) == 46) { |
161 | offsetCD += 46; | 161 | offsetCD += 46; |
162 | 162 | ||
163 | /* Filename */ | 163 | /* Filename */ |
164 | if (fnsize > 0) { | 164 | if (fnsize > 0) { |
165 | if (fwrite(filename, 1, fnsize, fpOutCD) == fnsize) { | 165 | if (fwrite(filename, 1, fnsize, fpOutCD) == fnsize) { |
@@ -172,7 +172,7 @@ uLong* bytesRecovered; | |||
172 | err = Z_STREAM_ERROR; | 172 | err = Z_STREAM_ERROR; |
173 | break; | 173 | break; |
174 | } | 174 | } |
175 | 175 | ||
176 | /* Extra field */ | 176 | /* Extra field */ |
177 | if (extsize > 0) { | 177 | if (extsize > 0) { |
178 | if (fwrite(extra, 1, extsize, fpOutCD) == extsize) { | 178 | if (fwrite(extra, 1, extsize, fpOutCD) == extsize) { |
@@ -182,7 +182,7 @@ uLong* bytesRecovered; | |||
182 | break; | 182 | break; |
183 | } | 183 | } |
184 | } | 184 | } |
185 | 185 | ||
186 | /* Comment field */ | 186 | /* Comment field */ |
187 | if (comsize > 0) { | 187 | if (comsize > 0) { |
188 | if ((int)fwrite(comment, 1, comsize, fpOutCD) == comsize) { | 188 | if ((int)fwrite(comment, 1, comsize, fpOutCD) == comsize) { |
@@ -192,8 +192,8 @@ uLong* bytesRecovered; | |||
192 | break; | 192 | break; |
193 | } | 193 | } |
194 | } | 194 | } |
195 | 195 | ||
196 | 196 | ||
197 | } else { | 197 | } else { |
198 | err = Z_ERRNO; | 198 | err = Z_ERRNO; |
199 | break; | 199 | break; |
@@ -225,17 +225,17 @@ uLong* bytesRecovered; | |||
225 | WRITE_32(header + 12, offsetCD); /* size of CD */ | 225 | WRITE_32(header + 12, offsetCD); /* size of CD */ |
226 | WRITE_32(header + 16, offset); /* offset to CD */ | 226 | WRITE_32(header + 16, offset); /* offset to CD */ |
227 | WRITE_16(header + 20, comsize); /* comment */ | 227 | WRITE_16(header + 20, comsize); /* comment */ |
228 | 228 | ||
229 | /* Header */ | 229 | /* Header */ |
230 | if (fwrite(header, 1, 22, fpOutCD) == 22) { | 230 | if (fwrite(header, 1, 22, fpOutCD) == 22) { |
231 | 231 | ||
232 | /* Comment field */ | 232 | /* Comment field */ |
233 | if (comsize > 0) { | 233 | if (comsize > 0) { |
234 | if ((int)fwrite(comment, 1, comsize, fpOutCD) != comsize) { | 234 | if ((int)fwrite(comment, 1, comsize, fpOutCD) != comsize) { |
235 | err = Z_ERRNO; | 235 | err = Z_ERRNO; |
236 | } | 236 | } |
237 | } | 237 | } |
238 | 238 | ||
239 | } else { | 239 | } else { |
240 | err = Z_ERRNO; | 240 | err = Z_ERRNO; |
241 | } | 241 | } |
@@ -257,14 +257,14 @@ uLong* bytesRecovered; | |||
257 | fclose(fpOutCD); | 257 | fclose(fpOutCD); |
258 | } | 258 | } |
259 | } | 259 | } |
260 | 260 | ||
261 | /* Close */ | 261 | /* Close */ |
262 | fclose(fpZip); | 262 | fclose(fpZip); |
263 | fclose(fpOut); | 263 | fclose(fpOut); |
264 | 264 | ||
265 | /* Wipe temporary file */ | 265 | /* Wipe temporary file */ |
266 | (void)remove(fileOutTmp); | 266 | (void)remove(fileOutTmp); |
267 | 267 | ||
268 | /* Number of recovered entries */ | 268 | /* Number of recovered entries */ |
269 | if (err == Z_OK) { | 269 | if (err == Z_OK) { |
270 | if (nRecovered != NULL) { | 270 | if (nRecovered != NULL) { |
diff --git a/contrib/minizip/mztools.h b/contrib/minizip/mztools.h index eee78dc..88b3459 100644 --- a/contrib/minizip/mztools.h +++ b/contrib/minizip/mztools.h | |||
@@ -17,14 +17,14 @@ extern "C" { | |||
17 | 17 | ||
18 | #include "unzip.h" | 18 | #include "unzip.h" |
19 | 19 | ||
20 | /* Repair a ZIP file (missing central directory) | 20 | /* Repair a ZIP file (missing central directory) |
21 | file: file to recover | 21 | file: file to recover |
22 | fileOut: output file after recovery | 22 | fileOut: output file after recovery |
23 | fileOutTmp: temporary file name used for recovery | 23 | fileOutTmp: temporary file name used for recovery |
24 | */ | 24 | */ |
25 | extern int ZEXPORT unzRepair(const char* file, | 25 | extern int ZEXPORT unzRepair(const char* file, |
26 | const char* fileOut, | 26 | const char* fileOut, |
27 | const char* fileOutTmp, | 27 | const char* fileOutTmp, |
28 | uLong* nRecovered, | 28 | uLong* nRecovered, |
29 | uLong* bytesRecovered); | 29 | uLong* bytesRecovered); |
30 | 30 | ||
diff --git a/contrib/minizip/unzip.c b/contrib/minizip/unzip.c index e804a2a..e14de9e 100644 --- a/contrib/minizip/unzip.c +++ b/contrib/minizip/unzip.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* unzip.c -- IO for uncompress .zip files using zlib | 1 | /* unzip.c -- IO for uncompress .zip files using zlib |
2 | Version 1.01c, August 23th, 2004 | 2 | Version 1.01d, September 22th, 2004 |
3 | 3 | ||
4 | Copyright (C) 1998-2004 Gilles Vollant | 4 | Copyright (C) 1998-2004 Gilles Vollant |
5 | 5 | ||
@@ -1250,10 +1250,12 @@ extern int ZEXPORT unzReadCurrentFile (file, buf, len) | |||
1250 | pfile_in_zip_read_info->stream.avail_out = | 1250 | pfile_in_zip_read_info->stream.avail_out = |
1251 | (uInt)pfile_in_zip_read_info->rest_read_uncompressed; | 1251 | (uInt)pfile_in_zip_read_info->rest_read_uncompressed; |
1252 | 1252 | ||
1253 | if ((len>pfile_in_zip_read_info->rest_read_compressed) && | 1253 | if ((len>pfile_in_zip_read_info->rest_read_compressed+ |
1254 | (pfile_in_zip_read_info->raw)) | 1254 | pfile_in_zip_read_info->stream.avail_in) && |
1255 | (pfile_in_zip_read_info->raw)) | ||
1255 | pfile_in_zip_read_info->stream.avail_out = | 1256 | pfile_in_zip_read_info->stream.avail_out = |
1256 | (uInt)pfile_in_zip_read_info->rest_read_compressed; | 1257 | (uInt)pfile_in_zip_read_info->rest_read_compressed+ |
1258 | pfile_in_zip_read_info->stream.avail_in; | ||
1257 | 1259 | ||
1258 | while (pfile_in_zip_read_info->stream.avail_out>0) | 1260 | while (pfile_in_zip_read_info->stream.avail_out>0) |
1259 | { | 1261 | { |
diff --git a/contrib/minizip/zip.c b/contrib/minizip/zip.c index ce1444c..2ccd7fd 100644 --- a/contrib/minizip/zip.c +++ b/contrib/minizip/zip.c | |||
@@ -717,9 +717,9 @@ extern int ZEXPORT zipOpenNewFileInZip3 (file, filename, zipfi, | |||
717 | if (comment==NULL) | 717 | if (comment==NULL) |
718 | size_comment = 0; | 718 | size_comment = 0; |
719 | else | 719 | else |
720 | size_comment = strlen(comment); | 720 | size_comment = (uInt)strlen(comment); |
721 | 721 | ||
722 | size_filename = strlen(filename); | 722 | size_filename = (uInt)strlen(filename); |
723 | 723 | ||
724 | if (zipfi == NULL) | 724 | if (zipfi == NULL) |
725 | zi->ci.dosDate = 0; | 725 | zi->ci.dosDate = 0; |
@@ -1126,7 +1126,7 @@ extern int ZEXPORT zipClose (file, global_comment) | |||
1126 | if (global_comment==NULL) | 1126 | if (global_comment==NULL) |
1127 | size_global_comment = 0; | 1127 | size_global_comment = 0; |
1128 | else | 1128 | else |
1129 | size_global_comment = strlen(global_comment); | 1129 | size_global_comment = (uInt)strlen(global_comment); |
1130 | 1130 | ||
1131 | 1131 | ||
1132 | centraldir_pos_inzip = ZTELL(zi->z_filefunc,zi->filestream); | 1132 | centraldir_pos_inzip = ZTELL(zi->z_filefunc,zi->filestream); |