diff options
author | Mark Adler <madler@alumni.caltech.edu> | 2011-09-09 23:22:21 -0700 |
---|---|---|
committer | Mark Adler <madler@alumni.caltech.edu> | 2011-09-09 23:22:21 -0700 |
commit | 85e7d7d9ba71d95a9e6a64b98bae4fac09f06f1c (patch) | |
tree | 790235a70a5d719992f0bf84864e43a7a4ef376b /contrib/minizip | |
parent | 8e34b3a8024c028dd9fd21d70525fc6d215efde5 (diff) | |
download | zlib-1.2.0.3.tar.gz zlib-1.2.0.3.tar.bz2 zlib-1.2.0.3.zip |
zlib 1.2.0.3v1.2.0.3
Diffstat (limited to 'contrib/minizip')
-rw-r--r-- | contrib/minizip/unzip.c | 31 | ||||
-rw-r--r-- | contrib/minizip/zconf.h | 326 |
2 files changed, 23 insertions, 334 deletions
diff --git a/contrib/minizip/unzip.c b/contrib/minizip/unzip.c index 07d869e..96f9f33 100644 --- a/contrib/minizip/unzip.c +++ b/contrib/minizip/unzip.c | |||
@@ -828,7 +828,11 @@ extern int ZEXPORT unzLocateFile (file, szFileName, iCaseSensitivity) | |||
828 | unz_s* s; | 828 | unz_s* s; |
829 | int err; | 829 | int err; |
830 | 830 | ||
831 | 831 | /* We remember the 'current' position in the file so that we can jump | |
832 | * back there if we fail. | ||
833 | */ | ||
834 | unz_file_info cur_file_infoSaved; | ||
835 | unz_file_info_internal cur_file_info_internalSaved; | ||
832 | uLong num_fileSaved; | 836 | uLong num_fileSaved; |
833 | uLong pos_in_central_dirSaved; | 837 | uLong pos_in_central_dirSaved; |
834 | 838 | ||
@@ -843,25 +847,36 @@ extern int ZEXPORT unzLocateFile (file, szFileName, iCaseSensitivity) | |||
843 | if (!s->current_file_ok) | 847 | if (!s->current_file_ok) |
844 | return UNZ_END_OF_LIST_OF_FILE; | 848 | return UNZ_END_OF_LIST_OF_FILE; |
845 | 849 | ||
850 | /* Save the current state */ | ||
846 | num_fileSaved = s->num_file; | 851 | num_fileSaved = s->num_file; |
847 | pos_in_central_dirSaved = s->pos_in_central_dir; | 852 | pos_in_central_dirSaved = s->pos_in_central_dir; |
853 | cur_file_infoSaved = s->cur_file_info; | ||
854 | cur_file_info_internalSaved = s->cur_file_info_internal; | ||
848 | 855 | ||
849 | err = unzGoToFirstFile(file); | 856 | err = unzGoToFirstFile(file); |
850 | 857 | ||
851 | while (err == UNZ_OK) | 858 | while (err == UNZ_OK) |
852 | { | 859 | { |
853 | char szCurrentFileName[UNZ_MAXFILENAMEINZIP+1]; | 860 | char szCurrentFileName[UNZ_MAXFILENAMEINZIP+1]; |
854 | unzGetCurrentFileInfo(file,NULL, | 861 | err = unzGetCurrentFileInfo(file,NULL, |
855 | szCurrentFileName,sizeof(szCurrentFileName)-1, | 862 | szCurrentFileName,sizeof(szCurrentFileName)-1, |
856 | NULL,0,NULL,0); | 863 | NULL,0,NULL,0); |
857 | if (unzStringFileNameCompare(szCurrentFileName, | 864 | if (err == UNZ_OK) |
858 | szFileName,iCaseSensitivity)==0) | 865 | { |
859 | return UNZ_OK; | 866 | if (unzStringFileNameCompare(szCurrentFileName, |
860 | err = unzGoToNextFile(file); | 867 | szFileName,iCaseSensitivity)==0) |
868 | return UNZ_OK; | ||
869 | err = unzGoToNextFile(file); | ||
870 | } | ||
861 | } | 871 | } |
862 | 872 | ||
873 | /* We failed, so restore the state of the 'current file' to where we | ||
874 | * were. | ||
875 | */ | ||
863 | s->num_file = num_fileSaved ; | 876 | s->num_file = num_fileSaved ; |
864 | s->pos_in_central_dir = pos_in_central_dirSaved ; | 877 | s->pos_in_central_dir = pos_in_central_dirSaved ; |
878 | s->cur_file_info = cur_file_infoSaved; | ||
879 | s->cur_file_info_internal = cur_file_info_internalSaved; | ||
865 | return err; | 880 | return err; |
866 | } | 881 | } |
867 | 882 | ||
diff --git a/contrib/minizip/zconf.h b/contrib/minizip/zconf.h deleted file mode 100644 index 8e6215a..0000000 --- a/contrib/minizip/zconf.h +++ /dev/null | |||
@@ -1,326 +0,0 @@ | |||
1 | /* zconf.h -- configuration of the zlib compression library | ||
2 | * Copyright (C) 1995-2003 Jean-loup Gailly. | ||
3 | * For conditions of distribution and use, see copyright notice in zlib.h | ||
4 | */ | ||
5 | |||
6 | /* @(#) $Id$ */ | ||
7 | |||
8 | #ifndef _ZCONF_H | ||
9 | #define _ZCONF_H | ||
10 | |||
11 | /* | ||
12 | * If you *really* need a unique prefix for all types and library functions, | ||
13 | * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. | ||
14 | */ | ||
15 | #ifdef Z_PREFIX | ||
16 | # define deflateInit_ z_deflateInit_ | ||
17 | # define deflate z_deflate | ||
18 | # define deflateEnd z_deflateEnd | ||
19 | # define inflateInit_ z_inflateInit_ | ||
20 | # define inflate z_inflate | ||
21 | # define inflateEnd z_inflateEnd | ||
22 | # define deflateInit2_ z_deflateInit2_ | ||
23 | # define deflateSetDictionary z_deflateSetDictionary | ||
24 | # define deflateCopy z_deflateCopy | ||
25 | # define deflateReset z_deflateReset | ||
26 | # define deflateParams z_deflateParams | ||
27 | # define deflateBound z_deflateBound | ||
28 | # define inflateInit2_ z_inflateInit2_ | ||
29 | # define inflateSetDictionary z_inflateSetDictionary | ||
30 | # define inflateSync z_inflateSync | ||
31 | # define inflateSyncPoint z_inflateSyncPoint | ||
32 | # define inflateCopy z_inflateCopy | ||
33 | # define inflateReset z_inflateReset | ||
34 | # define compress z_compress | ||
35 | # define compress2 z_compress2 | ||
36 | # define compressBound z_compressBound | ||
37 | # define uncompress z_uncompress | ||
38 | # define adler32 z_adler32 | ||
39 | # define crc32 z_crc32 | ||
40 | # define get_crc_table z_get_crc_table | ||
41 | |||
42 | # define Byte z_Byte | ||
43 | # define uInt z_uInt | ||
44 | # define uLong z_uLong | ||
45 | # define Bytef z_Bytef | ||
46 | # define charf z_charf | ||
47 | # define intf z_intf | ||
48 | # define uIntf z_uIntf | ||
49 | # define uLongf z_uLongf | ||
50 | # define voidpf z_voidpf | ||
51 | # define voidp z_voidp | ||
52 | #endif | ||
53 | |||
54 | |||
55 | #ifdef __STDC_VERSION__ | ||
56 | # ifndef STDC | ||
57 | # define STDC | ||
58 | # endif | ||
59 | # if __STDC_VERSION__ >= 199901L | ||
60 | # ifndef STDC99 | ||
61 | # define STDC99 | ||
62 | # endif | ||
63 | # endif | ||
64 | #endif | ||
65 | |||
66 | |||
67 | #if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32) | ||
68 | # define WIN32 | ||
69 | #endif | ||
70 | #if defined(__GNUC__) || defined(WIN32) || defined(__386__) || defined(i386) | ||
71 | # ifndef __32BIT__ | ||
72 | # define __32BIT__ | ||
73 | # endif | ||
74 | #endif | ||
75 | #if defined(__MSDOS__) && !defined(MSDOS) | ||
76 | # define MSDOS | ||
77 | #endif | ||
78 | |||
79 | /* | ||
80 | * Compile with -DMAXSEG_64K if the alloc function cannot allocate more | ||
81 | * than 64k bytes at a time (needed on systems with 16-bit int). | ||
82 | */ | ||
83 | #if defined(MSDOS) && !defined(__32BIT__) | ||
84 | # define MAXSEG_64K | ||
85 | #endif | ||
86 | #ifdef MSDOS | ||
87 | # define UNALIGNED_OK | ||
88 | #endif | ||
89 | |||
90 | #if (defined(MSDOS) || defined(_WINDOWS) || defined(WIN32)) && !defined(STDC) | ||
91 | # define STDC | ||
92 | #endif | ||
93 | #if defined(__STDC__) || defined(__cplusplus) || defined(__OS2__) | ||
94 | # ifndef STDC | ||
95 | # define STDC | ||
96 | # endif | ||
97 | #endif | ||
98 | |||
99 | #if defined __HOS_AIX__ | ||
100 | # ifndef STDC | ||
101 | # define STDC | ||
102 | # endif | ||
103 | #endif | ||
104 | |||
105 | #ifndef STDC | ||
106 | # ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ | ||
107 | # define const /* note: need a more gentle solution here */ | ||
108 | # endif | ||
109 | #endif | ||
110 | |||
111 | /* Some Mac compilers merge all .h files incorrectly: */ | ||
112 | #if defined(__MWERKS__) || defined(applec) ||defined(THINK_C) ||defined(__SC__) | ||
113 | # define NO_DUMMY_DECL | ||
114 | #endif | ||
115 | |||
116 | /* Old Borland C incorrectly complains about missing returns: */ | ||
117 | #if defined(__BORLANDC__) && (__BORLANDC__ < 0x460) | ||
118 | # define NEED_DUMMY_RETURN | ||
119 | #endif | ||
120 | #if defined(__TURBOC__) && !defined(__BORLANDC__) | ||
121 | # define NEED_DUMMY_RETURN | ||
122 | #endif | ||
123 | |||
124 | |||
125 | /* Maximum value for memLevel in deflateInit2 */ | ||
126 | #ifndef MAX_MEM_LEVEL | ||
127 | # ifdef MAXSEG_64K | ||
128 | # define MAX_MEM_LEVEL 8 | ||
129 | # else | ||
130 | # define MAX_MEM_LEVEL 9 | ||
131 | # endif | ||
132 | #endif | ||
133 | |||
134 | /* Maximum value for windowBits in deflateInit2 and inflateInit2. | ||
135 | * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files | ||
136 | * created by gzip. (Files created by minigzip can still be extracted by | ||
137 | * gzip.) | ||
138 | */ | ||
139 | #ifndef MAX_WBITS | ||
140 | # define MAX_WBITS 15 /* 32K LZ77 window */ | ||
141 | #endif | ||
142 | |||
143 | /* The memory requirements for deflate are (in bytes): | ||
144 | (1 << (windowBits+2)) + (1 << (memLevel+9)) | ||
145 | that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) | ||
146 | plus a few kilobytes for small objects. For example, if you want to reduce | ||
147 | the default memory requirements from 256K to 128K, compile with | ||
148 | make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" | ||
149 | Of course this will generally degrade compression (there's no free lunch). | ||
150 | |||
151 | The memory requirements for inflate are (in bytes) 1 << windowBits | ||
152 | that is, 32K for windowBits=15 (default value) plus a few kilobytes | ||
153 | for small objects. | ||
154 | */ | ||
155 | |||
156 | /* Type declarations */ | ||
157 | |||
158 | #ifndef OF /* function prototypes */ | ||
159 | # ifdef STDC | ||
160 | # define OF(args) args | ||
161 | # else | ||
162 | # define OF(args) () | ||
163 | # endif | ||
164 | #endif | ||
165 | |||
166 | /* | ||
167 | * Microsoft Visual Studio define _vsnprintf but not vsnprintf | ||
168 | */ | ||
169 | #if !defined(STDC99) && !(defined(__TURBOC__) && __TURBOC__ >= 0x550) && !defined(VSNPRINTF_DEFINED) | ||
170 | # ifdef MSDOS | ||
171 | /* vsnprintf may exist on some MS-DOS compilers (DJGPP?), | ||
172 | but for now we just assume it doesn't. */ | ||
173 | # define NO_vsnprintf | ||
174 | # endif | ||
175 | # ifdef WIN32 | ||
176 | /* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */ | ||
177 | # if !defined(vsnprintf) && !defined(__TURBOC__) | ||
178 | # define vsnprintf _vsnprintf | ||
179 | # endif | ||
180 | # endif | ||
181 | # ifdef __TURBOC__ | ||
182 | # define NO_vsnprintf | ||
183 | # endif | ||
184 | #endif | ||
185 | |||
186 | /* The following definitions for FAR are needed only for MSDOS mixed | ||
187 | * model programming (small or medium model with some far allocations). | ||
188 | * This was tested only with MSC; for other MSDOS compilers you may have | ||
189 | * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, | ||
190 | * just define FAR to be empty. | ||
191 | */ | ||
192 | #if (defined(M_I86SM) || defined(M_I86MM)) && !defined(__32BIT__) | ||
193 | /* MSC small or medium model */ | ||
194 | # define SMALL_MEDIUM | ||
195 | # ifdef _MSC_VER | ||
196 | # define FAR _far | ||
197 | # else | ||
198 | # define FAR far | ||
199 | # endif | ||
200 | #endif | ||
201 | #if defined(__BORLANDC__) && (defined(__SMALL__) || defined(__MEDIUM__)) | ||
202 | # ifndef __32BIT__ | ||
203 | # define SMALL_MEDIUM | ||
204 | # define FAR _far | ||
205 | # endif | ||
206 | #endif | ||
207 | |||
208 | #if defined(WIN32) && (!defined(ZLIB_WIN32_NODLL)) && (!defined(ZLIB_DLL)) | ||
209 | # define ZLIB_DLL | ||
210 | #endif | ||
211 | |||
212 | /* Compile with -DZLIB_DLL for Windows DLL support */ | ||
213 | #if defined(ZLIB_DLL) | ||
214 | # if defined(_WINDOWS) || defined(WINDOWS) || defined(WIN32) | ||
215 | # ifndef WINAPIV | ||
216 | # ifdef FAR | ||
217 | # undef FAR | ||
218 | # endif | ||
219 | # include <windows.h> | ||
220 | # endif | ||
221 | # ifdef WIN32 | ||
222 | # define ZEXPORT WINAPI | ||
223 | # define ZEXPORTVA WINAPIV | ||
224 | # else | ||
225 | # define ZEXPORT WINAPI _export | ||
226 | # define ZEXPORTVA FAR _cdecl _export | ||
227 | # endif | ||
228 | # endif | ||
229 | # if defined (__BORLANDC__) | ||
230 | # if (__BORLANDC__ >= 0x0500) && defined (WIN32) | ||
231 | # include <windows.h> | ||
232 | # define ZEXPORT __declspec(dllexport) WINAPI | ||
233 | # define ZEXPORTVA __declspec(dllexport) WINAPIV | ||
234 | # else | ||
235 | # if defined (_Windows) && defined (__DLL__) | ||
236 | # define ZEXPORT _export | ||
237 | # define ZEXPORTVA _export | ||
238 | # endif | ||
239 | # endif | ||
240 | # endif | ||
241 | #endif | ||
242 | |||
243 | #if defined (__BEOS__) | ||
244 | # if defined (ZLIB_DLL) | ||
245 | # define ZEXTERN extern __declspec(dllexport) | ||
246 | # else | ||
247 | # define ZEXTERN extern __declspec(dllimport) | ||
248 | # endif | ||
249 | #endif | ||
250 | |||
251 | #ifndef ZEXPORT | ||
252 | # define ZEXPORT | ||
253 | #endif | ||
254 | #ifndef ZEXPORTVA | ||
255 | # define ZEXPORTVA | ||
256 | #endif | ||
257 | #ifndef ZEXTERN | ||
258 | # define ZEXTERN extern | ||
259 | #endif | ||
260 | |||
261 | #ifndef FAR | ||
262 | # define FAR | ||
263 | #endif | ||
264 | |||
265 | #if !defined(__MACTYPES__) | ||
266 | typedef unsigned char Byte; /* 8 bits */ | ||
267 | #endif | ||
268 | typedef unsigned int uInt; /* 16 bits or more */ | ||
269 | typedef unsigned long uLong; /* 32 bits or more */ | ||
270 | |||
271 | #ifdef SMALL_MEDIUM | ||
272 | /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ | ||
273 | # define Bytef Byte FAR | ||
274 | #else | ||
275 | typedef Byte FAR Bytef; | ||
276 | #endif | ||
277 | typedef char FAR charf; | ||
278 | typedef int FAR intf; | ||
279 | typedef uInt FAR uIntf; | ||
280 | typedef uLong FAR uLongf; | ||
281 | |||
282 | #ifdef STDC | ||
283 | typedef void const *voidpc; | ||
284 | typedef void FAR *voidpf; | ||
285 | typedef void *voidp; | ||
286 | #else | ||
287 | typedef Byte const *voidpc; | ||
288 | typedef Byte FAR *voidpf; | ||
289 | typedef Byte *voidp; | ||
290 | #endif | ||
291 | |||
292 | #if 0 /* HAVE_UNISTD_H -- this line is updated by ./configure */ | ||
293 | # include <sys/types.h> /* for off_t */ | ||
294 | # include <unistd.h> /* for SEEK_* and off_t */ | ||
295 | # ifdef VMS | ||
296 | # include <unixio.h> /* for off_t */ | ||
297 | # endif | ||
298 | # define z_off_t off_t | ||
299 | #endif | ||
300 | #ifndef SEEK_SET | ||
301 | # define SEEK_SET 0 /* Seek from beginning of file. */ | ||
302 | # define SEEK_CUR 1 /* Seek from current position. */ | ||
303 | # define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ | ||
304 | #endif | ||
305 | #ifndef z_off_t | ||
306 | # define z_off_t long | ||
307 | #endif | ||
308 | |||
309 | /* MVS linker does not support external names larger than 8 bytes */ | ||
310 | #if defined(__MVS__) | ||
311 | # pragma map(deflateInit_,"DEIN") | ||
312 | # pragma map(deflateInit2_,"DEIN2") | ||
313 | # pragma map(deflateEnd,"DEEND") | ||
314 | # pragma map(deflateBound,"DEBND") | ||
315 | # pragma map(inflateInit_,"ININ") | ||
316 | # pragma map(inflateInit2_,"ININ2") | ||
317 | # pragma map(inflateEnd,"INEND") | ||
318 | # pragma map(inflateSync,"INSY") | ||
319 | # pragma map(inflateSetDictionary,"INSEDI") | ||
320 | # pragma map(compressBound,"CMBND") | ||
321 | # pragma map(inflate_table,"INTABL") | ||
322 | # pragma map(inflate_fast,"INFA") | ||
323 | # pragma map(inflate_copyright,"INCOPY") | ||
324 | #endif | ||
325 | |||
326 | #endif /* _ZCONF_H */ | ||