• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* miniz.c 2.1.0 - public domain deflate/inflate, zlib-subset, ZIP reading/writing/appending, PNG writing
2    See "unlicense" statement at the end of this file.
3    Rich Geldreich <richgel99@gmail.com>, last updated Oct. 13, 2013
4    Implements RFC 1950: http://www.ietf.org/rfc/rfc1950.txt and RFC 1951: http://www.ietf.org/rfc/rfc1951.txt
5 
6    Most API's defined in miniz.c are optional. For example, to disable the archive related functions just define
7    MINIZ_NO_ARCHIVE_APIS, or to get rid of all stdio usage define MINIZ_NO_STDIO (see the list below for more macros).
8 
9    * Low-level Deflate/Inflate implementation notes:
10 
11      Compression: Use the "tdefl" API's. The compressor supports raw, static, and dynamic blocks, lazy or
12      greedy parsing, match length filtering, RLE-only, and Huffman-only streams. It performs and compresses
13      approximately as well as zlib.
14 
15      Decompression: Use the "tinfl" API's. The entire decompressor is implemented as a single function
16      coroutine: see tinfl_decompress(). It supports decompression into a 32KB (or larger power of 2) wrapping buffer, or into a memory
17      block large enough to hold the entire file.
18 
19      The low-level tdefl/tinfl API's do not make any use of dynamic memory allocation.
20 
21    * zlib-style API notes:
22 
23      miniz.c implements a fairly large subset of zlib. There's enough functionality present for it to be a drop-in
24      zlib replacement in many apps:
25         The z_stream struct, optional memory allocation callbacks
26         deflateInit/deflateInit2/deflate/deflateReset/deflateEnd/deflateBound
27         inflateInit/inflateInit2/inflate/inflateReset/inflateEnd
28         compress, compress2, compressBound, uncompress
29         CRC-32, Adler-32 - Using modern, minimal code size, CPU cache friendly routines.
30         Supports raw deflate streams or standard zlib streams with adler-32 checking.
31 
32      Limitations:
33       The callback API's are not implemented yet. No support for gzip headers or zlib static dictionaries.
34       I've tried to closely emulate zlib's various flavors of stream flushing and return status codes, but
35       there are no guarantees that miniz.c pulls this off perfectly.
36 
37    * PNG writing: See the tdefl_write_image_to_png_file_in_memory() function, originally written by
38      Alex Evans. Supports 1-4 bytes/pixel images.
39 
40    * ZIP archive API notes:
41 
42      The ZIP archive API's where designed with simplicity and efficiency in mind, with just enough abstraction to
43      get the job done with minimal fuss. There are simple API's to retrieve file information, read files from
44      existing archives, create new archives, append new files to existing archives, or clone archive data from
45      one archive to another. It supports archives located in memory or the heap, on disk (using stdio.h),
46      or you can specify custom file read/write callbacks.
47 
48      - Archive reading: Just call this function to read a single file from a disk archive:
49 
50       void *mz_zip_extract_archive_file_to_heap(const char *pZip_filename, const char *pArchive_name,
51         size_t *pSize, mz_uint zip_flags);
52 
53      For more complex cases, use the "mz_zip_reader" functions. Upon opening an archive, the entire central
54      directory is located and read as-is into memory, and subsequent file access only occurs when reading individual files.
55 
56      - Archives file scanning: The simple way is to use this function to scan a loaded archive for a specific file:
57 
58      int mz_zip_reader_locate_file(mz_zip_archive *pZip, const char *pName, const char *pComment, mz_uint flags);
59 
60      The locate operation can optionally check file comments too, which (as one example) can be used to identify
61      multiple versions of the same file in an archive. This function uses a simple linear search through the central
62      directory, so it's not very fast.
63 
64      Alternately, you can iterate through all the files in an archive (using mz_zip_reader_get_num_files()) and
65      retrieve detailed info on each file by calling mz_zip_reader_file_stat().
66 
67      - Archive creation: Use the "mz_zip_writer" functions. The ZIP writer immediately writes compressed file data
68      to disk and builds an exact image of the central directory in memory. The central directory image is written
69      all at once at the end of the archive file when the archive is finalized.
70 
71      The archive writer can optionally align each file's local header and file data to any power of 2 alignment,
72      which can be useful when the archive will be read from optical media. Also, the writer supports placing
73      arbitrary data blobs at the very beginning of ZIP archives. Archives written using either feature are still
74      readable by any ZIP tool.
75 
76      - Archive appending: The simple way to add a single file to an archive is to call this function:
77 
78       mz_bool mz_zip_add_mem_to_archive_file_in_place(const char *pZip_filename, const char *pArchive_name,
79         const void *pBuf, size_t buf_size, const void *pComment, mz_uint16 comment_size, mz_uint level_and_flags);
80 
81      The archive will be created if it doesn't already exist, otherwise it'll be appended to.
82      Note the appending is done in-place and is not an atomic operation, so if something goes wrong
83      during the operation it's possible the archive could be left without a central directory (although the local
84      file headers and file data will be fine, so the archive will be recoverable).
85 
86      For more complex archive modification scenarios:
87      1. The safest way is to use a mz_zip_reader to read the existing archive, cloning only those bits you want to
88      preserve into a new archive using using the mz_zip_writer_add_from_zip_reader() function (which compiles the
89      compressed file data as-is). When you're done, delete the old archive and rename the newly written archive, and
90      you're done. This is safe but requires a bunch of temporary disk space or heap memory.
91 
92      2. Or, you can convert an mz_zip_reader in-place to an mz_zip_writer using mz_zip_writer_init_from_reader(),
93      append new files as needed, then finalize the archive which will write an updated central directory to the
94      original archive. (This is basically what mz_zip_add_mem_to_archive_file_in_place() does.) There's a
95      possibility that the archive's central directory could be lost with this method if anything goes wrong, though.
96 
97      - ZIP archive support limitations:
98      No zip64 or spanning support. Extraction functions can only handle unencrypted, stored or deflated files.
99      Requires streams capable of seeking.
100 
101    * This is a header file library, like stb_image.c. To get only a header file, either cut and paste the
102      below header, or create miniz.h, #define MINIZ_HEADER_FILE_ONLY, and then include miniz.c from it.
103 
104    * Important: For best perf. be sure to customize the below macros for your target platform:
105      #define MINIZ_USE_UNALIGNED_LOADS_AND_STORES 1
106      #define MINIZ_LITTLE_ENDIAN 1
107      #define MINIZ_HAS_64BIT_REGISTERS 1
108 
109    * On platforms using glibc, Be sure to "#define _LARGEFILE64_SOURCE 1" before including miniz.c to ensure miniz
110      uses the 64-bit variants: fopen64(), stat64(), etc. Otherwise you won't be able to process large files
111      (i.e. 32-bit stat() fails for me on files > 0x7FFFFFFF bytes).
112 */
113 #pragma once
114 
115 #include "miniz_common.h"
116 #include "miniz_tdef.h"
117 #include "miniz_tinfl.h"
118 
119 /* Defines to completely disable specific portions of miniz.c:
120    If all macros here are defined the only functionality remaining will be CRC-32, adler-32, tinfl, and tdefl. */
121 
122 /* Define MINIZ_NO_STDIO to disable all usage and any functions which rely on stdio for file I/O. */
123 /*#define MINIZ_NO_STDIO */
124 
125 /* If MINIZ_NO_TIME is specified then the ZIP archive functions will not be able to get the current time, or */
126 /* get/set file times, and the C run-time funcs that get/set times won't be called. */
127 /* The current downside is the times written to your archives will be from 1979. */
128 /*#define MINIZ_NO_TIME */
129 
130 /* Define MINIZ_NO_ARCHIVE_APIS to disable all ZIP archive API's. */
131 /*#define MINIZ_NO_ARCHIVE_APIS */
132 
133 /* Define MINIZ_NO_ARCHIVE_WRITING_APIS to disable all writing related ZIP archive API's. */
134 /*#define MINIZ_NO_ARCHIVE_WRITING_APIS */
135 
136 /* Define MINIZ_NO_ZLIB_APIS to remove all ZLIB-style compression/decompression API's. */
137 /*#define MINIZ_NO_ZLIB_APIS */
138 
139 /* Define MINIZ_NO_ZLIB_COMPATIBLE_NAME to disable zlib names, to prevent conflicts against stock zlib. */
140 /*#define MINIZ_NO_ZLIB_COMPATIBLE_NAMES */
141 
142 /* Define MINIZ_NO_MALLOC to disable all calls to malloc, free, and realloc.
143    Note if MINIZ_NO_MALLOC is defined then the user must always provide custom user alloc/free/realloc
144    callbacks to the zlib and archive API's, and a few stand-alone helper API's which don't provide custom user
145    functions (such as tdefl_compress_mem_to_heap() and tinfl_decompress_mem_to_heap()) won't work. */
146 /*#define MINIZ_NO_MALLOC */
147 
148 #if defined(__TINYC__) && (defined(__linux) || defined(__linux__))
149 /* TODO: Work around "error: include file 'sys\utime.h' when compiling with tcc on Linux */
150 #define MINIZ_NO_TIME
151 #endif
152 
153 #include <stddef.h>
154 
155 #if !defined(MINIZ_NO_TIME) && !defined(MINIZ_NO_ARCHIVE_APIS)
156 #include <time.h>
157 #endif
158 
159 #if defined(_M_IX86) || defined(_M_X64) || defined(__i386__) || defined(__i386) || defined(__i486__) || defined(__i486) || defined(i386) || defined(__ia64__) || defined(__x86_64__)
160 /* MINIZ_X86_OR_X64_CPU is only used to help set the below macros. */
161 #define MINIZ_X86_OR_X64_CPU 1
162 #else
163 #define MINIZ_X86_OR_X64_CPU 0
164 #endif
165 
166 #if (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) || MINIZ_X86_OR_X64_CPU
167 /* Set MINIZ_LITTLE_ENDIAN to 1 if the processor is little endian. */
168 #define MINIZ_LITTLE_ENDIAN 1
169 #else
170 #define MINIZ_LITTLE_ENDIAN 0
171 #endif
172 
173 /* Set MINIZ_USE_UNALIGNED_LOADS_AND_STORES only if not set */
174 #if !defined(MINIZ_USE_UNALIGNED_LOADS_AND_STORES)
175 #if MINIZ_X86_OR_X64_CPU
176 /* Set MINIZ_USE_UNALIGNED_LOADS_AND_STORES to 1 on CPU's that permit efficient integer loads and stores from unaligned addresses. */
177 #define MINIZ_USE_UNALIGNED_LOADS_AND_STORES 1
178 #define MINIZ_UNALIGNED_USE_MEMCPY
179 #else
180 #define MINIZ_USE_UNALIGNED_LOADS_AND_STORES 0
181 #endif
182 #endif
183 
184 #if defined(_M_X64) || defined(_WIN64) || defined(__MINGW64__) || defined(_LP64) || defined(__LP64__) || defined(__ia64__) || defined(__x86_64__)
185 /* 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). */
186 #define MINIZ_HAS_64BIT_REGISTERS 1
187 #else
188 #define MINIZ_HAS_64BIT_REGISTERS 0
189 #endif
190 
191 #ifdef __cplusplus
192 extern "C" {
193 #endif
194 
195 /* ------------------- zlib-style API Definitions. */
196 
197 /* 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! */
198 typedef unsigned long mz_ulong;
199 
200 /* 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. */
201 void mz_free(void *p);
202 
203 #define MZ_ADLER32_INIT (1)
204 /* mz_adler32() returns the initial adler-32 value to use when called with ptr==NULL. */
205 mz_ulong mz_adler32(mz_ulong adler, const unsigned char *ptr, size_t buf_len);
206 
207 #define MZ_CRC32_INIT (0)
208 /* mz_crc32() returns the initial CRC-32 value to use when called with ptr==NULL. */
209 mz_ulong mz_crc32(mz_ulong crc, const unsigned char *ptr, size_t buf_len);
210 
211 /* Compression strategies. */
212 enum
213 {
214     MZ_DEFAULT_STRATEGY = 0,
215     MZ_FILTERED = 1,
216     MZ_HUFFMAN_ONLY = 2,
217     MZ_RLE = 3,
218     MZ_FIXED = 4
219 };
220 
221 /* Method */
222 #define MZ_DEFLATED 8
223 
224 /* Heap allocation callbacks.
225 Note that mz_alloc_func parameter types purpsosely differ from zlib's: items/size is size_t, not unsigned long. */
226 typedef void *(*mz_alloc_func)(void *opaque, size_t items, size_t size);
227 typedef void (*mz_free_func)(void *opaque, void *address);
228 typedef void *(*mz_realloc_func)(void *opaque, void *address, size_t items, size_t size);
229 
230 /* 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. */
231 enum
232 {
233     MZ_NO_COMPRESSION = 0,
234     MZ_BEST_SPEED = 1,
235     MZ_BEST_COMPRESSION = 9,
236     MZ_UBER_COMPRESSION = 10,
237     MZ_DEFAULT_LEVEL = 6,
238     MZ_DEFAULT_COMPRESSION = -1
239 };
240 
241 #define MZ_VERSION "10.1.0"
242 #define MZ_VERNUM 0xA100
243 #define MZ_VER_MAJOR 10
244 #define MZ_VER_MINOR 1
245 #define MZ_VER_REVISION 0
246 #define MZ_VER_SUBREVISION 0
247 
248 #ifndef MINIZ_NO_ZLIB_APIS
249 
250 /* 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). */
251 enum
252 {
253     MZ_NO_FLUSH = 0,
254     MZ_PARTIAL_FLUSH = 1,
255     MZ_SYNC_FLUSH = 2,
256     MZ_FULL_FLUSH = 3,
257     MZ_FINISH = 4,
258     MZ_BLOCK = 5
259 };
260 
261 /* Return status codes. MZ_PARAM_ERROR is non-standard. */
262 enum
263 {
264     MZ_OK = 0,
265     MZ_STREAM_END = 1,
266     MZ_NEED_DICT = 2,
267     MZ_ERRNO = -1,
268     MZ_STREAM_ERROR = -2,
269     MZ_DATA_ERROR = -3,
270     MZ_MEM_ERROR = -4,
271     MZ_BUF_ERROR = -5,
272     MZ_VERSION_ERROR = -6,
273     MZ_PARAM_ERROR = -10000
274 };
275 
276 /* Window bits */
277 #define MZ_DEFAULT_WINDOW_BITS 15
278 
279 struct mz_internal_state;
280 
281 /* Compression/decompression stream struct. */
282 typedef struct mz_stream_s
283 {
284     const unsigned char *next_in; /* pointer to next byte to read */
285     unsigned int avail_in;        /* number of bytes available at next_in */
286     mz_ulong total_in;            /* total number of bytes consumed so far */
287 
288     unsigned char *next_out; /* pointer to next byte to write */
289     unsigned int avail_out;  /* number of bytes that can be written to next_out */
290     mz_ulong total_out;      /* total number of bytes produced so far */
291 
292     char *msg;                       /* error msg (unused) */
293     struct mz_internal_state *state; /* internal state, allocated by zalloc/zfree */
294 
295     mz_alloc_func zalloc; /* optional heap allocation function (defaults to malloc) */
296     mz_free_func zfree;   /* optional heap free function (defaults to free) */
297     void *opaque;         /* heap alloc function user pointer */
298 
299     int data_type;     /* data_type (unused) */
300     mz_ulong adler;    /* adler32 of the source or uncompressed data */
301     mz_ulong reserved; /* not used */
302 } mz_stream;
303 
304 typedef mz_stream *mz_streamp;
305 
306 /* Returns the version string of miniz.c. */
307 const char *mz_version(void);
308 
309 /* mz_deflateInit() initializes a compressor with default options: */
310 /* Parameters: */
311 /*  pStream must point to an initialized mz_stream struct. */
312 /*  level must be between [MZ_NO_COMPRESSION, MZ_BEST_COMPRESSION]. */
313 /*  level 1 enables a specially optimized compression function that's been optimized purely for performance, not ratio. */
314 /*  (This special func. is currently only enabled when MINIZ_USE_UNALIGNED_LOADS_AND_STORES and MINIZ_LITTLE_ENDIAN are defined.) */
315 /* Return values: */
316 /*  MZ_OK on success. */
317 /*  MZ_STREAM_ERROR if the stream is bogus. */
318 /*  MZ_PARAM_ERROR if the input parameters are bogus. */
319 /*  MZ_MEM_ERROR on out of memory. */
320 int mz_deflateInit(mz_streamp pStream, int level);
321 
322 /* mz_deflateInit2() is like mz_deflate(), except with more control: */
323 /* Additional parameters: */
324 /*   method must be MZ_DEFLATED */
325 /*   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) */
326 /*   mem_level must be between [1, 9] (it's checked but ignored by miniz.c) */
327 int mz_deflateInit2(mz_streamp pStream, int level, int method, int window_bits, int mem_level, int strategy);
328 
329 /* Quickly resets a compressor without having to reallocate anything. Same as calling mz_deflateEnd() followed by mz_deflateInit()/mz_deflateInit2(). */
330 int mz_deflateReset(mz_streamp pStream);
331 
332 /* mz_deflate() compresses the input to output, consuming as much of the input and producing as much output as possible. */
333 /* Parameters: */
334 /*   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. */
335 /*   flush may be MZ_NO_FLUSH, MZ_PARTIAL_FLUSH/MZ_SYNC_FLUSH, MZ_FULL_FLUSH, or MZ_FINISH. */
336 /* Return values: */
337 /*   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). */
338 /*   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. */
339 /*   MZ_STREAM_ERROR if the stream is bogus. */
340 /*   MZ_PARAM_ERROR if one of the parameters is invalid. */
341 /*   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.) */
342 int mz_deflate(mz_streamp pStream, int flush);
343 
344 /* mz_deflateEnd() deinitializes a compressor: */
345 /* Return values: */
346 /*  MZ_OK on success. */
347 /*  MZ_STREAM_ERROR if the stream is bogus. */
348 int mz_deflateEnd(mz_streamp pStream);
349 
350 /* 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 mz_ulong mz_deflateBound(mz_streamp pStream, mz_ulong source_len);
352 
353 /* Single-call compression functions mz_compress() and mz_compress2(): */
354 /* Returns MZ_OK on success, or one of the error codes from mz_deflate() on failure. */
355 int mz_compress(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len);
356 int mz_compress2(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len, int level);
357 
358 /* mz_compressBound() returns a (very) conservative upper bound on the amount of data that could be generated by calling mz_compress(). */
359 mz_ulong mz_compressBound(mz_ulong source_len);
360 
361 /* Initializes a decompressor. */
362 int mz_inflateInit(mz_streamp pStream);
363 
364 /* 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: */
365 /* window_bits must be MZ_DEFAULT_WINDOW_BITS (to parse zlib header/footer) or -MZ_DEFAULT_WINDOW_BITS (raw deflate). */
366 int mz_inflateInit2(mz_streamp pStream, int window_bits);
367 
368 /* Quickly resets a compressor without having to reallocate anything. Same as calling mz_inflateEnd() followed by mz_inflateInit()/mz_inflateInit2(). */
369 int mz_inflateReset(mz_streamp pStream);
370 
371 /* 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. */
372 /* Parameters: */
373 /*   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. */
374 /*   flush may be MZ_NO_FLUSH, MZ_SYNC_FLUSH, or MZ_FINISH. */
375 /*   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). */
376 /*   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. */
377 /* Return values: */
378 /*   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. */
379 /*   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. */
380 /*   MZ_STREAM_ERROR if the stream is bogus. */
381 /*   MZ_DATA_ERROR if the deflate stream is invalid. */
382 /*   MZ_PARAM_ERROR if one of the parameters is invalid. */
383 /*   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 */
384 /*   with more input data, or with more room in the output buffer (except when using single call decompression, described above). */
385 int mz_inflate(mz_streamp pStream, int flush);
386 
387 /* Deinitializes a decompressor. */
388 int mz_inflateEnd(mz_streamp pStream);
389 
390 /* Single-call decompression. */
391 /* Returns MZ_OK on success, or one of the error codes from mz_inflate() on failure. */
392 int mz_uncompress(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len);
393 
394 /* Returns a string description of the specified error code, or NULL if the error code is invalid. */
395 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 crc32 mz_crc32
459 #define adler32 mz_adler32
460 #define MAX_WBITS 15
461 #define MAX_MEM_LEVEL 9
462 #define zError mz_error
463 #define ZLIB_VERSION MZ_VERSION
464 #define ZLIB_VERNUM MZ_VERNUM
465 #define ZLIB_VER_MAJOR MZ_VER_MAJOR
466 #define ZLIB_VER_MINOR MZ_VER_MINOR
467 #define ZLIB_VER_REVISION MZ_VER_REVISION
468 #define ZLIB_VER_SUBREVISION MZ_VER_SUBREVISION
469 #define zlibVersion mz_version
470 #define zlib_version mz_version()
471 #endif /* #ifndef MINIZ_NO_ZLIB_COMPATIBLE_NAMES */
472 
473 #endif /* MINIZ_NO_ZLIB_APIS */
474 
475 #ifdef __cplusplus
476 }
477 #endif
478