/* 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). */
#define MINIZ_HAS_64BIT_REGISTERS 1
#else
#define MINIZ_HAS_64BIT_REGISTERS 0
#endif
#ifdef __cplusplus
extern"C"{
#endif
/* ------------------- zlib-style API Definitions. */
/* 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! */
typedefunsignedlongmz_ulong;
/* 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. */
voidmz_free(void*p);
#define MZ_ADLER32_INIT (1)
/* mz_adler32() returns the initial adler-32 value to use when called with ptr==NULL. */
/* 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. */
/* 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). */
enum
{
MZ_NO_FLUSH=0,
MZ_PARTIAL_FLUSH=1,
MZ_SYNC_FLUSH=2,
MZ_FULL_FLUSH=3,
MZ_FINISH=4,
MZ_BLOCK=5
};
/* Return status codes. MZ_PARAM_ERROR is non-standard. */
enum
{
MZ_OK=0,
MZ_STREAM_END=1,
MZ_NEED_DICT=2,
MZ_ERRNO=-1,
MZ_STREAM_ERROR=-2,
MZ_DATA_ERROR=-3,
MZ_MEM_ERROR=-4,
MZ_BUF_ERROR=-5,
MZ_VERSION_ERROR=-6,
MZ_PARAM_ERROR=-10000
};
/* Window bits */
#define MZ_DEFAULT_WINDOW_BITS 15
structmz_internal_state;
/* Compression/decompression stream struct. */
typedefstructmz_stream_s
{
constunsignedchar*next_in;/* pointer to next byte to read */
unsignedintavail_in;/* number of bytes available at next_in */
mz_ulongtotal_in;/* total number of bytes consumed so far */
unsignedchar*next_out;/* pointer to next byte to write */
unsignedintavail_out;/* number of bytes that can be written to next_out */
mz_ulongtotal_out;/* total number of bytes produced so far */
char*msg;/* error msg (unused) */
structmz_internal_state*state;/* internal state, allocated by zalloc/zfree */
mz_alloc_funczalloc;/* optional heap allocation function (defaults to malloc) */
mz_free_funczfree;/* optional heap free function (defaults to free) */
void*opaque;/* heap alloc function user pointer */
intdata_type;/* data_type (unused) */
mz_ulongadler;/* adler32 of the source or uncompressed data */
mz_ulongreserved;/* not used */
}mz_stream;
typedefmz_stream*mz_streamp;
/* Returns the version string of miniz.c. */
constchar*mz_version(void);
/* mz_deflateInit() initializes a compressor with default options: */
/* Parameters: */
/* pStream must point to an initialized mz_stream struct. */
/* level must be between [MZ_NO_COMPRESSION, MZ_BEST_COMPRESSION]. */
/* level 1 enables a specially optimized compression function that's been optimized purely for performance, not ratio. */
/* (This special func. is currently only enabled when MINIZ_USE_UNALIGNED_LOADS_AND_STORES and MINIZ_LITTLE_ENDIAN are defined.) */
/* Return values: */
/* MZ_OK on success. */
/* MZ_STREAM_ERROR if the stream is bogus. */
/* MZ_PARAM_ERROR if the input parameters are bogus. */
/* MZ_MEM_ERROR on out of memory. */
intmz_deflateInit(mz_streamppStream,intlevel);
/* mz_deflateInit2() is like mz_deflate(), except with more control: */
/* Additional parameters: */
/* method must be MZ_DEFLATED */
/* 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) */
/* mem_level must be between [1, 9] (it's checked but ignored by miniz.c) */
/* Quickly resets a compressor without having to reallocate anything. Same as calling mz_deflateEnd() followed by mz_deflateInit()/mz_deflateInit2(). */
intmz_deflateReset(mz_streamppStream);
/* mz_deflate() compresses the input to output, consuming as much of the input and producing as much output as possible. */
/* Parameters: */
/* 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. */
/* flush may be MZ_NO_FLUSH, MZ_PARTIAL_FLUSH/MZ_SYNC_FLUSH, MZ_FULL_FLUSH, or MZ_FINISH. */
/* Return values: */
/* 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). */
/* 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. */
/* MZ_STREAM_ERROR if the stream is bogus. */
/* MZ_PARAM_ERROR if one of the parameters is invalid. */
/* 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.) */
intmz_deflate(mz_streamppStream,intflush);
/* mz_deflateEnd() deinitializes a compressor: */
/* Return values: */
/* MZ_OK on success. */
/* MZ_STREAM_ERROR if the stream is bogus. */
intmz_deflateEnd(mz_streamppStream);
/* 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. */
/* mz_compressBound() returns a (very) conservative upper bound on the amount of data that could be generated by calling mz_compress(). */
mz_ulongmz_compressBound(mz_ulongsource_len);
/* Initializes a decompressor. */
intmz_inflateInit(mz_streamppStream);
/* 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: */
/* window_bits must be MZ_DEFAULT_WINDOW_BITS (to parse zlib header/footer) or -MZ_DEFAULT_WINDOW_BITS (raw deflate). */
/* Quickly resets a compressor without having to reallocate anything. Same as calling mz_inflateEnd() followed by mz_inflateInit()/mz_inflateInit2(). */
/* 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. */
/* Parameters: */
/* 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. */
/* flush may be MZ_NO_FLUSH, MZ_SYNC_FLUSH, or MZ_FINISH. */
/* 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). */
/* 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. */
/* Return values: */
/* 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. */
/* 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. */
/* MZ_STREAM_ERROR if the stream is bogus. */
/* MZ_DATA_ERROR if the deflate stream is invalid. */
/* MZ_PARAM_ERROR if one of the parameters is invalid. */
/* 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 */
/* with more input data, or with more room in the output buffer (except when using single call decompression, described above). */
intmz_inflate(mz_streamppStream,intflush);
/* Deinitializes a decompressor. */
intmz_inflateEnd(mz_streamppStream);
/* Single-call decompression. */
/* Returns MZ_OK on success, or one of the error codes from mz_inflate() on failure. */
/* Returns a string description of the specified error code, or NULL if the error code is invalid. */
constchar*mz_error(interr);
/* 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. */
/* Define MINIZ_NO_ZLIB_COMPATIBLE_NAMES to disable zlib-compatibility if you use zlib in the same project. */