NCBI C++ ToolKit
miniz.h
Go to the documentation of this file.

Go to the SVN repository for this file.

1 #define MINIZ_EXPORT
2 /* miniz.c 2.2.0 - public domain deflate/inflate, zlib-subset, ZIP reading/writing/appending, PNG writing
3  See "unlicense" statement at the end of this file.
4  Rich Geldreich <richgel99@gmail.com>, last updated Oct. 13, 2013
5  Implements RFC 1950: http://www.ietf.org/rfc/rfc1950.txt and RFC 1951: http://www.ietf.org/rfc/rfc1951.txt
6 
7  Most API's defined in miniz.c are optional. For example, to disable the archive related functions just define
8  MINIZ_NO_ARCHIVE_APIS, or to get rid of all stdio usage define MINIZ_NO_STDIO (see the list below for more macros).
9 
10  * Low-level Deflate/Inflate implementation notes:
11 
12  Compression: Use the "tdefl" API's. The compressor supports raw, static, and dynamic blocks, lazy or
13  greedy parsing, match length filtering, RLE-only, and Huffman-only streams. It performs and compresses
14  approximately as well as zlib.
15 
16  Decompression: Use the "tinfl" API's. The entire decompressor is implemented as a single function
17  coroutine: see tinfl_decompress(). It supports decompression into a 32KB (or larger power of 2) wrapping buffer, or into a memory
18  block large enough to hold the entire file.
19 
20  The low-level tdefl/tinfl API's do not make any use of dynamic memory allocation.
21 
22  * zlib-style API notes:
23 
24  miniz.c implements a fairly large subset of zlib. There's enough functionality present for it to be a drop-in
25  zlib replacement in many apps:
26  The z_stream struct, optional memory allocation callbacks
27  deflateInit/deflateInit2/deflate/deflateReset/deflateEnd/deflateBound
28  inflateInit/inflateInit2/inflate/inflateReset/inflateEnd
29  compress, compress2, compressBound, uncompress
30  CRC-32, Adler-32 - Using modern, minimal code size, CPU cache friendly routines.
31  Supports raw deflate streams or standard zlib streams with adler-32 checking.
32 
33  Limitations:
34  The callback API's are not implemented yet. No support for gzip headers or zlib static dictionaries.
35  I've tried to closely emulate zlib's various flavors of stream flushing and return status codes, but
36  there are no guarantees that miniz.c pulls this off perfectly.
37 
38  * PNG writing: See the tdefl_write_image_to_png_file_in_memory() function, originally written by
39  Alex Evans. Supports 1-4 bytes/pixel images.
40 
41  * ZIP archive API notes:
42 
43  The ZIP archive API's where designed with simplicity and efficiency in mind, with just enough abstraction to
44  get the job done with minimal fuss. There are simple API's to retrieve file information, read files from
45  existing archives, create new archives, append new files to existing archives, or clone archive data from
46  one archive to another. It supports archives located in memory or the heap, on disk (using stdio.h),
47  or you can specify custom file read/write callbacks.
48 
49  - Archive reading: Just call this function to read a single file from a disk archive:
50 
51  void *mz_zip_extract_archive_file_to_heap(const char *pZip_filename, const char *pArchive_name,
52  size_t *pSize, mz_uint zip_flags);
53 
54  For more complex cases, use the "mz_zip_reader" functions. Upon opening an archive, the entire central
55  directory is located and read as-is into memory, and subsequent file access only occurs when reading individual files.
56 
57  - Archives file scanning: The simple way is to use this function to scan a loaded archive for a specific file:
58 
59  int mz_zip_reader_locate_file(mz_zip_archive *pZip, const char *pName, const char *pComment, mz_uint flags);
60 
61  The locate operation can optionally check file comments too, which (as one example) can be used to identify
62  multiple versions of the same file in an archive. This function uses a simple linear search through the central
63  directory, so it's not very fast.
64 
65  Alternately, you can iterate through all the files in an archive (using mz_zip_reader_get_num_files()) and
66  retrieve detailed info on each file by calling mz_zip_reader_file_stat().
67 
68  - Archive creation: Use the "mz_zip_writer" functions. The ZIP writer immediately writes compressed file data
69  to disk and builds an exact image of the central directory in memory. The central directory image is written
70  all at once at the end of the archive file when the archive is finalized.
71 
72  The archive writer can optionally align each file's local header and file data to any power of 2 alignment,
73  which can be useful when the archive will be read from optical media. Also, the writer supports placing
74  arbitrary data blobs at the very beginning of ZIP archives. Archives written using either feature are still
75  readable by any ZIP tool.
76 
77  - Archive appending: The simple way to add a single file to an archive is to call this function:
78 
79  mz_bool mz_zip_add_mem_to_archive_file_in_place(const char *pZip_filename, const char *pArchive_name,
80  const void *pBuf, size_t buf_size, const void *pComment, mz_uint16 comment_size, mz_uint level_and_flags);
81 
82  The archive will be created if it doesn't already exist, otherwise it'll be appended to.
83  Note the appending is done in-place and is not an atomic operation, so if something goes wrong
84  during the operation it's possible the archive could be left without a central directory (although the local
85  file headers and file data will be fine, so the archive will be recoverable).
86 
87  For more complex archive modification scenarios:
88  1. The safest way is to use a mz_zip_reader to read the existing archive, cloning only those bits you want to
89  preserve into a new archive using using the mz_zip_writer_add_from_zip_reader() function (which compiles the
90  compressed file data as-is). When you're done, delete the old archive and rename the newly written archive, and
91  you're done. This is safe but requires a bunch of temporary disk space or heap memory.
92 
93  2. Or, you can convert an mz_zip_reader in-place to an mz_zip_writer using mz_zip_writer_init_from_reader(),
94  append new files as needed, then finalize the archive which will write an updated central directory to the
95  original archive. (This is basically what mz_zip_add_mem_to_archive_file_in_place() does.) There's a
96  possibility that the archive's central directory could be lost with this method if anything goes wrong, though.
97 
98  - ZIP archive support limitations:
99  No spanning support. Extraction functions can only handle unencrypted, stored or deflated files.
100  Requires streams capable of seeking.
101 
102  * This is a header file library, like stb_image.c. To get only a header file, either cut and paste the
103  below header, or create miniz.h, #define MINIZ_HEADER_FILE_ONLY, and then include miniz.c from it.
104 
105  * Important: For best perf. be sure to customize the below macros for your target platform:
106  #define MINIZ_USE_UNALIGNED_LOADS_AND_STORES 1
107  #define MINIZ_LITTLE_ENDIAN 1
108  #define MINIZ_HAS_64BIT_REGISTERS 1
109 
110  * On platforms using glibc, Be sure to "#define _LARGEFILE64_SOURCE 1" before including miniz.c to ensure miniz
111  uses the 64-bit variants: fopen64(), stat64(), etc. Otherwise you won't be able to process large files
112  (i.e. 32-bit stat() fails for me on files > 0x7FFFFFFF bytes).
113 */
114 #pragma once
115 
116 
117 
118 /* Defines to completely disable specific portions of miniz.c:
119  If all macros here are defined the only functionality remaining will be CRC-32, adler-32, tinfl, and tdefl. */
120 
121 /* Define MINIZ_NO_STDIO to disable all usage and any functions which rely on stdio for file I/O. */
122 /*#define MINIZ_NO_STDIO */
123 
124 /* If MINIZ_NO_TIME is specified then the ZIP archive functions will not be able to get the current time, or */
125 /* get/set file times, and the C run-time funcs that get/set times won't be called. */
126 /* The current downside is the times written to your archives will be from 1979. */
127 /*#define MINIZ_NO_TIME */
128 
129 /* Define MINIZ_NO_ARCHIVE_APIS to disable all ZIP archive API's. */
130 /*#define MINIZ_NO_ARCHIVE_APIS */
131 
132 /* Define MINIZ_NO_ARCHIVE_WRITING_APIS to disable all writing related ZIP archive API's. */
133 /*#define MINIZ_NO_ARCHIVE_WRITING_APIS */
134 
135 /* Define MINIZ_NO_ZLIB_APIS to remove all ZLIB-style compression/decompression API's. */
136 /*#define MINIZ_NO_ZLIB_APIS */
137 
138 /* Define MINIZ_NO_ZLIB_COMPATIBLE_NAME to disable zlib names, to prevent conflicts against stock zlib. */
139 /*#define MINIZ_NO_ZLIB_COMPATIBLE_NAMES */
140 
141 /* Define MINIZ_NO_MALLOC to disable all calls to malloc, free, and realloc.
142  Note if MINIZ_NO_MALLOC is defined then the user must always provide custom user alloc/free/realloc
143  callbacks to the zlib and archive API's, and a few stand-alone helper API's which don't provide custom user
144  functions (such as tdefl_compress_mem_to_heap() and tinfl_decompress_mem_to_heap()) won't work. */
145 /*#define MINIZ_NO_MALLOC */
146 
147 #if defined(__TINYC__) && (defined(__linux) || defined(__linux__))
148 /* TODO: Work around "error: include file 'sys\utime.h' when compiling with tcc on Linux */
149 #define MINIZ_NO_TIME
150 #endif
151 
152 #include <stddef.h>
153 
154 #if !defined(MINIZ_NO_TIME) && !defined(MINIZ_NO_ARCHIVE_APIS)
155 #include <time.h>
156 #endif
157 
158 #if defined(_M_IX86) || defined(_M_X64) || defined(__i386__) || defined(__i386) || defined(__i486__) || defined(__i486) || defined(i386) || defined(__ia64__) || defined(__x86_64__)
159 /* MINIZ_X86_OR_X64_CPU is only used to help set the below macros. */
160 #define MINIZ_X86_OR_X64_CPU 1
161 #else
162 #define MINIZ_X86_OR_X64_CPU 0
163 #endif
164 
165 #if (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) || MINIZ_X86_OR_X64_CPU
166 /* Set MINIZ_LITTLE_ENDIAN to 1 if the processor is little endian. */
167 #define MINIZ_LITTLE_ENDIAN 1
168 #else
169 #define MINIZ_LITTLE_ENDIAN 0
170 #endif
171 
172 /* Set MINIZ_USE_UNALIGNED_LOADS_AND_STORES only if not set */
173 #if !defined(MINIZ_USE_UNALIGNED_LOADS_AND_STORES)
174 #if MINIZ_X86_OR_X64_CPU
175 /* Set MINIZ_USE_UNALIGNED_LOADS_AND_STORES to 1 on CPU's that permit efficient integer loads and stores from unaligned addresses. */
176 #define MINIZ_USE_UNALIGNED_LOADS_AND_STORES 1
177 #define MINIZ_UNALIGNED_USE_MEMCPY
178 #else
179 #define MINIZ_USE_UNALIGNED_LOADS_AND_STORES 0
180 #endif
181 #endif
182 
183 #if defined(_M_X64) || defined(_WIN64) || defined(__MINGW64__) || defined(_LP64) || defined(__LP64__) || defined(__ia64__) || defined(__x86_64__)
184 /* Set MINIZ_HAS_64BIT_REGISTERS to 1 if operations on 64-bit integers are reasonably fast (and don't involve compiler generated calls to helper functions). */
185 #define MINIZ_HAS_64BIT_REGISTERS 1
186 #else
187 #define MINIZ_HAS_64BIT_REGISTERS 0
188 #endif
189 
190 #ifdef __cplusplus
191 extern "C" {
192 #endif
193 
194 /* ------------------- zlib-style API Definitions. */
195 
196 /* For more compatibility with zlib, miniz.c uses unsigned long for some parameters/struct members. Beware: mz_ulong can be either 32 or 64-bits! */
197 typedef unsigned long mz_ulong;
198 
199 /* mz_free() internally uses the MZ_FREE() macro (which by default calls free() unless you've modified the MZ_MALLOC macro) to release a block allocated from the heap. */
200 MINIZ_EXPORT void mz_free(void *p);
201 
202 #define MZ_ADLER32_INIT (1)
203 /* mz_adler32() returns the initial adler-32 value to use when called with ptr==NULL. */
204 MINIZ_EXPORT mz_ulong mz_adler32(mz_ulong adler, const unsigned char *ptr, size_t buf_len);
205 
206 #define MZ_CRC32_INIT (0)
207 /* mz_crc32() returns the initial CRC-32 value to use when called with ptr==NULL. */
208 MINIZ_EXPORT mz_ulong mz_crc32(mz_ulong crc, const unsigned char *ptr, size_t buf_len);
209 
210 /* Compression strategies. */
211 enum
212 {
216  MZ_RLE = 3,
217  MZ_FIXED = 4
218 };
219 
220 /* Method */
221 #define MZ_DEFLATED 8
222 
223 /* Heap allocation callbacks.
224 Note that mz_alloc_func parameter types purposely differ from zlib's: items/size is size_t, not unsigned long. */
225 typedef void *(*mz_alloc_func)(void *opaque, size_t items, size_t size);
226 typedef void (*mz_free_func)(void *opaque, void *address);
227 typedef void *(*mz_realloc_func)(void *opaque, void *address, size_t items, size_t size);
228 
229 /* Compression levels: 0-9 are the standard zlib-style levels, 10 is best possible compression (not zlib compatible, and may be very slow), MZ_DEFAULT_COMPRESSION=MZ_DEFAULT_LEVEL. */
230 enum
231 {
238 };
239 
240 #define MZ_VERSION "10.2.0"
241 #define MZ_VERNUM 0xA100
242 #define MZ_VER_MAJOR 10
243 #define MZ_VER_MINOR 2
244 #define MZ_VER_REVISION 0
245 #define MZ_VER_SUBREVISION 0
246 
247 #ifndef MINIZ_NO_ZLIB_APIS
248 
249 /* Flush values. For typical usage you only need MZ_NO_FLUSH and MZ_FINISH. The other values are for advanced use (refer to the zlib docs). */
250 enum
251 {
257  MZ_BLOCK = 5
258 };
259 
260 /* Return status codes. MZ_PARAM_ERROR is non-standard. */
261 enum
262 {
263  MZ_OK = 0,
266  MZ_ERRNO = -1,
272  MZ_PARAM_ERROR = -10000
273 };
274 
275 /* Window bits */
276 #define MZ_DEFAULT_WINDOW_BITS 15
277 
278 struct mz_internal_state;
279 
280 /* Compression/decompression stream struct. */
281 typedef struct mz_stream_s
282 {
283  const unsigned char *next_in; /* pointer to next byte to read */
284  unsigned int avail_in; /* number of bytes available at next_in */
285  mz_ulong total_in; /* total number of bytes consumed so far */
286 
287  unsigned char *next_out; /* pointer to next byte to write */
288  unsigned int avail_out; /* number of bytes that can be written to next_out */
289  mz_ulong total_out; /* total number of bytes produced so far */
290 
291  char *msg; /* error msg (unused) */
292  struct mz_internal_state *state; /* internal state, allocated by zalloc/zfree */
293 
294  mz_alloc_func zalloc; /* optional heap allocation function (defaults to malloc) */
295  mz_free_func zfree; /* optional heap free function (defaults to free) */
296  void *opaque; /* heap alloc function user pointer */
297 
298  int data_type; /* data_type (unused) */
299  mz_ulong adler; /* adler32 of the source or uncompressed data */
300  mz_ulong reserved; /* not used */
302 
304 
305 /* Returns the version string of miniz.c. */
306 MINIZ_EXPORT const char *mz_version(void);
307 
308 /* mz_deflateInit() initializes a compressor with default options: */
309 /* Parameters: */
310 /* pStream must point to an initialized mz_stream struct. */
311 /* level must be between [MZ_NO_COMPRESSION, MZ_BEST_COMPRESSION]. */
312 /* level 1 enables a specially optimized compression function that's been optimized purely for performance, not ratio. */
313 /* (This special func. is currently only enabled when MINIZ_USE_UNALIGNED_LOADS_AND_STORES and MINIZ_LITTLE_ENDIAN are defined.) */
314 /* Return values: */
315 /* MZ_OK on success. */
316 /* MZ_STREAM_ERROR if the stream is bogus. */
317 /* MZ_PARAM_ERROR if the input parameters are bogus. */
318 /* MZ_MEM_ERROR on out of memory. */
319 MINIZ_EXPORT int mz_deflateInit(mz_streamp pStream, int level);
320 
321 /* mz_deflateInit2() is like mz_deflate(), except with more control: */
322 /* Additional parameters: */
323 /* method must be MZ_DEFLATED */
324 /* window_bits must be MZ_DEFAULT_WINDOW_BITS (to wrap the deflate stream with zlib header/adler-32 footer) or -MZ_DEFAULT_WINDOW_BITS (raw deflate/no header or footer) */
325 /* mem_level must be between [1, 9] (it's checked but ignored by miniz.c) */
326 MINIZ_EXPORT int mz_deflateInit2(mz_streamp pStream, int level, int method, int window_bits, int mem_level, int strategy);
327 
328 /* Quickly resets a compressor without having to reallocate anything. Same as calling mz_deflateEnd() followed by mz_deflateInit()/mz_deflateInit2(). */
330 
331 /* mz_deflate() compresses the input to output, consuming as much of the input and producing as much output as possible. */
332 /* Parameters: */
333 /* pStream is the stream to read from and write to. You must initialize/update the next_in, avail_in, next_out, and avail_out members. */
334 /* flush may be MZ_NO_FLUSH, MZ_PARTIAL_FLUSH/MZ_SYNC_FLUSH, MZ_FULL_FLUSH, or MZ_FINISH. */
335 /* Return values: */
336 /* MZ_OK on success (when flushing, or if more input is needed but not available, and/or there's more output to be written but the output buffer is full). */
337 /* MZ_STREAM_END if all input has been consumed and all output bytes have been written. Don't call mz_deflate() on the stream anymore. */
338 /* MZ_STREAM_ERROR if the stream is bogus. */
339 /* MZ_PARAM_ERROR if one of the parameters is invalid. */
340 /* MZ_BUF_ERROR if no forward progress is possible because the input and/or output buffers are empty. (Fill up the input buffer or free up some output space and try again.) */
341 MINIZ_EXPORT int mz_deflate(mz_streamp pStream, int flush);
342 
343 /* mz_deflateEnd() deinitializes a compressor: */
344 /* Return values: */
345 /* MZ_OK on success. */
346 /* MZ_STREAM_ERROR if the stream is bogus. */
348 
349 /* mz_deflateBound() returns a (very) conservative upper bound on the amount of data that could be generated by deflate(), assuming flush is set to only MZ_NO_FLUSH or MZ_FINISH. */
351 
352 /* Single-call compression functions mz_compress() and mz_compress2(): */
353 /* Returns MZ_OK on success, or one of the error codes from mz_deflate() on failure. */
354 MINIZ_EXPORT int mz_compress(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len);
355 MINIZ_EXPORT int mz_compress2(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len, int level);
356 
357 /* mz_compressBound() returns a (very) conservative upper bound on the amount of data that could be generated by calling mz_compress(). */
359 
360 /* Initializes a decompressor. */
362 
363 /* mz_inflateInit2() is like mz_inflateInit() with an additional option that controls the window size and whether or not the stream has been wrapped with a zlib header/footer: */
364 /* window_bits must be MZ_DEFAULT_WINDOW_BITS (to parse zlib header/footer) or -MZ_DEFAULT_WINDOW_BITS (raw deflate). */
365 MINIZ_EXPORT int mz_inflateInit2(mz_streamp pStream, int window_bits);
366 
367 /* Quickly resets a compressor without having to reallocate anything. Same as calling mz_inflateEnd() followed by mz_inflateInit()/mz_inflateInit2(). */
369 
370 /* Decompresses the input stream to the output, consuming only as much of the input as needed, and writing as much to the output as possible. */
371 /* Parameters: */
372 /* pStream is the stream to read from and write to. You must initialize/update the next_in, avail_in, next_out, and avail_out members. */
373 /* flush may be MZ_NO_FLUSH, MZ_SYNC_FLUSH, or MZ_FINISH. */
374 /* On the first call, if flush is MZ_FINISH it's assumed the input and output buffers are both sized large enough to decompress the entire stream in a single call (this is slightly faster). */
375 /* MZ_FINISH implies that there are no more source bytes available beside what's already in the input buffer, and that the output buffer is large enough to hold the rest of the decompressed data. */
376 /* Return values: */
377 /* MZ_OK on success. Either more input is needed but not available, and/or there's more output to be written but the output buffer is full. */
378 /* MZ_STREAM_END if all needed input has been consumed and all output bytes have been written. For zlib streams, the adler-32 of the decompressed data has also been verified. */
379 /* MZ_STREAM_ERROR if the stream is bogus. */
380 /* MZ_DATA_ERROR if the deflate stream is invalid. */
381 /* MZ_PARAM_ERROR if one of the parameters is invalid. */
382 /* MZ_BUF_ERROR if no forward progress is possible because the input buffer is empty but the inflater needs more input to continue, or if the output buffer is not large enough. Call mz_inflate() again */
383 /* with more input data, or with more room in the output buffer (except when using single call decompression, described above). */
384 MINIZ_EXPORT int mz_inflate(mz_streamp pStream, int flush);
385 
386 /* Deinitializes a decompressor. */
388 
389 /* Single-call decompression. */
390 /* Returns MZ_OK on success, or one of the error codes from mz_inflate() on failure. */
391 MINIZ_EXPORT int mz_uncompress(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len);
392 MINIZ_EXPORT int mz_uncompress2(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong *pSource_len);
393 
394 /* Returns a string description of the specified error code, or NULL if the error code is invalid. */
395 MINIZ_EXPORT const char *mz_error(int err);
396 
397 /* Redefine zlib-compatible names to miniz equivalents, so miniz.c can be used as a drop-in replacement for the subset of zlib that miniz.c supports. */
398 /* Define MINIZ_NO_ZLIB_COMPATIBLE_NAMES to disable zlib-compatibility if you use zlib in the same project. */
399 #ifndef MINIZ_NO_ZLIB_COMPATIBLE_NAMES
400 typedef unsigned char Byte;
401 typedef unsigned int uInt;
402 typedef mz_ulong uLong;
403 typedef Byte Bytef;
404 typedef uInt uIntf;
405 typedef char charf;
406 typedef int intf;
407 typedef void *voidpf;
408 typedef uLong uLongf;
409 typedef void *voidp;
410 typedef void *const voidpc;
411 #define Z_NULL 0
412 #define Z_NO_FLUSH MZ_NO_FLUSH
413 #define Z_PARTIAL_FLUSH MZ_PARTIAL_FLUSH
414 #define Z_SYNC_FLUSH MZ_SYNC_FLUSH
415 #define Z_FULL_FLUSH MZ_FULL_FLUSH
416 #define Z_FINISH MZ_FINISH
417 #define Z_BLOCK MZ_BLOCK
418 #define Z_OK MZ_OK
419 #define Z_STREAM_END MZ_STREAM_END
420 #define Z_NEED_DICT MZ_NEED_DICT
421 #define Z_ERRNO MZ_ERRNO
422 #define Z_STREAM_ERROR MZ_STREAM_ERROR
423 #define Z_DATA_ERROR MZ_DATA_ERROR
424 #define Z_MEM_ERROR MZ_MEM_ERROR
425 #define Z_BUF_ERROR MZ_BUF_ERROR
426 #define Z_VERSION_ERROR MZ_VERSION_ERROR
427 #define Z_PARAM_ERROR MZ_PARAM_ERROR
428 #define Z_NO_COMPRESSION MZ_NO_COMPRESSION
429 #define Z_BEST_SPEED MZ_BEST_SPEED
430 #define Z_BEST_COMPRESSION MZ_BEST_COMPRESSION
431 #define Z_DEFAULT_COMPRESSION MZ_DEFAULT_COMPRESSION
432 #define Z_DEFAULT_STRATEGY MZ_DEFAULT_STRATEGY
433 #define Z_FILTERED MZ_FILTERED
434 #define Z_HUFFMAN_ONLY MZ_HUFFMAN_ONLY
435 #define Z_RLE MZ_RLE
436 #define Z_FIXED MZ_FIXED
437 #define Z_DEFLATED MZ_DEFLATED
438 #define Z_DEFAULT_WINDOW_BITS MZ_DEFAULT_WINDOW_BITS
439 #define alloc_func mz_alloc_func
440 #define free_func mz_free_func
441 #define internal_state mz_internal_state
442 #define z_stream mz_stream
443 #define deflateInit mz_deflateInit
444 #define deflateInit2 mz_deflateInit2
445 #define deflateReset mz_deflateReset
446 #define deflate mz_deflate
447 #define deflateEnd mz_deflateEnd
448 #define deflateBound mz_deflateBound
449 #define compress mz_compress
450 #define compress2 mz_compress2
451 #define compressBound mz_compressBound
452 #define inflateInit mz_inflateInit
453 #define inflateInit2 mz_inflateInit2
454 #define inflateReset mz_inflateReset
455 #define inflate mz_inflate
456 #define inflateEnd mz_inflateEnd
457 #define uncompress mz_uncompress
458 #define uncompress2 mz_uncompress2
459 #define crc32 mz_crc32
460 #define adler32 mz_adler32
461 #define MAX_WBITS 15
462 #define MAX_MEM_LEVEL 9
463 #define zError mz_error
464 #define ZLIB_VERSION MZ_VERSION
465 #define ZLIB_VERNUM MZ_VERNUM
466 #define ZLIB_VER_MAJOR MZ_VER_MAJOR
467 #define ZLIB_VER_MINOR MZ_VER_MINOR
468 #define ZLIB_VER_REVISION MZ_VER_REVISION
469 #define ZLIB_VER_SUBREVISION MZ_VER_SUBREVISION
470 #define zlibVersion mz_version
471 #define zlib_version mz_version()
472 #endif /* #ifndef MINIZ_NO_ZLIB_COMPATIBLE_NAMES */
473 
474 #endif /* MINIZ_NO_ZLIB_APIS */
475 
476 #ifdef __cplusplus
477 }
478 #endif
479 
480 
481 
482 
483 
484 #pragma once
485 #include <assert.h>
486 #include <stdint.h>
487 #include <stdlib.h>
488 #include <string.h>
489 
490 
491 
492 /* ------------------- Types and macros */
493 typedef unsigned char mz_uint8;
494 typedef signed short mz_int16;
495 typedef unsigned short mz_uint16;
496 typedef unsigned int mz_uint32;
497 typedef unsigned int mz_uint;
500 typedef int mz_bool;
501 
502 #define MZ_FALSE (0)
503 #define MZ_TRUE (1)
504 
505 /* Works around MSVC's spammy "warning C4127: conditional expression is constant" message. */
506 #ifdef _MSC_VER
507 #define MZ_MACRO_END while (0, 0)
508 #else
509 #define MZ_MACRO_END while (0)
510 #endif
511 
512 #ifdef MINIZ_NO_STDIO
513 #define MZ_FILE void *
514 #else
515 #include <stdio.h>
516 #define MZ_FILE FILE
517 #endif /* #ifdef MINIZ_NO_STDIO */
518 
519 #ifdef MINIZ_NO_TIME
520 typedef struct mz_dummy_time_t_tag
521 {
522  int m_dummy;
523 } mz_dummy_time_t;
524 #define MZ_TIME_T mz_dummy_time_t
525 #else
526 #define MZ_TIME_T time_t
527 #endif
528 
529 #define MZ_ASSERT(x) assert(x)
530 
531 #ifdef MINIZ_NO_MALLOC
532 #define MZ_MALLOC(x) NULL
533 #define MZ_FREE(x) (void)x, ((void)0)
534 #define MZ_REALLOC(p, x) NULL
535 #else
536 #define MZ_MALLOC(x) malloc(x)
537 #define MZ_FREE(x) free(x)
538 #define MZ_REALLOC(p, x) realloc(p, x)
539 #endif
540 
541 #define MZ_MAX(a, b) (((a) > (b)) ? (a) : (b))
542 #define MZ_MIN(a, b) (((a) < (b)) ? (a) : (b))
543 #define MZ_CLEAR_OBJ(obj) memset(&(obj), 0, sizeof(obj))
544 
545 #if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && MINIZ_LITTLE_ENDIAN
546 #define MZ_READ_LE16(p) *((const mz_uint16 *)(p))
547 #define MZ_READ_LE32(p) *((const mz_uint32 *)(p))
548 #else
549 #define MZ_READ_LE16(p) ((mz_uint32)(((const mz_uint8 *)(p))[0]) | ((mz_uint32)(((const mz_uint8 *)(p))[1]) << 8U))
550 #define MZ_READ_LE32(p) ((mz_uint32)(((const mz_uint8 *)(p))[0]) | ((mz_uint32)(((const mz_uint8 *)(p))[1]) << 8U) | ((mz_uint32)(((const mz_uint8 *)(p))[2]) << 16U) | ((mz_uint32)(((const mz_uint8 *)(p))[3]) << 24U))
551 #endif
552 
553 #define MZ_READ_LE64(p) (((mz_uint64)MZ_READ_LE32(p)) | (((mz_uint64)MZ_READ_LE32((const mz_uint8 *)(p) + sizeof(mz_uint32))) << 32U))
554 
555 #ifdef _MSC_VER
556 #define MZ_FORCEINLINE __forceinline
557 #elif defined(__GNUC__)
558 #define MZ_FORCEINLINE __inline__ __attribute__((__always_inline__))
559 #else
560 #define MZ_FORCEINLINE inline
561 #endif
562 
563 #ifdef __cplusplus
564 extern "C" {
565 #endif
566 
567 extern MINIZ_EXPORT void *miniz_def_alloc_func(void *opaque, size_t items, size_t size);
568 extern MINIZ_EXPORT void miniz_def_free_func(void *opaque, void *address);
569 extern MINIZ_EXPORT void *miniz_def_realloc_func(void *opaque, void *address, size_t items, size_t size);
570 
571 #define MZ_UINT16_MAX (0xFFFFU)
572 #define MZ_UINT32_MAX (0xFFFFFFFFU)
573 
574 #ifdef __cplusplus
575 }
576 #endif
577  #pragma once
578 
579 
580 #ifdef __cplusplus
581 extern "C" {
582 #endif
583 /* ------------------- Low-level Compression API Definitions */
584 
585 /* Set TDEFL_LESS_MEMORY to 1 to use less memory (compression will be slightly slower, and raw/dynamic blocks will be output more frequently). */
586 #define TDEFL_LESS_MEMORY 0
587 
588 /* tdefl_init() compression flags logically OR'd together (low 12 bits contain the max. number of probes per dictionary search): */
589 /* TDEFL_DEFAULT_MAX_PROBES: The compressor defaults to 128 dictionary probes per dictionary search. 0=Huffman only, 1=Huffman+LZ (fastest/crap compression), 4095=Huffman+LZ (slowest/best compression). */
590 enum
591 {
594  TDEFL_MAX_PROBES_MASK = 0xFFF
595 };
596 
597 /* TDEFL_WRITE_ZLIB_HEADER: If set, the compressor outputs a zlib header before the deflate data, and the Adler-32 of the source data at the end. Otherwise, you'll get raw deflate data. */
598 /* TDEFL_COMPUTE_ADLER32: Always compute the adler-32 of the input data (even when not writing zlib headers). */
599 /* TDEFL_GREEDY_PARSING_FLAG: Set to use faster greedy parsing, instead of more efficient lazy parsing. */
600 /* TDEFL_NONDETERMINISTIC_PARSING_FLAG: Enable to decrease the compressor's initialization time to the minimum, but the output may vary from run to run given the same input (depending on the contents of memory). */
601 /* TDEFL_RLE_MATCHES: Only look for RLE matches (matches with a distance of 1) */
602 /* TDEFL_FILTER_MATCHES: Discards matches <= 5 chars if enabled. */
603 /* TDEFL_FORCE_ALL_STATIC_BLOCKS: Disable usage of optimized Huffman tables. */
604 /* TDEFL_FORCE_ALL_RAW_BLOCKS: Only use raw (uncompressed) deflate blocks. */
605 /* The low 12 bits are reserved to control the max # of hash probes per dictionary lookup (see TDEFL_MAX_PROBES_MASK). */
606 enum
607 {
612  TDEFL_RLE_MATCHES = 0x10000,
616 };
617 
618 /* High level compression functions: */
619 /* tdefl_compress_mem_to_heap() compresses a block in memory to a heap block allocated via malloc(). */
620 /* On entry: */
621 /* pSrc_buf, src_buf_len: Pointer and size of source block to compress. */
622 /* flags: The max match finder probes (default is 128) logically OR'd against the above flags. Higher probes are slower but improve compression. */
623 /* On return: */
624 /* Function returns a pointer to the compressed data, or NULL on failure. */
625 /* *pOut_len will be set to the compressed data's size, which could be larger than src_buf_len on uncompressible data. */
626 /* The caller must free() the returned block when it's no longer needed. */
627 MINIZ_EXPORT void *tdefl_compress_mem_to_heap(const void *pSrc_buf, size_t src_buf_len, size_t *pOut_len, int flags);
628 
629 /* tdefl_compress_mem_to_mem() compresses a block in memory to another block in memory. */
630 /* Returns 0 on failure. */
631 MINIZ_EXPORT size_t tdefl_compress_mem_to_mem(void *pOut_buf, size_t out_buf_len, const void *pSrc_buf, size_t src_buf_len, int flags);
632 
633 /* Compresses an image to a compressed PNG file in memory. */
634 /* On entry: */
635 /* pImage, w, h, and num_chans describe the image to compress. num_chans may be 1, 2, 3, or 4. */
636 /* The image pitch in bytes per scanline will be w*num_chans. The leftmost pixel on the top scanline is stored first in memory. */
637 /* level may range from [0,10], use MZ_NO_COMPRESSION, MZ_BEST_SPEED, MZ_BEST_COMPRESSION, etc. or a decent default is MZ_DEFAULT_LEVEL */
638 /* If flip is true, the image will be flipped on the Y axis (useful for OpenGL apps). */
639 /* On return: */
640 /* Function returns a pointer to the compressed data, or NULL on failure. */
641 /* *pLen_out will be set to the size of the PNG image file. */
642 /* The caller must mz_free() the returned heap block (which will typically be larger than *pLen_out) when it's no longer needed. */
643 MINIZ_EXPORT void *tdefl_write_image_to_png_file_in_memory_ex(const void *pImage, int w, int h, int num_chans, size_t *pLen_out, mz_uint level, mz_bool flip);
644 MINIZ_EXPORT void *tdefl_write_image_to_png_file_in_memory(const void *pImage, int w, int h, int num_chans, size_t *pLen_out);
645 
646 /* Output stream interface. The compressor uses this interface to write compressed data. It'll typically be called TDEFL_OUT_BUF_SIZE at a time. */
647 typedef mz_bool (*tdefl_put_buf_func_ptr)(const void *pBuf, int len, void *pUser);
648 
649 /* tdefl_compress_mem_to_output() compresses a block to an output stream. The above helpers use this function internally. */
650 MINIZ_EXPORT mz_bool tdefl_compress_mem_to_output(const void *pBuf, size_t buf_len, tdefl_put_buf_func_ptr pPut_buf_func, void *pPut_buf_user, int flags);
651 
652 enum
653 {
661  TDEFL_MAX_MATCH_LEN = 258
662 };
663 
664 /* TDEFL_OUT_BUF_SIZE MUST be large enough to hold a single entire compressed output block (using static/fixed Huffman codes). */
665 #if TDEFL_LESS_MEMORY
666 enum
667 {
668  TDEFL_LZ_CODE_BUF_SIZE = 24 * 1024,
671  TDEFL_LZ_HASH_BITS = 12,
675 };
676 #else
677 enum
678 {
686 };
687 #endif
688 
689 /* The low-level tdefl functions below may be used directly if the above helper functions aren't flexible enough. The low-level functions don't make any heap allocations, unlike the above helper functions. */
690 typedef enum {
696 
697 /* Must map to MZ_NO_FLUSH, MZ_SYNC_FLUSH, etc. enums */
698 typedef enum {
702  TDEFL_FINISH = 4
704 
705 /* tdefl's compression state structure. */
706 typedef struct
707 {
710  mz_uint m_flags, m_max_probes[2];
712  mz_uint m_adler32, m_lookahead_pos, m_lookahead_size, m_dict_size;
713  mz_uint8 *m_pLZ_code_buf, *m_pLZ_flags, *m_pOutput_buf, *m_pOutput_buf_end;
714  mz_uint m_num_flags_left, m_total_lz_bytes, m_lz_code_buf_dict_pos, m_bits_in, m_bit_buffer;
715  mz_uint m_saved_match_dist, m_saved_match_len, m_saved_lit, m_output_flush_ofs, m_output_flush_remaining, m_finished, m_block_index, m_wants_to_finish;
717  const void *m_pIn_buf;
718  void *m_pOut_buf;
719  size_t *m_pIn_buf_size, *m_pOut_buf_size;
721  const mz_uint8 *m_pSrc;
722  size_t m_src_buf_left, m_out_buf_ofs;
732 
733 /* Initializes the compressor. */
734 /* There is no corresponding deinit() function because the tdefl API's do not dynamically allocate memory. */
735 /* pBut_buf_func: If NULL, output data will be supplied to the specified callback. In this case, the user should call the tdefl_compress_buffer() API for compression. */
736 /* If pBut_buf_func is NULL the user should always call the tdefl_compress() API. */
737 /* flags: See the above enums (TDEFL_HUFFMAN_ONLY, TDEFL_WRITE_ZLIB_HEADER, etc.) */
738 MINIZ_EXPORT tdefl_status tdefl_init(tdefl_compressor *d, tdefl_put_buf_func_ptr pPut_buf_func, void *pPut_buf_user, int flags);
739 
740 /* Compresses a block of data, consuming as much of the specified input buffer as possible, and writing as much compressed data to the specified output buffer as possible. */
741 MINIZ_EXPORT tdefl_status tdefl_compress(tdefl_compressor *d, const void *pIn_buf, size_t *pIn_buf_size, void *pOut_buf, size_t *pOut_buf_size, tdefl_flush flush);
742 
743 /* tdefl_compress_buffer() is only usable when the tdefl_init() is called with a non-NULL tdefl_put_buf_func_ptr. */
744 /* tdefl_compress_buffer() always consumes the entire input buffer. */
745 MINIZ_EXPORT tdefl_status tdefl_compress_buffer(tdefl_compressor *d, const void *pIn_buf, size_t in_buf_size, tdefl_flush flush);
746 
749 
750 /* Create tdefl_compress() flags given zlib-style compression parameters. */
751 /* level may range from [0,10] (where 10 is absolute max compression, but may be much slower on some files) */
752 /* window_bits may be -15 (raw deflate) or 15 (zlib) */
753 /* strategy may be either MZ_DEFAULT_STRATEGY, MZ_FILTERED, MZ_HUFFMAN_ONLY, MZ_RLE, or MZ_FIXED */
755 
756 #ifndef MINIZ_NO_MALLOC
757 /* Allocate the tdefl_compressor structure in C so that */
758 /* non-C language bindings to tdefl_ API don't need to worry about */
759 /* structure size and allocation mechanism. */
762 #endif
763 
764 #ifdef __cplusplus
765 }
766 #endif
767  #pragma once
768 
769 /* ------------------- Low-level Decompression API Definitions */
770 
771 #ifdef __cplusplus
772 extern "C" {
773 #endif
774 /* Decompression flags used by tinfl_decompress(). */
775 /* TINFL_FLAG_PARSE_ZLIB_HEADER: If set, the input has a valid zlib header and ends with an adler32 checksum (it's a valid zlib stream). Otherwise, the input is a raw deflate stream. */
776 /* TINFL_FLAG_HAS_MORE_INPUT: If set, there are more input bytes available beyond the end of the supplied input buffer. If clear, the input buffer contains all remaining input. */
777 /* TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF: If set, the output buffer is large enough to hold the entire decompressed stream. If clear, the output buffer is at least the size of the dictionary (typically 32KB). */
778 /* TINFL_FLAG_COMPUTE_ADLER32: Force adler-32 checksum computation of the decompressed bytes. */
779 enum
780 {
785 };
786 
787 /* High level decompression functions: */
788 /* tinfl_decompress_mem_to_heap() decompresses a block in memory to a heap block allocated via malloc(). */
789 /* On entry: */
790 /* pSrc_buf, src_buf_len: Pointer and size of the Deflate or zlib source data to decompress. */
791 /* On return: */
792 /* Function returns a pointer to the decompressed data, or NULL on failure. */
793 /* *pOut_len will be set to the decompressed data's size, which could be larger than src_buf_len on uncompressible data. */
794 /* The caller must call mz_free() on the returned block when it's no longer needed. */
795 MINIZ_EXPORT void *tinfl_decompress_mem_to_heap(const void *pSrc_buf, size_t src_buf_len, size_t *pOut_len, int flags);
796 
797 /* tinfl_decompress_mem_to_mem() decompresses a block in memory to another block in memory. */
798 /* Returns TINFL_DECOMPRESS_MEM_TO_MEM_FAILED on failure, or the number of bytes written on success. */
799 #define TINFL_DECOMPRESS_MEM_TO_MEM_FAILED ((size_t)(-1))
800 MINIZ_EXPORT size_t tinfl_decompress_mem_to_mem(void *pOut_buf, size_t out_buf_len, const void *pSrc_buf, size_t src_buf_len, int flags);
801 
802 /* tinfl_decompress_mem_to_callback() decompresses a block in memory to an internal 32KB buffer, and a user provided callback function will be called to flush the buffer. */
803 /* Returns 1 on success or 0 on failure. */
804 typedef int (*tinfl_put_buf_func_ptr)(const void *pBuf, int len, void *pUser);
805 MINIZ_EXPORT int tinfl_decompress_mem_to_callback(const void *pIn_buf, size_t *pIn_buf_size, tinfl_put_buf_func_ptr pPut_buf_func, void *pPut_buf_user, int flags);
806 
809 
810 #ifndef MINIZ_NO_MALLOC
811 /* Allocate the tinfl_decompressor structure in C so that */
812 /* non-C language bindings to tinfl_ API don't need to worry about */
813 /* structure size and allocation mechanism. */
816 #endif
817 
818 /* Max size of LZ dictionary. */
819 #define TINFL_LZ_DICT_SIZE 32768
820 
821 /* Return status. */
822 typedef enum {
823  /* This flags indicates the inflator needs 1 or more input bytes to make forward progress, but the caller is indicating that no more are available. The compressed data */
824  /* is probably corrupted. If you call the inflator again with more bytes it'll try to continue processing the input but this is a BAD sign (either the data is corrupted or you called it incorrectly). */
825  /* If you call it again with no input you'll just get TINFL_STATUS_FAILED_CANNOT_MAKE_PROGRESS again. */
827 
828  /* This flag indicates that one or more of the input parameters was obviously bogus. (You can try calling it again, but if you get this error the calling code is wrong.) */
830 
831  /* This flags indicate the inflator is finished but the adler32 check of the uncompressed data didn't match. If you call it again it'll return TINFL_STATUS_DONE. */
833 
834  /* This flags indicate the inflator has somehow failed (bad code, corrupted input, etc.). If you call it again without resetting via tinfl_init() it it'll just keep on returning the same status failure code. */
836 
837  /* Any status code less than TINFL_STATUS_DONE must indicate a failure. */
838 
839  /* This flag indicates the inflator has returned every byte of uncompressed data that it can, has consumed every byte that it needed, has successfully reached the end of the deflate stream, and */
840  /* if zlib headers and adler32 checking enabled that it has successfully checked the uncompressed data's adler32. If you call it again you'll just get TINFL_STATUS_DONE over and over again. */
842 
843  /* This flag indicates the inflator MUST have more input data (even 1 byte) before it can make any more forward progress, or you need to clear the TINFL_FLAG_HAS_MORE_INPUT */
844  /* flag on the next call if you don't have any more source data. If the source data was somehow corrupted it's also possible (but unlikely) for the inflator to keep on demanding input to */
845  /* proceed, so be sure to properly set the TINFL_FLAG_HAS_MORE_INPUT flag. */
847 
848  /* This flag indicates the inflator definitely has 1 or more bytes of uncompressed data available, but it cannot write this data into the output buffer. */
849  /* Note if the source compressed data was corrupted it's possible for the inflator to return a lot of uncompressed data to the caller. I've been assuming you know how much uncompressed data to expect */
850  /* (either exact or worst case) and will stop calling the inflator and fail after receiving too much. In pure streaming scenarios where you have no idea how many bytes to expect this may not be possible */
851  /* so I may need to add some code to address this. */
854 
855 /* Initializes the decompressor to its initial state. */
856 #define tinfl_init(r) \
857  do \
858  { \
859  (r)->m_state = 0; \
860  } \
861  MZ_MACRO_END
862 #define tinfl_get_adler32(r) (r)->m_check_adler32
863 
864 /* Main low-level decompressor coroutine function. This is the only function actually needed for decompression. All the other functions are just high-level helpers for improved usability. */
865 /* This is a universal API, i.e. it can be used as a building block to build any desired higher level decompression API. In the limit case, it can be called once per every byte input or output. */
866 MINIZ_EXPORT tinfl_status tinfl_decompress(tinfl_decompressor *r, const mz_uint8 *pIn_buf_next, size_t *pIn_buf_size, mz_uint8 *pOut_buf_start, mz_uint8 *pOut_buf_next, size_t *pOut_buf_size, const mz_uint32 decomp_flags);
867 
868 /* Internal/private bits follow. */
869 enum
870 {
877 };
878 
879 typedef struct
880 {
884 
885 #if MINIZ_HAS_64BIT_REGISTERS
886 #define TINFL_USE_64BIT_BITBUF 1
887 #else
888 #define TINFL_USE_64BIT_BITBUF 0
889 #endif
890 
891 #if TINFL_USE_64BIT_BITBUF
892 typedef mz_uint64 tinfl_bit_buf_t;
893 #define TINFL_BITBUF_SIZE (64)
894 #else
896 #define TINFL_BITBUF_SIZE (32)
897 #endif
898 
900 {
906 };
907 
908 #ifdef __cplusplus
909 }
910 #endif
911 
912 #pragma once
913 
914 
915 /* ------------------- ZIP archive reading/writing */
916 
917 #ifndef MINIZ_NO_ARCHIVE_APIS
918 
919 #ifdef __cplusplus
920 extern "C" {
921 #endif
922 
923 enum
924 {
925  /* Note: These enums can be reduced as needed to save memory or stack space - they are pretty conservative. */
929 };
930 
931 typedef struct
932 {
933  /* Central directory file index. */
935 
936  /* Byte offset of this entry in the archive's central directory. Note we currently only support up to UINT_MAX or less bytes in the central dir. */
938 
939  /* These fields are copied directly from the zip's central dir. */
944 
945 #ifndef MINIZ_NO_TIME
947 #endif
948 
949  /* CRC-32 of uncompressed data. */
951 
952  /* File's compressed size. */
954 
955  /* File's uncompressed size. Note, I've seen some old archives where directory entries had 512 bytes for their uncompressed sizes, but when you try to unpack them you actually get 0 bytes. */
957 
958  /* Zip internal and external file attributes. */
961 
962  /* Entry's local header file offset in bytes. */
964 
965  /* Size of comment in bytes. */
967 
968  /* MZ_TRUE if the entry appears to be a directory. */
970 
971  /* MZ_TRUE if the entry uses encryption/strong encryption (which miniz_zip doesn't support) */
973 
974  /* MZ_TRUE if the file is not encrypted, a patch file, and if it uses a compression method we support. */
976 
977  /* Filename. If string ends in '/' it's a subdirectory entry. */
978  /* Guaranteed to be zero terminated, may be truncated to fit. */
980 
981  /* Comment field. */
982  /* Guaranteed to be zero terminated, may be truncated to fit. */
984 
986 
987 typedef size_t (*mz_file_read_func)(void *pOpaque, mz_uint64 file_ofs, void *pBuf, size_t n);
988 typedef size_t (*mz_file_write_func)(void *pOpaque, mz_uint64 file_ofs, const void *pBuf, size_t n);
989 typedef mz_bool (*mz_file_needs_keepalive)(void *pOpaque);
990 
993 
994 typedef enum {
1000 
1001 typedef enum {
1006  MZ_ZIP_FLAG_VALIDATE_LOCATE_FILE_FLAG = 0x1000, /* if enabled, mz_zip_reader_locate_file() will be called on each file as its validated to ensure the func finds the file in the central dir (intended for testing) */
1007  MZ_ZIP_FLAG_VALIDATE_HEADERS_ONLY = 0x2000, /* validate the local headers, but don't decompress the entire file and check the crc32 */
1008  MZ_ZIP_FLAG_WRITE_ZIP64 = 0x4000, /* always use the zip64 file format, instead of the original zip file format with automatic switch to zip64. Use as flags parameter with mz_zip_writer_init*_v2 */
1011  /*After adding a compressed file, seek back
1012  to local file header and set the correct sizes*/
1015 
1016 typedef enum {
1025 
1026 /* miniz error codes. Be sure to update mz_zip_get_error_string() if you add or modify this enum. */
1027 typedef enum {
1062 
1063 typedef struct
1064 {
1067 
1068  /* We only support up to UINT32_MAX files in zip64 mode. */
1073 
1075 
1080 
1085 
1087 
1088 } mz_zip_archive;
1089 
1090 typedef struct
1091 {
1094 
1095  int status;
1096 #ifndef MINIZ_DISABLE_ZIP_READER_CRC32_CHECKS
1098 #endif
1099  mz_uint64 read_buf_size, read_buf_ofs, read_buf_avail, comp_remaining, out_buf_ofs, cur_file_ofs;
1101  void *pRead_buf;
1102  void *pWrite_buf;
1103 
1105 
1107 
1109 
1110 /* -------- ZIP reading */
1111 
1112 /* Inits a ZIP archive reader. */
1113 /* These functions read and validate the archive's central directory. */
1115 
1116 MINIZ_EXPORT mz_bool mz_zip_reader_init_mem(mz_zip_archive *pZip, const void *pMem, size_t size, mz_uint flags);
1117 
1118 #ifndef MINIZ_NO_STDIO
1119 /* Read a archive from a disk file. */
1120 /* file_start_ofs is the file offset where the archive actually begins, or 0. */
1121 /* actual_archive_size is the true total size of the archive, which may be smaller than the file's actual size on disk. If zero the entire file is treated as the archive. */
1123 MINIZ_EXPORT mz_bool mz_zip_reader_init_file_v2(mz_zip_archive *pZip, const char *pFilename, mz_uint flags, mz_uint64 file_start_ofs, mz_uint64 archive_size);
1124 
1125 /* Read an archive from an already opened FILE, beginning at the current file position. */
1126 /* The archive is assumed to be archive_size bytes long. If archive_size is 0, then the entire rest of the file is assumed to contain the archive. */
1127 /* The FILE will NOT be closed when mz_zip_reader_end() is called. */
1129 #endif
1130 
1131 /* Ends archive reading, freeing all allocations, and closing the input archive file if mz_zip_reader_init_file() was used. */
1133 
1134 /* -------- ZIP reading or writing */
1135 
1136 /* Clears a mz_zip_archive struct to all zeros. */
1137 /* Important: This must be done before passing the struct to any mz_zip functions. */
1139 
1142 
1143 /* Returns the total number of files in the archive. */
1145 
1149 
1150 /* Reads n bytes of raw archive data, starting at file offset file_ofs, to pBuf. */
1151 MINIZ_EXPORT size_t mz_zip_read_archive_data(mz_zip_archive *pZip, mz_uint64 file_ofs, void *pBuf, size_t n);
1152 
1153 /* All mz_zip funcs set the m_last_error field in the mz_zip_archive struct. These functions retrieve/manipulate this field. */
1154 /* Note that the m_last_error functionality is not thread safe. */
1160 
1161 /* MZ_TRUE if the archive file entry is a directory entry. */
1163 
1164 /* MZ_TRUE if the file is encrypted/strong encrypted. */
1166 
1167 /* MZ_TRUE if the compression method is supported, and the file is not encrypted, and the file is not a compressed patch file. */
1169 
1170 /* Retrieves the filename of an archive file entry. */
1171 /* Returns the number of bytes written to pFilename, or if filename_buf_size is 0 this function returns the number of bytes needed to fully store the filename. */
1172 MINIZ_EXPORT mz_uint mz_zip_reader_get_filename(mz_zip_archive *pZip, mz_uint file_index, char *pFilename, mz_uint filename_buf_size);
1173 
1174 /* Attempts to locates a file in the archive's central directory. */
1175 /* Valid flags: MZ_ZIP_FLAG_CASE_SENSITIVE, MZ_ZIP_FLAG_IGNORE_PATH */
1176 /* Returns -1 if the file cannot be found. */
1177 MINIZ_EXPORT int mz_zip_reader_locate_file(mz_zip_archive *pZip, const char *pName, const char *pComment, mz_uint flags);
1178 MINIZ_EXPORT mz_bool mz_zip_reader_locate_file_v2(mz_zip_archive *pZip, const char *pName, const char *pComment, mz_uint flags, mz_uint32 *file_index);
1179 
1180 /* Returns detailed information about an archive file entry. */
1182 
1183 /* MZ_TRUE if the file is in zip64 format. */
1184 /* A file is considered zip64 if it contained a zip64 end of central directory marker, or if it contained any zip64 extended file information fields in the central directory. */
1186 
1187 /* Returns the total central directory size in bytes. */
1188 /* The current max supported size is <= MZ_UINT32_MAX. */
1190 
1191 /* Extracts a archive file to a memory buffer using no memory allocation. */
1192 /* There must be at least enough room on the stack to store the inflator's state (~34KB or so). */
1193 MINIZ_EXPORT mz_bool mz_zip_reader_extract_to_mem_no_alloc(mz_zip_archive *pZip, mz_uint file_index, void *pBuf, size_t buf_size, mz_uint flags, void *pUser_read_buf, size_t user_read_buf_size);
1194 MINIZ_EXPORT mz_bool mz_zip_reader_extract_file_to_mem_no_alloc(mz_zip_archive *pZip, const char *pFilename, void *pBuf, size_t buf_size, mz_uint flags, void *pUser_read_buf, size_t user_read_buf_size);
1195 
1196 /* Extracts a archive file to a memory buffer. */
1197 MINIZ_EXPORT mz_bool mz_zip_reader_extract_to_mem(mz_zip_archive *pZip, mz_uint file_index, void *pBuf, size_t buf_size, mz_uint flags);
1198 MINIZ_EXPORT mz_bool mz_zip_reader_extract_file_to_mem(mz_zip_archive *pZip, const char *pFilename, void *pBuf, size_t buf_size, mz_uint flags);
1199 
1200 /* Extracts a archive file to a dynamically allocated heap buffer. */
1201 /* The memory will be allocated via the mz_zip_archive's alloc/realloc functions. */
1202 /* Returns NULL and sets the last error on failure. */
1203 MINIZ_EXPORT void *mz_zip_reader_extract_to_heap(mz_zip_archive *pZip, mz_uint file_index, size_t *pSize, mz_uint flags);
1204 MINIZ_EXPORT void *mz_zip_reader_extract_file_to_heap(mz_zip_archive *pZip, const char *pFilename, size_t *pSize, mz_uint flags);
1205 
1206 /* Extracts a archive file using a callback function to output the file's data. */
1208 MINIZ_EXPORT mz_bool mz_zip_reader_extract_file_to_callback(mz_zip_archive *pZip, const char *pFilename, mz_file_write_func pCallback, void *pOpaque, mz_uint flags);
1209 
1210 /* Extract a file iteratively */
1213 MINIZ_EXPORT size_t mz_zip_reader_extract_iter_read(mz_zip_reader_extract_iter_state* pState, void* pvBuf, size_t buf_size);
1215 
1216 #ifndef MINIZ_NO_STDIO
1217 /* Extracts a archive file to a disk file and sets its last accessed and modified times. */
1218 /* This function only extracts files, not archive directory records. */
1219 MINIZ_EXPORT mz_bool mz_zip_reader_extract_to_file(mz_zip_archive *pZip, mz_uint file_index, const char *pDst_filename, mz_uint flags);
1220 MINIZ_EXPORT mz_bool mz_zip_reader_extract_file_to_file(mz_zip_archive *pZip, const char *pArchive_filename, const char *pDst_filename, mz_uint flags);
1221 
1222 /* Extracts a archive file starting at the current position in the destination FILE stream. */
1224 MINIZ_EXPORT mz_bool mz_zip_reader_extract_file_to_cfile(mz_zip_archive *pZip, const char *pArchive_filename, MZ_FILE *pFile, mz_uint flags);
1225 #endif
1226 
1227 #if 0
1228 /* TODO */
1229  typedef void *mz_zip_streaming_extract_state_ptr;
1230  mz_zip_streaming_extract_state_ptr mz_zip_streaming_extract_begin(mz_zip_archive *pZip, mz_uint file_index, mz_uint flags);
1231  uint64_t mz_zip_streaming_extract_get_size(mz_zip_archive *pZip, mz_zip_streaming_extract_state_ptr pState);
1232  uint64_t mz_zip_streaming_extract_get_cur_ofs(mz_zip_archive *pZip, mz_zip_streaming_extract_state_ptr pState);
1233  mz_bool mz_zip_streaming_extract_seek(mz_zip_archive *pZip, mz_zip_streaming_extract_state_ptr pState, uint64_t new_ofs);
1234  size_t mz_zip_streaming_extract_read(mz_zip_archive *pZip, mz_zip_streaming_extract_state_ptr pState, void *pBuf, size_t buf_size);
1235  mz_bool mz_zip_streaming_extract_end(mz_zip_archive *pZip, mz_zip_streaming_extract_state_ptr pState);
1236 #endif
1237 
1238 /* This function compares the archive's local headers, the optional local zip64 extended information block, and the optional descriptor following the compressed data vs. the data in the central directory. */
1239 /* It also validates that each file can be successfully uncompressed unless the MZ_ZIP_FLAG_VALIDATE_HEADERS_ONLY is specified. */
1241 
1242 /* Validates an entire archive by calling mz_zip_validate_file() on each file. */
1244 
1245 /* Misc utils/helpers, valid for ZIP reading or writing */
1248 
1249 /* Universal end function - calls either mz_zip_reader_end() or mz_zip_writer_end(). */
1251 
1252 /* -------- ZIP writing */
1253 
1254 #ifndef MINIZ_NO_ARCHIVE_WRITING_APIS
1255 
1256 /* Inits a ZIP archive writer. */
1257 /*Set pZip->m_pWrite (and pZip->m_pIO_opaque) before calling mz_zip_writer_init or mz_zip_writer_init_v2*/
1258 /*The output is streamable, i.e. file_ofs in mz_file_write_func always increases only by n*/
1261 
1262 MINIZ_EXPORT mz_bool mz_zip_writer_init_heap(mz_zip_archive *pZip, size_t size_to_reserve_at_beginning, size_t initial_allocation_size);
1263 MINIZ_EXPORT mz_bool mz_zip_writer_init_heap_v2(mz_zip_archive *pZip, size_t size_to_reserve_at_beginning, size_t initial_allocation_size, mz_uint flags);
1264 
1265 #ifndef MINIZ_NO_STDIO
1266 MINIZ_EXPORT mz_bool mz_zip_writer_init_file(mz_zip_archive *pZip, const char *pFilename, mz_uint64 size_to_reserve_at_beginning);
1267 MINIZ_EXPORT mz_bool mz_zip_writer_init_file_v2(mz_zip_archive *pZip, const char *pFilename, mz_uint64 size_to_reserve_at_beginning, mz_uint flags);
1269 #endif
1270 
1271 /* Converts a ZIP archive reader object into a writer object, to allow efficient in-place file appends to occur on an existing archive. */
1272 /* For archives opened using mz_zip_reader_init_file, pFilename must be the archive's filename so it can be reopened for writing. If the file can't be reopened, mz_zip_reader_end() will be called. */
1273 /* For archives opened using mz_zip_reader_init_mem, the memory block must be growable using the realloc callback (which defaults to realloc unless you've overridden it). */
1274 /* Finally, for archives opened using mz_zip_reader_init, the mz_zip_archive's user provided m_pWrite function cannot be NULL. */
1275 /* Note: In-place archive modification is not recommended unless you know what you're doing, because if execution stops or something goes wrong before */
1276 /* the archive is finalized the file's central directory will be hosed. */
1279 
1280 /* Adds the contents of a memory buffer to an archive. These functions record the current local time into the archive. */
1281 /* To add a directory entry, call this method with an archive name ending in a forwardslash with an empty buffer. */
1282 /* level_and_flags - compression level (0-10, see MZ_BEST_SPEED, MZ_BEST_COMPRESSION, etc.) logically OR'd with zero or more mz_zip_flags, or just set to MZ_DEFAULT_COMPRESSION. */
1283 MINIZ_EXPORT mz_bool mz_zip_writer_add_mem(mz_zip_archive *pZip, const char *pArchive_name, const void *pBuf, size_t buf_size, mz_uint level_and_flags);
1284 
1285 /* Like mz_zip_writer_add_mem(), except you can specify a file comment field, and optionally supply the function with already compressed data. */
1286 /* uncomp_size/uncomp_crc32 are only used if the MZ_ZIP_FLAG_COMPRESSED_DATA flag is specified. */
1287 MINIZ_EXPORT mz_bool mz_zip_writer_add_mem_ex(mz_zip_archive *pZip, const char *pArchive_name, const void *pBuf, size_t buf_size, const void *pComment, mz_uint16 comment_size, mz_uint level_and_flags,
1288  mz_uint64 uncomp_size, mz_uint32 uncomp_crc32);
1289 
1290 MINIZ_EXPORT mz_bool mz_zip_writer_add_mem_ex_v2(mz_zip_archive *pZip, const char *pArchive_name, const void *pBuf, size_t buf_size, const void *pComment, mz_uint16 comment_size, mz_uint level_and_flags,
1291  mz_uint64 uncomp_size, mz_uint32 uncomp_crc32, MZ_TIME_T *last_modified, const char *user_extra_data_local, mz_uint user_extra_data_local_len,
1292  const char *user_extra_data_central, mz_uint user_extra_data_central_len);
1293 
1294 /* Adds the contents of a file to an archive. This function also records the disk file's modified time into the archive. */
1295 /* File data is supplied via a read callback function. User mz_zip_writer_add_(c)file to add a file directly.*/
1296 MINIZ_EXPORT mz_bool mz_zip_writer_add_read_buf_callback(mz_zip_archive *pZip, const char *pArchive_name, mz_file_read_func read_callback, void* callback_opaque, mz_uint64 max_size,
1297  const MZ_TIME_T *pFile_time, const void *pComment, mz_uint16 comment_size, mz_uint level_and_flags, const char *user_extra_data_local, mz_uint user_extra_data_local_len,
1298  const char *user_extra_data_central, mz_uint user_extra_data_central_len);
1299 
1300 
1301 #ifndef MINIZ_NO_STDIO
1302 /* Adds the contents of a disk file to an archive. This function also records the disk file's modified time into the archive. */
1303 /* level_and_flags - compression level (0-10, see MZ_BEST_SPEED, MZ_BEST_COMPRESSION, etc.) logically OR'd with zero or more mz_zip_flags, or just set to MZ_DEFAULT_COMPRESSION. */
1304 MINIZ_EXPORT mz_bool mz_zip_writer_add_file(mz_zip_archive *pZip, const char *pArchive_name, const char *pSrc_filename, const void *pComment, mz_uint16 comment_size, mz_uint level_and_flags);
1305 
1306 /* Like mz_zip_writer_add_file(), except the file data is read from the specified FILE stream. */
1307 MINIZ_EXPORT mz_bool mz_zip_writer_add_cfile(mz_zip_archive *pZip, const char *pArchive_name, MZ_FILE *pSrc_file, mz_uint64 max_size,
1308  const MZ_TIME_T *pFile_time, const void *pComment, mz_uint16 comment_size, mz_uint level_and_flags, const char *user_extra_data_local, mz_uint user_extra_data_local_len,
1309  const char *user_extra_data_central, mz_uint user_extra_data_central_len);
1310 #endif
1311 
1312 /* Adds a file to an archive by fully cloning the data from another archive. */
1313 /* This function fully clones the source file's compressed data (no recompression), along with its full filename, extra data (it may add or modify the zip64 local header extra data field), and the optional descriptor following the compressed data. */
1315 
1316 /* Finalizes the archive by writing the central directory records followed by the end of central directory record. */
1317 /* After an archive is finalized, the only valid call on the mz_zip_archive struct is mz_zip_writer_end(). */
1318 /* An archive must be manually finalized by calling this function for it to be valid. */
1320 
1321 /* Finalizes a heap archive, returning a poiner to the heap block and its size. */
1322 /* The heap block will be allocated using the mz_zip_archive's alloc/realloc callbacks. */
1323 MINIZ_EXPORT mz_bool mz_zip_writer_finalize_heap_archive(mz_zip_archive *pZip, void **ppBuf, size_t *pSize);
1324 
1325 /* Ends archive writing, freeing all allocations, and closing the output file if mz_zip_writer_init_file() was used. */
1326 /* Note for the archive to be valid, it *must* have been finalized before ending (this function will not do it for you). */
1328 
1329 /* -------- Misc. high-level helper functions: */
1330 
1331 /* mz_zip_add_mem_to_archive_file_in_place() efficiently (but not atomically) appends a memory blob to a ZIP archive. */
1332 /* Note this is NOT a fully safe operation. If it crashes or dies in some way your archive can be left in a screwed up state (without a central directory). */
1333 /* level_and_flags - compression level (0-10, see MZ_BEST_SPEED, MZ_BEST_COMPRESSION, etc.) logically OR'd with zero or more mz_zip_flags, or just set to MZ_DEFAULT_COMPRESSION. */
1334 /* TODO: Perhaps add an option to leave the existing central dir in place in case the add dies? We could then truncate the file (so the old central dir would be at the end) if something goes wrong. */
1335 MINIZ_EXPORT mz_bool mz_zip_add_mem_to_archive_file_in_place(const char *pZip_filename, const char *pArchive_name, const void *pBuf, size_t buf_size, const void *pComment, mz_uint16 comment_size, mz_uint level_and_flags);
1336 MINIZ_EXPORT mz_bool mz_zip_add_mem_to_archive_file_in_place_v2(const char *pZip_filename, const char *pArchive_name, const void *pBuf, size_t buf_size, const void *pComment, mz_uint16 comment_size, mz_uint level_and_flags, mz_zip_error *pErr);
1337 
1338 /* Reads a single file from an archive into a heap block. */
1339 /* If pComment is not NULL, only the file with the specified comment will be extracted. */
1340 /* Returns NULL on failure. */
1341 MINIZ_EXPORT void *mz_zip_extract_archive_file_to_heap(const char *pZip_filename, const char *pArchive_name, size_t *pSize, mz_uint flags);
1342 MINIZ_EXPORT void *mz_zip_extract_archive_file_to_heap_v2(const char *pZip_filename, const char *pArchive_name, const char *pComment, size_t *pSize, mz_uint flags, mz_zip_error *pErr);
1343 
1344 #endif /* #ifndef MINIZ_NO_ARCHIVE_WRITING_APIS */
1345 
1346 #ifdef __cplusplus
1347 }
1348 #endif
1349 
1350 #endif /* MINIZ_NO_ARCHIVE_APIS */
static uch flags
Uint8 uint64_t
Int8 int64_t
strategy
Block allocation strategies.
Definition: bmconst.h:146
unsigned int
A callback function used to compare two keys in a database.
Definition: types.hpp:1210
yy_size_t n
int len
mz_zip_reader_extract_iter_state * mz_zip_reader_extract_file_iter_new(mz_zip_archive *pZip, const char *pFilename, mz_uint flags)
Definition: miniz.c:4948
unsigned long mz_ulong
Definition: miniz.h:197
void * tdefl_write_image_to_png_file_in_memory(const void *pImage, int w, int h, int num_chans, size_t *pLen_out)
Definition: miniz.c:2190
mz_ulong mz_adler32(mz_ulong adler, const unsigned char *ptr, size_t buf_len)
Definition: miniz.c:40
mz_bool mz_zip_is_zip64(mz_zip_archive *pZip)
Definition: miniz.c:7650
mz_zip_flags
Definition: miniz.h:1001
@ MZ_ZIP_FLAG_ASCII_FILENAME
Definition: miniz.h:1010
@ MZ_ZIP_FLAG_WRITE_HEADER_SET_SIZE
Definition: miniz.h:1013
@ MZ_ZIP_FLAG_WRITE_ZIP64
Definition: miniz.h:1008
@ MZ_ZIP_FLAG_WRITE_ALLOW_READING
Definition: miniz.h:1009
@ MZ_ZIP_FLAG_VALIDATE_HEADERS_ONLY
Definition: miniz.h:1007
@ MZ_ZIP_FLAG_VALIDATE_LOCATE_FILE_FLAG
Definition: miniz.h:1006
@ MZ_ZIP_FLAG_COMPRESSED_DATA
Definition: miniz.h:1004
@ MZ_ZIP_FLAG_DO_NOT_SORT_CENTRAL_DIRECTORY
Definition: miniz.h:1005
@ MZ_ZIP_FLAG_CASE_SENSITIVE
Definition: miniz.h:1002
@ MZ_ZIP_FLAG_IGNORE_PATH
Definition: miniz.h:1003
mz_bool mz_zip_reader_end(mz_zip_archive *pZip)
Definition: miniz.c:3864
int mz_uncompress2(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong *pSource_len)
mz_bool mz_zip_validate_archive(mz_zip_archive *pZip, mz_uint flags)
Definition: miniz.c:5415
mz_bool mz_zip_writer_finalize_archive(mz_zip_archive *pZip)
Definition: miniz.c:7258
mz_zip_type mz_zip_get_type(mz_zip_archive *pZip)
Definition: miniz.c:7530
mz_bool tdefl_compress_mem_to_output(const void *pBuf, size_t buf_len, tdefl_put_buf_func_ptr pPut_buf_func, void *pPut_buf_user, int flags)
Definition: miniz.c:2006
struct mz_stream_s mz_stream
#define MINIZ_EXPORT
Definition: miniz.h:1
mz_bool mz_zip_end(mz_zip_archive *pZip)
Definition: miniz.c:7726
mz_uint mz_zip_reader_get_num_files(mz_zip_archive *pZip)
Definition: miniz.c:7666
mz_bool mz_zip_writer_init_file(mz_zip_archive *pZip, const char *pFilename, mz_uint64 size_to_reserve_at_beginning)
Definition: miniz.c:5769
size_t(* mz_file_write_func)(void *pOpaque, mz_uint64 file_ofs, const void *pBuf, size_t n)
Definition: miniz.h:988
@ MZ_MEM_ERROR
Definition: miniz.h:269
@ MZ_PARAM_ERROR
Definition: miniz.h:272
@ MZ_NEED_DICT
Definition: miniz.h:265
@ MZ_VERSION_ERROR
Definition: miniz.h:271
@ MZ_STREAM_END
Definition: miniz.h:264
@ MZ_ERRNO
Definition: miniz.h:266
@ MZ_OK
Definition: miniz.h:263
@ MZ_BUF_ERROR
Definition: miniz.h:270
@ MZ_STREAM_ERROR
Definition: miniz.h:267
@ MZ_DATA_ERROR
Definition: miniz.h:268
mz_bool mz_zip_reader_init_file(mz_zip_archive *pZip, const char *pFilename, mz_uint32 flags)
Definition: miniz.c:3944
int mz_deflateReset(mz_streamp pStream)
size_t mz_zip_get_central_dir_size(mz_zip_archive *pZip)
Definition: miniz.c:7658
void * tinfl_decompress_mem_to_heap(const void *pSrc_buf, size_t src_buf_len, size_t *pOut_len, int flags)
Definition: miniz.c:2873
int mz_inflateInit(mz_streamp pStream)
mz_bool mz_zip_reader_extract_to_cfile(mz_zip_archive *pZip, mz_uint file_index, FILE *File, mz_uint flags)
Definition: miniz.c:5169
int mz_inflate(mz_streamp pStream, int flush)
int mz_compress(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len)
mz_uint32 tdefl_get_adler32(tdefl_compressor *d)
Definition: miniz.c:2001
mz_bool mz_zip_reader_extract_file_to_callback(mz_zip_archive *pZip, const char *pFilename, mz_file_write_func pCallback, void *pOpaque, mz_uint flags)
Definition: miniz.c:4811
mz_ulong mz_compressBound(mz_ulong source_len)
mz_bool mz_zip_reader_locate_file_v2(mz_zip_archive *pZip, const char *pName, const char *pComment, mz_uint flags, mz_uint32 *file_index)
Definition: miniz.c:4331
@ TDEFL_MAX_MATCH_LEN
Definition: miniz.h:661
@ TDEFL_MAX_HUFF_TABLES
Definition: miniz.h:654
@ TDEFL_MAX_HUFF_SYMBOLS_0
Definition: miniz.h:655
@ TDEFL_LZ_DICT_SIZE_MASK
Definition: miniz.h:659
@ TDEFL_LZ_DICT_SIZE
Definition: miniz.h:658
@ TDEFL_MIN_MATCH_LEN
Definition: miniz.h:660
@ TDEFL_MAX_HUFF_SYMBOLS_1
Definition: miniz.h:656
@ TDEFL_MAX_HUFF_SYMBOLS_2
Definition: miniz.h:657
mz_bool mz_zip_add_mem_to_archive_file_in_place(const char *pZip_filename, const char *pArchive_name, const void *pBuf, size_t buf_size, const void *pComment, mz_uint16 comment_size, mz_uint level_and_flags)
Definition: miniz.c:7377
int mz_deflateEnd(mz_streamp pStream)
size_t tdefl_compress_mem_to_mem(void *pOut_buf, size_t out_buf_len, const void *pSrc_buf, size_t src_buf_len, int flags)
Definition: miniz.c:2068
tinfl_status
Definition: miniz.h:822
@ TINFL_STATUS_ADLER32_MISMATCH
Definition: miniz.h:832
@ TINFL_STATUS_FAILED
Definition: miniz.h:835
@ TINFL_STATUS_NEEDS_MORE_INPUT
Definition: miniz.h:846
@ TINFL_STATUS_HAS_MORE_OUTPUT
Definition: miniz.h:852
@ TINFL_STATUS_BAD_PARAM
Definition: miniz.h:829
@ TINFL_STATUS_FAILED_CANNOT_MAKE_PROGRESS
Definition: miniz.h:826
@ TINFL_STATUS_DONE
Definition: miniz.h:841
mz_zip_mode mz_zip_get_mode(mz_zip_archive *pZip)
Definition: miniz.c:7525
tdefl_status tdefl_init(tdefl_compressor *d, tdefl_put_buf_func_ptr pPut_buf_func, void *pPut_buf_user, int flags)
Definition: miniz.c:1960
const char * mz_version(void)
Definition: miniz.c:183
size_t mz_zip_read_archive_data(mz_zip_archive *pZip, mz_uint64 file_ofs, void *pBuf, size_t n)
Definition: miniz.c:7692
int tinfl_decompress_mem_to_callback(const void *pIn_buf, size_t *pIn_buf_size, tinfl_put_buf_func_ptr pPut_buf_func, void *pPut_buf_user, int flags)
Definition: miniz.c:2920
mz_bool mz_zip_writer_init_file_v2(mz_zip_archive *pZip, const char *pFilename, mz_uint64 size_to_reserve_at_beginning, mz_uint flags)
Definition: miniz.c:5774
mz_bool mz_zip_reader_is_file_a_directory(mz_zip_archive *pZip, mz_uint file_index)
Definition: miniz.c:4102
unsigned int mz_uint
Definition: miniz.h:497
mz_bool mz_zip_writer_add_read_buf_callback(mz_zip_archive *pZip, const char *pArchive_name, mz_file_read_func read_callback, void *callback_opaque, mz_uint64 max_size, const time_t *pFile_time, const void *pComment, mz_uint16 comment_size, mz_uint level_and_flags, const char *user_extra_data_local, mz_uint user_extra_data_local_len, const char *user_extra_data_central, mz_uint user_extra_data_central_len)
Definition: miniz.c:6406
@ MZ_SYNC_FLUSH
Definition: miniz.h:254
@ MZ_BLOCK
Definition: miniz.h:257
@ MZ_FULL_FLUSH
Definition: miniz.h:255
@ MZ_FINISH
Definition: miniz.h:256
@ MZ_PARTIAL_FLUSH
Definition: miniz.h:253
@ MZ_NO_FLUSH
Definition: miniz.h:252
mz_bool mz_zip_add_mem_to_archive_file_in_place_v2(const char *pZip_filename, const char *pArchive_name, const void *pBuf, size_t buf_size, const void *pComment, mz_uint16 comment_size, mz_uint level_and_flags, mz_zip_error *pErr)
Definition: miniz.c:7382
@ TDEFL_FORCE_ALL_RAW_BLOCKS
Definition: miniz.h:615
@ TDEFL_GREEDY_PARSING_FLAG
Definition: miniz.h:610
@ TDEFL_FORCE_ALL_STATIC_BLOCKS
Definition: miniz.h:614
@ TDEFL_COMPUTE_ADLER32
Definition: miniz.h:609
@ TDEFL_FILTER_MATCHES
Definition: miniz.h:613
@ TDEFL_WRITE_ZLIB_HEADER
Definition: miniz.h:608
@ TDEFL_NONDETERMINISTIC_PARSING_FLAG
Definition: miniz.h:611
@ TDEFL_RLE_MATCHES
Definition: miniz.h:612
mz_bool mz_zip_reader_extract_to_mem_no_alloc(mz_zip_archive *pZip, mz_uint file_index, void *pBuf, size_t buf_size, mz_uint flags, void *pUser_read_buf, size_t user_read_buf_size)
Definition: miniz.c:4396
mz_bool mz_zip_writer_add_mem_ex(mz_zip_archive *pZip, const char *pArchive_name, const void *pBuf, size_t buf_size, const void *pComment, mz_uint16 comment_size, mz_uint level_and_flags, mz_uint64 uncomp_size, mz_uint32 uncomp_crc32)
Definition: miniz.c:6114
int64_t mz_int64
Definition: miniz.h:498
int(* tinfl_put_buf_func_ptr)(const void *pBuf, int len, void *pUser)
Definition: miniz.h:804
tdefl_status tdefl_get_prev_return_status(tdefl_compressor *d)
Definition: miniz.c:1996
mz_bool mz_zip_writer_init_heap(mz_zip_archive *pZip, size_t size_to_reserve_at_beginning, size_t initial_allocation_size)
Definition: miniz.c:5744
signed short mz_int16
Definition: miniz.h:494
@ TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF
Definition: miniz.h:783
@ TINFL_FLAG_HAS_MORE_INPUT
Definition: miniz.h:782
@ TINFL_FLAG_COMPUTE_ADLER32
Definition: miniz.h:784
@ TINFL_FLAG_PARSE_ZLIB_HEADER
Definition: miniz.h:781
mz_zip_error mz_zip_peek_last_error(mz_zip_archive *pZip)
Definition: miniz.c:7548
mz_bool mz_zip_reader_init(mz_zip_archive *pZip, mz_uint64 size, mz_uint flags)
Definition: miniz.c:3868
void * miniz_def_alloc_func(void *opaque, size_t items, size_t size)
Definition: miniz.c:167
mz_ulong uLong
Definition: miniz.h:402
mz_zip_error mz_zip_get_last_error(mz_zip_archive *pZip)
Definition: miniz.c:7561
mz_bool mz_zip_reader_extract_file_to_file(mz_zip_archive *pZip, const char *pArchive_filename, const char *pDst_filename, mz_uint flags)
Definition: miniz.c:5160
tdefl_status tdefl_compress_buffer(tdefl_compressor *d, const void *pIn_buf, size_t in_buf_size, tdefl_flush flush)
Definition: miniz.c:1954
mz_bool mz_zip_reader_extract_to_callback(mz_zip_archive *pZip, mz_uint file_index, mz_file_write_func pCallback, void *pOpaque, mz_uint flags)
Definition: miniz.c:4611
mz_bool mz_zip_validate_file_archive(const char *pFilename, mz_uint flags, mz_zip_error *pErr)
Definition: miniz.c:5510
void * tdefl_write_image_to_png_file_in_memory_ex(const void *pImage, int w, int h, int num_chans, size_t *pLen_out, mz_uint level, mz_bool flip)
Definition: miniz.c:2112
int mz_deflateInit2(mz_streamp pStream, int level, int method, int window_bits, int mem_level, int strategy)
mz_bool mz_zip_reader_init_mem(mz_zip_archive *pZip, const void *pMem, size_t size, mz_uint flags)
Definition: miniz.c:3896
mz_bool mz_zip_writer_init_cfile(mz_zip_archive *pZip, FILE *pFile, mz_uint flags)
Definition: miniz.c:5821
int mz_deflateInit(mz_streamp pStream, int level)
#define MZ_FILE
Definition: miniz.h:516
const char * mz_zip_get_error_string(mz_zip_error mz_err)
Definition: miniz.c:7574
mz_bool mz_zip_reader_init_cfile(mz_zip_archive *pZip, FILE *pFile, mz_uint64 archive_size, mz_uint flags)
Definition: miniz.c:4003
void * mz_zip_reader_extract_to_heap(mz_zip_archive *pZip, mz_uint file_index, size_t *pSize, mz_uint flags)
Definition: miniz.c:4557
void miniz_def_free_func(void *opaque, void *address)
Definition: miniz.c:172
int mz_compress2(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len, int level)
mz_bool mz_zip_writer_end(mz_zip_archive *pZip)
Definition: miniz.c:7371
void mz_free(void *p)
Definition: miniz.c:162
int intf
Definition: miniz.h:406
mz_bool mz_zip_writer_add_file(mz_zip_archive *pZip, const char *pArchive_name, const char *pSrc_filename, const void *pComment, mz_uint16 comment_size, mz_uint level_and_flags)
Definition: miniz.c:6784
mz_bool mz_zip_writer_add_mem_ex_v2(mz_zip_archive *pZip, const char *pArchive_name, const void *pBuf, size_t buf_size, const void *pComment, mz_uint16 comment_size, mz_uint level_and_flags, mz_uint64 uncomp_size, mz_uint32 uncomp_crc32, time_t *last_modified, const char *user_extra_data_local, mz_uint user_extra_data_local_len, const char *user_extra_data_central, mz_uint user_extra_data_central_len)
Definition: miniz.c:6120
void *(* mz_alloc_func)(void *opaque, size_t items, size_t size)
Definition: miniz.h:225
uInt uIntf
Definition: miniz.h:404
int mz_inflateReset(mz_streamp pStream)
int mz_zip_reader_locate_file(mz_zip_archive *pZip, const char *pName, const char *pComment, mz_uint flags)
Definition: miniz.c:4322
char charf
Definition: miniz.h:405
@ TDEFL_DEFAULT_MAX_PROBES
Definition: miniz.h:593
@ TDEFL_HUFFMAN_ONLY
Definition: miniz.h:592
@ TDEFL_MAX_PROBES_MASK
Definition: miniz.h:594
unsigned int uInt
Definition: miniz.h:401
size_t(* mz_file_read_func)(void *pOpaque, mz_uint64 file_ofs, void *pBuf, size_t n)
Definition: miniz.h:987
#define MZ_TIME_T
Definition: miniz.h:526
int mz_bool
Definition: miniz.h:500
@ MZ_BEST_SPEED
Definition: miniz.h:233
@ MZ_NO_COMPRESSION
Definition: miniz.h:232
@ MZ_UBER_COMPRESSION
Definition: miniz.h:235
@ MZ_DEFAULT_LEVEL
Definition: miniz.h:236
@ MZ_BEST_COMPRESSION
Definition: miniz.h:234
@ MZ_DEFAULT_COMPRESSION
Definition: miniz.h:237
mz_bool mz_zip_reader_is_file_encrypted(mz_zip_archive *pZip, mz_uint file_index)
Definition: miniz.c:4052
mz_bool mz_zip_writer_init(mz_zip_archive *pZip, mz_uint64 existing_size)
Definition: miniz.c:5711
void mz_zip_zero_struct(mz_zip_archive *pZip)
Definition: miniz.c:3811
@ TDEFL_MAX_HUFF_SYMBOLS
Definition: miniz.h:681
@ TDEFL_LEVEL1_HASH_SIZE_MASK
Definition: miniz.h:683
@ TDEFL_LZ_HASH_BITS
Definition: miniz.h:682
@ TDEFL_LZ_HASH_SIZE
Definition: miniz.h:685
@ TDEFL_LZ_CODE_BUF_SIZE
Definition: miniz.h:679
@ TDEFL_LZ_HASH_SHIFT
Definition: miniz.h:684
@ TDEFL_OUT_BUF_SIZE
Definition: miniz.h:680
mz_bool mz_zip_reader_extract_file_to_cfile(mz_zip_archive *pZip, const char *pArchive_filename, FILE *pFile, mz_uint flags)
Definition: miniz.c:5182
mz_uint64 mz_zip_get_archive_size(mz_zip_archive *pZip)
Definition: miniz.c:7671
size_t mz_zip_reader_extract_iter_read(mz_zip_reader_extract_iter_state *pState, void *pvBuf, size_t buf_size)
Definition: miniz.c:4960
unsigned char mz_uint8
Definition: miniz.h:493
@ MZ_ZIP_MAX_ARCHIVE_FILE_COMMENT_SIZE
Definition: miniz.h:928
@ MZ_ZIP_MAX_IO_BUF_SIZE
Definition: miniz.h:926
@ MZ_ZIP_MAX_ARCHIVE_FILENAME_SIZE
Definition: miniz.h:927
void * mz_zip_extract_archive_file_to_heap_v2(const char *pZip_filename, const char *pArchive_name, const char *pComment, size_t *pSize, mz_uint flags, mz_zip_error *pErr)
Definition: miniz.c:7475
int mz_inflateInit2(mz_streamp pStream, int window_bits)
mz_bool mz_zip_writer_add_from_zip_reader(mz_zip_archive *pZip, mz_zip_archive *pSource_zip, mz_uint src_file_index)
Definition: miniz.c:6896
mz_bool mz_zip_reader_is_file_supported(mz_zip_archive *pZip, mz_uint file_index)
Definition: miniz.c:4066
mz_bool mz_zip_reader_extract_to_mem(mz_zip_archive *pZip, mz_uint file_index, void *pBuf, size_t buf_size, mz_uint flags)
Definition: miniz.c:4547
void *(* mz_realloc_func)(void *opaque, void *address, size_t items, size_t size)
Definition: miniz.h:227
tdefl_flush
Definition: miniz.h:698
@ TDEFL_SYNC_FLUSH
Definition: miniz.h:700
@ TDEFL_NO_FLUSH
Definition: miniz.h:699
@ TDEFL_FULL_FLUSH
Definition: miniz.h:701
@ TDEFL_FINISH
Definition: miniz.h:702
mz_zip_error mz_zip_set_last_error(mz_zip_archive *pZip, mz_zip_error err_num)
Definition: miniz.c:7535
mz_zip_type
Definition: miniz.h:1016
@ MZ_ZIP_TYPE_USER
Definition: miniz.h:1018
@ MZ_ZIP_TYPE_FILE
Definition: miniz.h:1021
@ MZ_ZIP_TYPE_HEAP
Definition: miniz.h:1020
@ MZ_ZIP_TOTAL_TYPES
Definition: miniz.h:1023
@ MZ_ZIP_TYPE_MEMORY
Definition: miniz.h:1019
@ MZ_ZIP_TYPE_CFILE
Definition: miniz.h:1022
@ MZ_ZIP_TYPE_INVALID
Definition: miniz.h:1017
int mz_uncompress(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len)
mz_bool mz_zip_writer_add_cfile(mz_zip_archive *pZip, const char *pArchive_name, FILE *pSrc_file, mz_uint64 max_size, const time_t *pFile_time, const void *pComment, mz_uint16 comment_size, mz_uint level_and_flags, const char *user_extra_data_local, mz_uint user_extra_data_local_len, const char *user_extra_data_central, mz_uint user_extra_data_central_len)
Definition: miniz.c:6777
@ MZ_FILTERED
Definition: miniz.h:214
@ MZ_FIXED
Definition: miniz.h:217
@ MZ_DEFAULT_STRATEGY
Definition: miniz.h:213
@ MZ_RLE
Definition: miniz.h:216
@ MZ_HUFFMAN_ONLY
Definition: miniz.h:215
mz_bool mz_zip_reader_file_stat(mz_zip_archive *pZip, mz_uint file_index, mz_zip_archive_file_stat *pStat)
Definition: miniz.c:7721
mz_bool mz_zip_writer_init_from_reader_v2(mz_zip_archive *pZip, const char *pFilename, mz_uint flags)
Definition: miniz.c:5842
mz_bool mz_zip_reader_init_file_v2(mz_zip_archive *pZip, const char *pFilename, mz_uint flags, mz_uint64 file_start_ofs, mz_uint64 archive_size)
Definition: miniz.c:3949
void tdefl_compressor_free(tdefl_compressor *pComp)
Definition: miniz.c:2205
mz_uint64 mz_zip_get_archive_file_start_offset(mz_zip_archive *pZip)
Definition: miniz.c:7678
tinfl_decompressor * tinfl_decompressor_alloc(void)
Definition: miniz.c:2950
unsigned int mz_uint32
Definition: miniz.h:496
int mz_inflateEnd(mz_streamp pStream)
mz_bool mz_zip_writer_add_mem(mz_zip_archive *pZip, const char *pArchive_name, const void *pBuf, size_t buf_size, mz_uint level_and_flags)
Definition: miniz.c:5935
int mz_deflate(mz_streamp pStream, int flush)
unsigned short mz_uint16
Definition: miniz.h:495
mz_bool mz_zip_reader_extract_file_to_mem(mz_zip_archive *pZip, const char *pFilename, void *pBuf, size_t buf_size, mz_uint flags)
Definition: miniz.c:4552
tdefl_status
Definition: miniz.h:690
@ TDEFL_STATUS_OKAY
Definition: miniz.h:693
@ TDEFL_STATUS_DONE
Definition: miniz.h:694
@ TDEFL_STATUS_BAD_PARAM
Definition: miniz.h:691
@ TDEFL_STATUS_PUT_BUF_FAILED
Definition: miniz.h:692
void(* mz_free_func)(void *opaque, void *address)
Definition: miniz.h:226
void * mz_zip_reader_extract_file_to_heap(mz_zip_archive *pZip, const char *pFilename, size_t *pSize, mz_uint flags)
Definition: miniz.c:4599
mz_bool mz_zip_reader_extract_file_to_mem_no_alloc(mz_zip_archive *pZip, const char *pFilename, void *pBuf, size_t buf_size, mz_uint flags, void *pUser_read_buf, size_t user_read_buf_size)
Definition: miniz.c:4539
const char * mz_error(int err)
size_t tinfl_decompress_mem_to_mem(void *pOut_buf, size_t out_buf_len, const void *pSrc_buf, size_t src_buf_len, int flags)
Definition: miniz.c:2911
tinfl_status tinfl_decompress(tinfl_decompressor *r, const mz_uint8 *pIn_buf_next, size_t *pIn_buf_size, mz_uint8 *pOut_buf_start, mz_uint8 *pOut_buf_next, size_t *pOut_buf_size, const mz_uint32 decomp_flags)
Definition: miniz.c:2391
Byte Bytef
Definition: miniz.h:403
mz_bool mz_zip_validate_mem_archive(const void *pMem, size_t size, mz_uint flags, mz_zip_error *pErr)
Definition: miniz.c:5468
mz_bool mz_zip_validate_file(mz_zip_archive *pZip, mz_uint file_index, mz_uint flags)
Definition: miniz.c:5200
void * voidpf
Definition: miniz.h:407
mz_ulong mz_deflateBound(mz_streamp pStream, mz_ulong source_len)
mz_ulong mz_crc32(mz_ulong crc, const unsigned char *ptr, size_t buf_len)
Definition: miniz.c:95
tdefl_compressor * tdefl_compressor_alloc(void)
Definition: miniz.c:2200
uLong uLongf
Definition: miniz.h:408
mz_uint tdefl_create_comp_flags_from_zip_params(int level, int window_bits, int strategy)
Definition: miniz.c:2084
uint64_t mz_uint64
Definition: miniz.h:499
mz_bool(* mz_file_needs_keepalive)(void *pOpaque)
Definition: miniz.h:989
mz_zip_mode
Definition: miniz.h:994
@ MZ_ZIP_MODE_WRITING
Definition: miniz.h:997
@ MZ_ZIP_MODE_READING
Definition: miniz.h:996
@ MZ_ZIP_MODE_INVALID
Definition: miniz.h:995
@ MZ_ZIP_MODE_WRITING_HAS_BEEN_FINALIZED
Definition: miniz.h:998
mz_bool mz_zip_reader_extract_iter_free(mz_zip_reader_extract_iter_state *pState)
Definition: miniz.c:5077
mz_bool(* tdefl_put_buf_func_ptr)(const void *pBuf, int len, void *pUser)
Definition: miniz.h:647
mz_zip_error
Definition: miniz.h:1027
@ MZ_ZIP_UNSUPPORTED_METHOD
Definition: miniz.h:1032
@ MZ_ZIP_UNSUPPORTED_FEATURE
Definition: miniz.h:1034
@ MZ_ZIP_FILE_OPEN_FAILED
Definition: miniz.h:1045
@ MZ_ZIP_FILE_TOO_LARGE
Definition: miniz.h:1031
@ MZ_ZIP_WRITE_CALLBACK_FAILED
Definition: miniz.h:1059
@ MZ_ZIP_CRC_CHECK_FAILED
Definition: miniz.h:1042
@ MZ_ZIP_INTERNAL_ERROR
Definition: miniz.h:1055
@ MZ_ZIP_FILE_CLOSE_FAILED
Definition: miniz.h:1049
@ MZ_ZIP_FILE_CREATE_FAILED
Definition: miniz.h:1046
@ MZ_ZIP_BUF_TOO_SMALL
Definition: miniz.h:1054
@ MZ_ZIP_VALIDATION_FAILED
Definition: miniz.h:1058
@ MZ_ZIP_FILE_STAT_FAILED
Definition: miniz.h:1051
@ MZ_ZIP_INVALID_FILENAME
Definition: miniz.h:1053
@ MZ_ZIP_COMPRESSION_FAILED
Definition: miniz.h:1040
@ MZ_ZIP_NO_ERROR
Definition: miniz.h:1028
@ MZ_ZIP_UNSUPPORTED_ENCRYPTION
Definition: miniz.h:1033
@ MZ_ZIP_TOO_MANY_FILES
Definition: miniz.h:1030
@ MZ_ZIP_UNDEFINED_ERROR
Definition: miniz.h:1029
@ MZ_ZIP_UNSUPPORTED_MULTIDISK
Definition: miniz.h:1038
@ MZ_ZIP_ALLOC_FAILED
Definition: miniz.h:1044
@ MZ_ZIP_ARCHIVE_TOO_LARGE
Definition: miniz.h:1057
@ MZ_ZIP_DECOMPRESSION_FAILED
Definition: miniz.h:1039
@ MZ_ZIP_FILE_WRITE_FAILED
Definition: miniz.h:1047
@ MZ_ZIP_INVALID_PARAMETER
Definition: miniz.h:1052
@ MZ_ZIP_INVALID_HEADER_OR_CORRUPTED
Definition: miniz.h:1037
@ MZ_ZIP_UNSUPPORTED_CDIR_SIZE
Definition: miniz.h:1043
@ MZ_ZIP_FILE_READ_FAILED
Definition: miniz.h:1048
@ MZ_ZIP_FILE_NOT_FOUND
Definition: miniz.h:1056
@ MZ_ZIP_FAILED_FINDING_CENTRAL_DIR
Definition: miniz.h:1035
@ MZ_ZIP_UNEXPECTED_DECOMPRESSED_SIZE
Definition: miniz.h:1041
@ MZ_ZIP_NOT_AN_ARCHIVE
Definition: miniz.h:1036
@ MZ_ZIP_TOTAL_ERRORS
Definition: miniz.h:1060
@ MZ_ZIP_FILE_SEEK_FAILED
Definition: miniz.h:1050
mz_bool mz_zip_writer_finalize_heap_archive(mz_zip_archive *pZip, void **ppBuf, size_t *pSize)
Definition: miniz.c:7346
unsigned char Byte
Definition: miniz.h:400
void * miniz_def_realloc_func(void *opaque, void *address, size_t items, size_t size)
Definition: miniz.c:177
mz_bool mz_zip_writer_init_v2(mz_zip_archive *pZip, mz_uint64 existing_size, mz_uint flags)
Definition: miniz.c:5662
tdefl_status tdefl_compress(tdefl_compressor *d, const void *pIn_buf, size_t *pIn_buf_size, void *pOut_buf, size_t *pOut_buf_size, tdefl_flush flush)
Definition: miniz.c:1886
mz_bool mz_zip_writer_init_from_reader(mz_zip_archive *pZip, const char *pFilename)
Definition: miniz.c:5929
mz_stream * mz_streamp
Definition: miniz.h:303
void * mz_zip_extract_archive_file_to_heap(const char *pZip_filename, const char *pArchive_name, size_t *pSize, mz_uint flags)
Definition: miniz.c:7514
mz_zip_error mz_zip_clear_last_error(mz_zip_archive *pZip)
Definition: miniz.c:7556
void * voidp
Definition: miniz.h:409
@ TINFL_MAX_HUFF_SYMBOLS_2
Definition: miniz.h:874
@ TINFL_FAST_LOOKUP_SIZE
Definition: miniz.h:876
@ TINFL_MAX_HUFF_SYMBOLS_0
Definition: miniz.h:872
@ TINFL_MAX_HUFF_SYMBOLS_1
Definition: miniz.h:873
@ TINFL_MAX_HUFF_TABLES
Definition: miniz.h:871
@ TINFL_FAST_LOOKUP_BITS
Definition: miniz.h:875
FILE * mz_zip_get_cfile(mz_zip_archive *pZip)
Definition: miniz.c:7685
mz_zip_reader_extract_iter_state * mz_zip_reader_extract_iter_new(mz_zip_archive *pZip, mz_uint file_index, mz_uint flags)
Definition: miniz.c:4820
mz_bool mz_zip_writer_init_heap_v2(mz_zip_archive *pZip, size_t size_to_reserve_at_beginning, size_t initial_allocation_size, mz_uint flags)
Definition: miniz.c:5716
mz_bool mz_zip_reader_extract_to_file(mz_zip_archive *pZip, mz_uint file_index, const char *pDst_filename, mz_uint flags)
Definition: miniz.c:5126
mz_uint mz_zip_reader_get_filename(mz_zip_archive *pZip, mz_uint file_index, char *pFilename, mz_uint filename_buf_size)
Definition: miniz.c:7700
mz_uint32 tinfl_bit_buf_t
Definition: miniz.h:895
void tinfl_decompressor_free(tinfl_decompressor *pDecomp)
Definition: miniz.c:2958
void * tdefl_compress_mem_to_heap(const void *pSrc_buf, size_t src_buf_len, size_t *pOut_len, int flags)
Definition: miniz.c:2053
void *const voidpc
Definition: miniz.h:410
const struct ncbi::grid::netcache::search::fields::SIZE size
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
mz_ulong adler
Definition: miniz.h:299
unsigned char * next_out
Definition: miniz.h:287
void * opaque
Definition: miniz.h:296
int data_type
Definition: miniz.h:298
mz_free_func zfree
Definition: miniz.h:295
mz_ulong total_out
Definition: miniz.h:289
unsigned int avail_out
Definition: miniz.h:288
struct mz_internal_state * state
Definition: miniz.h:292
const unsigned char * next_in
Definition: miniz.h:283
unsigned int avail_in
Definition: miniz.h:284
mz_alloc_func zalloc
Definition: miniz.h:294
mz_ulong total_in
Definition: miniz.h:285
char * msg
Definition: miniz.h:291
mz_ulong reserved
Definition: miniz.h:300
mz_bool m_is_directory
Definition: miniz.h:969
mz_uint32 m_external_attr
Definition: miniz.h:960
mz_uint16 m_version_needed
Definition: miniz.h:941
mz_uint16 m_version_made_by
Definition: miniz.h:940
mz_bool m_is_supported
Definition: miniz.h:975
mz_uint64 m_central_dir_ofs
Definition: miniz.h:937
mz_bool m_is_encrypted
Definition: miniz.h:972
mz_uint32 m_file_index
Definition: miniz.h:934
mz_uint64 m_uncomp_size
Definition: miniz.h:956
mz_uint32 m_comment_size
Definition: miniz.h:966
mz_uint16 m_bit_flag
Definition: miniz.h:942
mz_uint64 m_local_header_ofs
Definition: miniz.h:963
mz_uint16 m_internal_attr
Definition: miniz.h:959
mz_uint16 m_method
Definition: miniz.h:943
mz_uint64 m_comp_size
Definition: miniz.h:953
mz_uint64 m_central_directory_file_ofs
Definition: miniz.h:1066
mz_zip_error m_last_error
Definition: miniz.h:1072
mz_alloc_func m_pAlloc
Definition: miniz.h:1076
mz_zip_mode m_zip_mode
Definition: miniz.h:1070
mz_uint64 m_archive_size
Definition: miniz.h:1065
void * m_pIO_opaque
Definition: miniz.h:1084
void * m_pAlloc_opaque
Definition: miniz.h:1079
mz_file_needs_keepalive m_pNeeds_keepalive
Definition: miniz.h:1083
mz_file_write_func m_pWrite
Definition: miniz.h:1082
mz_zip_internal_state * m_pState
Definition: miniz.h:1086
mz_free_func m_pFree
Definition: miniz.h:1077
mz_realloc_func m_pRealloc
Definition: miniz.h:1078
mz_file_read_func m_pRead
Definition: miniz.h:1081
mz_uint64 m_file_offset_alignment
Definition: miniz.h:1074
mz_zip_type m_zip_type
Definition: miniz.h:1071
mz_uint32 m_total_files
Definition: miniz.h:1069
tinfl_decompressor inflator
Definition: miniz.h:1106
mz_zip_archive_file_stat file_stat
Definition: miniz.h:1100
size_t * m_pOut_buf_size
Definition: miniz.h:719
const mz_uint8 * m_pSrc
Definition: miniz.h:721
mz_uint m_wants_to_finish
Definition: miniz.h:715
mz_uint m_total_lz_bytes
Definition: miniz.h:714
size_t m_src_buf_left
Definition: miniz.h:722
tdefl_status m_prev_return_status
Definition: miniz.h:716
tdefl_put_buf_func_ptr m_pPut_buf_func
Definition: miniz.h:708
tdefl_flush m_flush
Definition: miniz.h:720
mz_uint8 * m_pOutput_buf_end
Definition: miniz.h:713
mz_uint m_lookahead_size
Definition: miniz.h:712
void * m_pOut_buf
Definition: miniz.h:718
const void * m_pIn_buf
Definition: miniz.h:717
int m_greedy_parsing
Definition: miniz.h:711
void * m_pPut_buf_user
Definition: miniz.h:709
mz_uint32 m_type
Definition: miniz.h:901
mz_uint32 m_final
Definition: miniz.h:901
mz_uint32 m_zhdr0
Definition: miniz.h:901
tinfl_bit_buf_t m_bit_buf
Definition: miniz.h:902
mz_uint32 m_counter
Definition: miniz.h:901
size_t m_dist_from_out_buf_start
Definition: miniz.h:903
mz_uint32 m_check_adler32
Definition: miniz.h:901
mz_uint32 m_state
Definition: miniz.h:901
tinfl_huff_table m_tables[TINFL_MAX_HUFF_TABLES]
Definition: miniz.h:904
mz_uint8 m_raw_header[4]
Definition: miniz.h:905
mz_uint32 m_zhdr1
Definition: miniz.h:901
mz_uint32 m_num_bits
Definition: miniz.h:901
mz_uint32 m_z_adler32
Definition: miniz.h:901
mz_uint32 m_table_sizes[TINFL_MAX_HUFF_TABLES]
Definition: miniz.h:901
mz_uint32 m_dist
Definition: miniz.h:901
mz_uint8 m_len_codes[TINFL_MAX_HUFF_SYMBOLS_0+TINFL_MAX_HUFF_SYMBOLS_1+137]
Definition: miniz.h:905
mz_uint32 m_num_extra
Definition: miniz.h:901
unsigned int uInt
Definition: zconf.h:395
unsigned long uLong
Definition: zconf.h:396
unsigned char Byte
Definition: zconf.h:393
Modified on Fri Sep 20 14:57:06 2024 by modify_doxy.py rev. 669887