XenevaOS
Loading...
Searching...
No Matches
miniz.h
Go to the documentation of this file.
1/* miniz.c 3.0.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 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_export.h"
116
117/* Defines to completely disable specific portions of miniz.c:
118 If all macros here are defined the only functionality remaining will be CRC-32 and adler-32. */
119
120/* Define MINIZ_NO_STDIO to disable all usage and any functions which rely on stdio for file I/O. */
121/*#define MINIZ_NO_STDIO */
122
123/* If MINIZ_NO_TIME is specified then the ZIP archive functions will not be able to get the current time, or */
124/* get/set file times, and the C run-time funcs that get/set times won't be called. */
125/* The current downside is the times written to your archives will be from 1979. */
126/*#define MINIZ_NO_TIME */
127
128/* Define MINIZ_NO_DEFLATE_APIS to disable all compression API's. */
129/*#define MINIZ_NO_DEFLATE_APIS */
130
131/* Define MINIZ_NO_INFLATE_APIS to disable all decompression API's. */
132/*#define MINIZ_NO_INFLATE_APIS */
133
134/* Define MINIZ_NO_ARCHIVE_APIS to disable all ZIP archive API's. */
135/*#define MINIZ_NO_ARCHIVE_APIS */
136
137/* Define MINIZ_NO_ARCHIVE_WRITING_APIS to disable all writing related ZIP archive API's. */
138/*#define MINIZ_NO_ARCHIVE_WRITING_APIS */
139
140/* Define MINIZ_NO_ZLIB_APIS to remove all ZLIB-style compression/decompression API's. */
141/*#define MINIZ_NO_ZLIB_APIS */
142
143/* Define MINIZ_NO_ZLIB_COMPATIBLE_NAME to disable zlib names, to prevent conflicts against stock zlib. */
144/*#define MINIZ_NO_ZLIB_COMPATIBLE_NAMES */
145
146/* Define MINIZ_NO_MALLOC to disable all calls to malloc, free, and realloc.
147 Note if MINIZ_NO_MALLOC is defined then the user must always provide custom user alloc/free/realloc
148 callbacks to the zlib and archive API's, and a few stand-alone helper API's which don't provide custom user
149 functions (such as tdefl_compress_mem_to_heap() and tinfl_decompress_mem_to_heap()) won't work. */
150/*#define MINIZ_NO_MALLOC */
151
152#ifdef MINIZ_NO_INFLATE_APIS
153#define MINIZ_NO_ARCHIVE_APIS
154#endif
155
156#ifdef MINIZ_NO_DEFLATE_APIS
157#define MINIZ_NO_ARCHIVE_WRITING_APIS
158#endif
159
160#if defined(__TINYC__) && (defined(__linux) || defined(__linux__))
161/* TODO: Work around "error: include file 'sys\utime.h' when compiling with tcc on Linux */
162#define MINIZ_NO_TIME
163#endif
164
165#include <stddef.h>
166
167#if !defined(MINIZ_NO_TIME) && !defined(MINIZ_NO_ARCHIVE_APIS)
168#include <time.h>
169#endif
170
171#if defined(_M_IX86) || defined(_M_X64) || defined(__i386__) || defined(__i386) || defined(__i486__) || defined(__i486) || defined(i386) || defined(__ia64__) || defined(__x86_64__)
172/* MINIZ_X86_OR_X64_CPU is only used to help set the below macros. */
173#define MINIZ_X86_OR_X64_CPU 1
174#else
175#define MINIZ_X86_OR_X64_CPU 0
176#endif
177
178/* Set MINIZ_LITTLE_ENDIAN only if not set */
179#if !defined(MINIZ_LITTLE_ENDIAN)
180#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__)
181
182#if (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
183/* Set MINIZ_LITTLE_ENDIAN to 1 if the processor is little endian. */
184#define MINIZ_LITTLE_ENDIAN 1
185#else
186#define MINIZ_LITTLE_ENDIAN 0
187#endif
188
189#else
190
191#if MINIZ_X86_OR_X64_CPU
192#define MINIZ_LITTLE_ENDIAN 1
193#else
194#define MINIZ_LITTLE_ENDIAN 0
195#endif
196
197#endif
198#endif
199
200/* Using unaligned loads and stores causes errors when using UBSan */
201#if defined(__has_feature)
202#if __has_feature(undefined_behavior_sanitizer)
203#define MINIZ_USE_UNALIGNED_LOADS_AND_STORES 0
204#endif
205#endif
206
207/* Set MINIZ_USE_UNALIGNED_LOADS_AND_STORES only if not set */
208#if !defined(MINIZ_USE_UNALIGNED_LOADS_AND_STORES)
209#if MINIZ_X86_OR_X64_CPU
210/* Set MINIZ_USE_UNALIGNED_LOADS_AND_STORES to 1 on CPU's that permit efficient integer loads and stores from unaligned addresses. */
211#define MINIZ_USE_UNALIGNED_LOADS_AND_STORES 0
212#define MINIZ_UNALIGNED_USE_MEMCPY
213#else
214#define MINIZ_USE_UNALIGNED_LOADS_AND_STORES 0
215#endif
216#endif
217
218#if defined(_M_X64) || defined(_WIN64) || defined(__MINGW64__) || defined(_LP64) || defined(__LP64__) || defined(__ia64__) || defined(__x86_64__)
219/* 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). */
220#define MINIZ_HAS_64BIT_REGISTERS 1
221#else
222#define MINIZ_HAS_64BIT_REGISTERS 0
223#endif
224
225#ifdef __cplusplus
226extern "C" {
227#endif
228
229/* ------------------- zlib-style API Definitions. */
230
231/* 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! */
232typedef unsigned long mz_ulong;
233
234/* 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. */
235MINIZ_EXPORT void mz_free(void *p);
236
237#define MZ_ADLER32_INIT (1)
238/* mz_adler32() returns the initial adler-32 value to use when called with ptr==NULL. */
239MINIZ_EXPORT mz_ulong mz_adler32(mz_ulong adler, const unsigned char *ptr, size_t buf_len);
240
241#define MZ_CRC32_INIT (0)
242/* mz_crc32() returns the initial CRC-32 value to use when called with ptr==NULL. */
243MINIZ_EXPORT mz_ulong mz_crc32(mz_ulong crc, const unsigned char *ptr, size_t buf_len);
244
245/* Compression strategies. */
246enum
247{
252 MZ_FIXED = 4
254
255/* Method */
256#define MZ_DEFLATED 8
257
258/* Heap allocation callbacks.
259Note that mz_alloc_func parameter types purposely differ from zlib's: items/size is size_t, not unsigned long. */
260typedef void *(*mz_alloc_func)(void *opaque, size_t items, size_t size);
261typedef void (*mz_free_func)(void *opaque, void *address);
262typedef void *(*mz_realloc_func)(void *opaque, void *address, size_t items, size_t size);
263
264/* 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. */
265enum
266{
274
275#define MZ_VERSION "11.0.2"
276#define MZ_VERNUM 0xB002
277#define MZ_VER_MAJOR 11
278#define MZ_VER_MINOR 2
279#define MZ_VER_REVISION 0
280#define MZ_VER_SUBREVISION 0
281
282#ifndef MINIZ_NO_ZLIB_APIS
283
284/* 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). */
285enum
286{
292 MZ_BLOCK = 5
294
295/* Return status codes. MZ_PARAM_ERROR is non-standard. */
296enum
297{
298 MZ_OK = 0,
307 MZ_PARAM_ERROR = -10000
309
310/* Window bits */
311#define MZ_DEFAULT_WINDOW_BITS 15
312
313struct mz_internal_state;
314
315/* Compression/decompression stream struct. */
316typedef struct mz_stream_s
317{
318 const unsigned char *next_in; /* pointer to next byte to read */
319 unsigned int avail_in; /* number of bytes available at next_in */
320 mz_ulong total_in; /* total number of bytes consumed so far */
321
322 unsigned char *next_out; /* pointer to next byte to write */
323 unsigned int avail_out; /* number of bytes that can be written to next_out */
324 mz_ulong total_out; /* total number of bytes produced so far */
325
326 char *msg; /* error msg (unused) */
327 struct mz_internal_state *state; /* internal state, allocated by zalloc/zfree */
328
329 mz_alloc_func zalloc; /* optional heap allocation function (defaults to malloc) */
330 mz_free_func zfree; /* optional heap free function (defaults to free) */
331 void *opaque; /* heap alloc function user pointer */
332
333 int data_type; /* data_type (unused) */
334 mz_ulong adler; /* adler32 of the source or uncompressed data */
335 mz_ulong reserved; /* not used */
337
339
340/* Returns the version string of miniz.c. */
341MINIZ_EXPORT const char *mz_version(void);
342
343#ifndef MINIZ_NO_DEFLATE_APIS
344
345/* mz_deflateInit() initializes a compressor with default options: */
346/* Parameters: */
347/* pStream must point to an initialized mz_stream struct. */
348/* level must be between [MZ_NO_COMPRESSION, MZ_BEST_COMPRESSION]. */
349/* level 1 enables a specially optimized compression function that's been optimized purely for performance, not ratio. */
350/* (This special func. is currently only enabled when MINIZ_USE_UNALIGNED_LOADS_AND_STORES and MINIZ_LITTLE_ENDIAN are defined.) */
351/* Return values: */
352/* MZ_OK on success. */
353/* MZ_STREAM_ERROR if the stream is bogus. */
354/* MZ_PARAM_ERROR if the input parameters are bogus. */
355/* MZ_MEM_ERROR on out of memory. */
356MINIZ_EXPORT int mz_deflateInit(mz_streamp pStream, int level);
357
358/* mz_deflateInit2() is like mz_deflate(), except with more control: */
359/* Additional parameters: */
360/* method must be MZ_DEFLATED */
361/* 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) */
362/* mem_level must be between [1, 9] (it's checked but ignored by miniz.c) */
363MINIZ_EXPORT int mz_deflateInit2(mz_streamp pStream, int level, int method, int window_bits, int mem_level, int strategy);
364
365/* Quickly resets a compressor without having to reallocate anything. Same as calling mz_deflateEnd() followed by mz_deflateInit()/mz_deflateInit2(). */
366MINIZ_EXPORT int mz_deflateReset(mz_streamp pStream);
367
368/* mz_deflate() compresses the input to output, consuming as much of the input and producing as much output as possible. */
369/* Parameters: */
370/* 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. */
371/* flush may be MZ_NO_FLUSH, MZ_PARTIAL_FLUSH/MZ_SYNC_FLUSH, MZ_FULL_FLUSH, or MZ_FINISH. */
372/* Return values: */
373/* 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). */
374/* 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. */
375/* MZ_STREAM_ERROR if the stream is bogus. */
376/* MZ_PARAM_ERROR if one of the parameters is invalid. */
377/* 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.) */
378MINIZ_EXPORT int mz_deflate(mz_streamp pStream, int flush);
379
380/* mz_deflateEnd() deinitializes a compressor: */
381/* Return values: */
382/* MZ_OK on success. */
383/* MZ_STREAM_ERROR if the stream is bogus. */
384MINIZ_EXPORT int mz_deflateEnd(mz_streamp pStream);
385
386/* 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. */
387MINIZ_EXPORT mz_ulong mz_deflateBound(mz_streamp pStream, mz_ulong source_len);
388
389/* Single-call compression functions mz_compress() and mz_compress2(): */
390/* Returns MZ_OK on success, or one of the error codes from mz_deflate() on failure. */
391MINIZ_EXPORT int mz_compress(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len);
392MINIZ_EXPORT int mz_compress2(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len, int level);
393
394/* mz_compressBound() returns a (very) conservative upper bound on the amount of data that could be generated by calling mz_compress(). */
395MINIZ_EXPORT mz_ulong mz_compressBound(mz_ulong source_len);
396
397#endif /*#ifndef MINIZ_NO_DEFLATE_APIS*/
398
399#ifndef MINIZ_NO_INFLATE_APIS
400
401/* Initializes a decompressor. */
402MINIZ_EXPORT int mz_inflateInit(mz_streamp pStream);
403
404/* 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: */
405/* window_bits must be MZ_DEFAULT_WINDOW_BITS (to parse zlib header/footer) or -MZ_DEFAULT_WINDOW_BITS (raw deflate). */
406MINIZ_EXPORT int mz_inflateInit2(mz_streamp pStream, int window_bits);
407
408/* Quickly resets a compressor without having to reallocate anything. Same as calling mz_inflateEnd() followed by mz_inflateInit()/mz_inflateInit2(). */
409MINIZ_EXPORT int mz_inflateReset(mz_streamp pStream);
410
411/* 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. */
412/* Parameters: */
413/* 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. */
414/* flush may be MZ_NO_FLUSH, MZ_SYNC_FLUSH, or MZ_FINISH. */
415/* 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). */
416/* 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. */
417/* Return values: */
418/* 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. */
419/* 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. */
420/* MZ_STREAM_ERROR if the stream is bogus. */
421/* MZ_DATA_ERROR if the deflate stream is invalid. */
422/* MZ_PARAM_ERROR if one of the parameters is invalid. */
423/* 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 */
424/* with more input data, or with more room in the output buffer (except when using single call decompression, described above). */
425MINIZ_EXPORT int mz_inflate(mz_streamp pStream, int flush);
426
427/* Deinitializes a decompressor. */
428MINIZ_EXPORT int mz_inflateEnd(mz_streamp pStream);
429
430/* Single-call decompression. */
431/* Returns MZ_OK on success, or one of the error codes from mz_inflate() on failure. */
432MINIZ_EXPORT int mz_uncompress(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len);
433MINIZ_EXPORT int mz_uncompress2(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong *pSource_len);
434#endif /*#ifndef MINIZ_NO_INFLATE_APIS*/
435
436/* Returns a string description of the specified error code, or NULL if the error code is invalid. */
437MINIZ_EXPORT const char *mz_error(int err);
438
439/* 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. */
440/* Define MINIZ_NO_ZLIB_COMPATIBLE_NAMES to disable zlib-compatibility if you use zlib in the same project. */
441#ifndef MINIZ_NO_ZLIB_COMPATIBLE_NAMES
442typedef unsigned char Byte;
443typedef unsigned int uInt;
445typedef Byte Bytef;
446typedef uInt uIntf;
447typedef char charf;
448typedef int intf;
449typedef void *voidpf;
450typedef uLong uLongf;
451typedef void *voidp;
452typedef void *const voidpc;
453#define Z_NULL 0
454#define Z_NO_FLUSH MZ_NO_FLUSH
455#define Z_PARTIAL_FLUSH MZ_PARTIAL_FLUSH
456#define Z_SYNC_FLUSH MZ_SYNC_FLUSH
457#define Z_FULL_FLUSH MZ_FULL_FLUSH
458#define Z_FINISH MZ_FINISH
459#define Z_BLOCK MZ_BLOCK
460#define Z_OK MZ_OK
461#define Z_STREAM_END MZ_STREAM_END
462#define Z_NEED_DICT MZ_NEED_DICT
463#define Z_ERRNO MZ_ERRNO
464#define Z_STREAM_ERROR MZ_STREAM_ERROR
465#define Z_DATA_ERROR MZ_DATA_ERROR
466#define Z_MEM_ERROR MZ_MEM_ERROR
467#define Z_BUF_ERROR MZ_BUF_ERROR
468#define Z_VERSION_ERROR MZ_VERSION_ERROR
469#define Z_PARAM_ERROR MZ_PARAM_ERROR
470#define Z_NO_COMPRESSION MZ_NO_COMPRESSION
471#define Z_BEST_SPEED MZ_BEST_SPEED
472#define Z_BEST_COMPRESSION MZ_BEST_COMPRESSION
473#define Z_DEFAULT_COMPRESSION MZ_DEFAULT_COMPRESSION
474#define Z_DEFAULT_STRATEGY MZ_DEFAULT_STRATEGY
475#define Z_FILTERED MZ_FILTERED
476#define Z_HUFFMAN_ONLY MZ_HUFFMAN_ONLY
477#define Z_RLE MZ_RLE
478#define Z_FIXED MZ_FIXED
479#define Z_DEFLATED MZ_DEFLATED
480#define Z_DEFAULT_WINDOW_BITS MZ_DEFAULT_WINDOW_BITS
481#define alloc_func mz_alloc_func
482#define free_func mz_free_func
483#define internal_state mz_internal_state
484#define z_stream mz_stream
485
486#ifndef MINIZ_NO_DEFLATE_APIS
487#define deflateInit mz_deflateInit
488#define deflateInit2 mz_deflateInit2
489#define deflateReset mz_deflateReset
490#define deflate mz_deflate
491#define deflateEnd mz_deflateEnd
492#define deflateBound mz_deflateBound
493#define compress mz_compress
494#define compress2 mz_compress2
495#define compressBound mz_compressBound
496#endif /*#ifndef MINIZ_NO_DEFLATE_APIS*/
497
498#ifndef MINIZ_NO_INFLATE_APIS
499#define inflateInit mz_inflateInit
500#define inflateInit2 mz_inflateInit2
501#define inflateReset mz_inflateReset
502#define inflate mz_inflate
503#define inflateEnd mz_inflateEnd
504#define uncompress mz_uncompress
505#define uncompress2 mz_uncompress2
506#endif /*#ifndef MINIZ_NO_INFLATE_APIS*/
507
508#define crc32 mz_crc32
509#define adler32 mz_adler32
510#define MAX_WBITS 15
511#define MAX_MEM_LEVEL 9
512#define zError mz_error
513#define ZLIB_VERSION MZ_VERSION
514#define ZLIB_VERNUM MZ_VERNUM
515#define ZLIB_VER_MAJOR MZ_VER_MAJOR
516#define ZLIB_VER_MINOR MZ_VER_MINOR
517#define ZLIB_VER_REVISION MZ_VER_REVISION
518#define ZLIB_VER_SUBREVISION MZ_VER_SUBREVISION
519#define zlibVersion mz_version
520#define zlib_version mz_version()
521#endif /* #ifndef MINIZ_NO_ZLIB_COMPATIBLE_NAMES */
522
523#endif /* MINIZ_NO_ZLIB_APIS */
524
525#ifdef __cplusplus
526}
527#endif
528
529#include "miniz_common.h"
530#include "miniz_tinfl.h"
ReportItem items[32]
Definition main.cpp:145
size_t size
Definition drm_bridge.h:1299
const char * level
Definition drm_print.h:515
MINIZ_EXPORT int mz_inflateInit(mz_streamp pStream)
unsigned long mz_ulong
Definition miniz.h:232
MINIZ_EXPORT mz_ulong mz_compressBound(mz_ulong source_len)
void *(* mz_alloc_func)(void *opaque, size_t items, size_t size)
Definition miniz.h:260
MINIZ_EXPORT int mz_compress(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len)
struct mz_stream_s mz_stream
MINIZ_EXPORT int mz_deflateInit2(mz_streamp pStream, int level, int method, int window_bits, int mem_level, int strategy)
@ MZ_MEM_ERROR
Definition miniz.h:304
@ MZ_PARAM_ERROR
Definition miniz.h:307
@ MZ_NEED_DICT
Definition miniz.h:300
@ MZ_VERSION_ERROR
Definition miniz.h:306
@ MZ_STREAM_END
Definition miniz.h:299
@ MZ_ERRNO
Definition miniz.h:301
@ MZ_OK
Definition miniz.h:298
@ MZ_BUF_ERROR
Definition miniz.h:305
@ MZ_STREAM_ERROR
Definition miniz.h:302
@ MZ_DATA_ERROR
Definition miniz.h:303
MINIZ_EXPORT int mz_uncompress(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len)
MINIZ_EXPORT int mz_compress2(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len, int level)
MINIZ_EXPORT int mz_deflateEnd(mz_streamp pStream)
MINIZ_EXPORT const char * mz_error(int err)
MINIZ_EXPORT int mz_inflateEnd(mz_streamp pStream)
MINIZ_EXPORT mz_ulong mz_adler32(mz_ulong adler, const unsigned char *ptr, size_t buf_len)
MINIZ_EXPORT mz_ulong mz_crc32(mz_ulong crc, const unsigned char *ptr, size_t buf_len)
mz_ulong uLong
Definition miniz.h:444
MINIZ_EXPORT int mz_deflateInit(mz_streamp pStream, int level)
@ MZ_FILTERED
Definition miniz.h:249
@ MZ_FIXED
Definition miniz.h:252
@ MZ_DEFAULT_STRATEGY
Definition miniz.h:248
@ MZ_RLE
Definition miniz.h:251
@ MZ_HUFFMAN_ONLY
Definition miniz.h:250
int intf
Definition miniz.h:448
@ MZ_SYNC_FLUSH
Definition miniz.h:289
@ MZ_BLOCK
Definition miniz.h:292
@ MZ_FULL_FLUSH
Definition miniz.h:290
@ MZ_FINISH
Definition miniz.h:291
@ MZ_PARTIAL_FLUSH
Definition miniz.h:288
@ MZ_NO_FLUSH
Definition miniz.h:287
uInt uIntf
Definition miniz.h:446
char charf
Definition miniz.h:447
unsigned int uInt
Definition miniz.h:443
MINIZ_EXPORT int mz_inflate(mz_streamp pStream, int flush)
@ MZ_BEST_SPEED
Definition miniz.h:268
@ MZ_NO_COMPRESSION
Definition miniz.h:267
@ MZ_UBER_COMPRESSION
Definition miniz.h:270
@ MZ_DEFAULT_LEVEL
Definition miniz.h:271
@ MZ_BEST_COMPRESSION
Definition miniz.h:269
@ MZ_DEFAULT_COMPRESSION
Definition miniz.h:272
MINIZ_EXPORT mz_ulong mz_deflateBound(mz_streamp pStream, mz_ulong source_len)
MINIZ_EXPORT void mz_free(void *p)
MINIZ_EXPORT int mz_uncompress2(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong *pSource_len)
MINIZ_EXPORT int mz_deflate(mz_streamp pStream, int flush)
void(* mz_free_func)(void *opaque, void *address)
Definition miniz.h:261
Byte Bytef
Definition miniz.h:445
void * voidpf
Definition miniz.h:449
MINIZ_EXPORT const char * mz_version(void)
uLong uLongf
Definition miniz.h:450
MINIZ_EXPORT int mz_inflateReset(mz_streamp pStream)
MINIZ_EXPORT int mz_inflateInit2(mz_streamp pStream, int window_bits)
unsigned char Byte
Definition miniz.h:442
mz_stream * mz_streamp
Definition miniz.h:338
MINIZ_EXPORT int mz_deflateReset(mz_streamp pStream)
void * voidp
Definition miniz.h:451
void *const voidpc
Definition miniz.h:452
Definition miniz.h:317
mz_ulong adler
Definition miniz.h:334
unsigned char * next_out
Definition miniz.h:322
void * opaque
Definition miniz.h:331
int data_type
Definition miniz.h:333
mz_free_func zfree
Definition miniz.h:330
mz_ulong total_out
Definition miniz.h:324
unsigned int avail_out
Definition miniz.h:323
struct mz_internal_state * state
Definition miniz.h:327
const unsigned char * next_in
Definition miniz.h:318
unsigned int avail_in
Definition miniz.h:319
mz_alloc_func zalloc
Definition miniz.h:329
mz_ulong total_in
Definition miniz.h:320
char * msg
Definition miniz.h:326
mz_ulong reserved
Definition miniz.h:335