148#if defined(__TINYC__) && (defined(__linux) || defined(__linux__))
155#if !defined(MINIZ_NO_TIME) && !defined(MINIZ_NO_ARCHIVE_APIS)
159#if defined(_M_IX86) || defined(_M_X64) || defined(__i386__) || defined(__i386) || defined(__i486__) || defined(__i486) || defined(i386) || defined(__ia64__) || defined(__x86_64__)
161#define MINIZ_X86_OR_X64_CPU 1
163#define MINIZ_X86_OR_X64_CPU 0
166#if (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) || MINIZ_X86_OR_X64_CPU
168#define MINIZ_LITTLE_ENDIAN 1
170#define MINIZ_LITTLE_ENDIAN 0
174#if !defined(MINIZ_USE_UNALIGNED_LOADS_AND_STORES)
175#if MINIZ_X86_OR_X64_CPU
177#define MINIZ_USE_UNALIGNED_LOADS_AND_STORES 1
178#define MINIZ_UNALIGNED_USE_MEMCPY
180#define MINIZ_USE_UNALIGNED_LOADS_AND_STORES 0
184#if defined(_M_X64) || defined(_WIN64) || defined(__MINGW64__) || defined(_LP64) || defined(__LP64__) || defined(__ia64__) || defined(__x86_64__)
186#define MINIZ_HAS_64BIT_REGISTERS 1
188#define MINIZ_HAS_64BIT_REGISTERS 0
198typedef unsigned long mz_ulong;
201void mz_free(
void *p);
203#define MZ_ADLER32_INIT (1)
205mz_ulong mz_adler32(mz_ulong adler,
const unsigned char *ptr,
size_t buf_len);
207#define MZ_CRC32_INIT (0)
209mz_ulong mz_crc32(mz_ulong crc,
const unsigned char *ptr,
size_t buf_len);
214 MZ_DEFAULT_STRATEGY = 0,
226typedef void *(*mz_alloc_func)(
void *opaque,
size_t items,
size_t size);
227typedef void (*mz_free_func)(
void *opaque,
void *address);
228typedef void *(*mz_realloc_func)(
void *opaque,
void *address,
size_t items,
size_t size);
233 MZ_NO_COMPRESSION = 0,
235 MZ_BEST_COMPRESSION = 9,
236 MZ_UBER_COMPRESSION = 10,
237 MZ_DEFAULT_LEVEL = 6,
238 MZ_DEFAULT_COMPRESSION = -1
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
248#ifndef MINIZ_NO_ZLIB_APIS
254 MZ_PARTIAL_FLUSH = 1,
268 MZ_STREAM_ERROR = -2,
272 MZ_VERSION_ERROR = -6,
273 MZ_PARAM_ERROR = -10000
277#define MZ_DEFAULT_WINDOW_BITS 15
279struct mz_internal_state;
284 const unsigned char *next_in;
285 unsigned int avail_in;
288 unsigned char *next_out;
289 unsigned int avail_out;
293 struct mz_internal_state *state;
295 mz_alloc_func zalloc;
307const char *mz_version(
void);
320int mz_deflateInit(
mz_streamp pStream,
int level);
327int mz_deflateInit2(
mz_streamp pStream,
int level,
int method,
int window_bits,
int mem_level,
int strategy);
351mz_ulong mz_deflateBound(
mz_streamp pStream, mz_ulong source_len);
355int mz_compress(
unsigned char *pDest, mz_ulong *pDest_len,
const unsigned char *pSource, mz_ulong source_len);
356int mz_compress2(
unsigned char *pDest, mz_ulong *pDest_len,
const unsigned char *pSource, mz_ulong source_len,
int level);
359mz_ulong mz_compressBound(mz_ulong source_len);
366int mz_inflateInit2(
mz_streamp pStream,
int window_bits);
392int mz_uncompress(
unsigned char *pDest, mz_ulong *pDest_len,
const unsigned char *pSource, mz_ulong source_len);
395const char *mz_error(
int err);
399#ifndef MINIZ_NO_ZLIB_COMPATIBLE_NAMES
400typedef unsigned char Byte;
401typedef unsigned int uInt;
402typedef mz_ulong uLong;
410typedef void *
const voidpc;
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
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
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
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()
485typedef unsigned char mz_uint8;
486typedef signed short mz_int16;
487typedef unsigned short mz_uint16;
488typedef unsigned int mz_uint32;
489typedef unsigned int mz_uint;
490typedef int64_t mz_int64;
491typedef uint64_t mz_uint64;
499#define MZ_MACRO_END while (0, 0)
501#define MZ_MACRO_END while (0)
505#define MZ_FILE void *
516#define MZ_TIME_T mz_dummy_time_t
518#define MZ_TIME_T time_t
521#define MZ_ASSERT(x) assert(x)
523#ifdef MINIZ_NO_MALLOC
524#define MZ_MALLOC(x) NULL
525#define MZ_FREE(x) (void)x, ((void)0)
526#define MZ_REALLOC(p, x) NULL
528#define MZ_MALLOC(x) malloc(x)
529#define MZ_FREE(x) free(x)
530#define MZ_REALLOC(p, x) realloc(p, x)
533#define MZ_MAX(a, b) (((a) > (b)) ? (a) : (b))
534#define MZ_MIN(a, b) (((a) < (b)) ? (a) : (b))
535#define MZ_CLEAR_OBJ(obj) memset(&(obj), 0, sizeof(obj))
537#if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && MINIZ_LITTLE_ENDIAN
538#define MZ_READ_LE16(p) *((const mz_uint16 *)(p))
539#define MZ_READ_LE32(p) *((const mz_uint32 *)(p))
541#define MZ_READ_LE16(p) ((mz_uint32)(((const mz_uint8 *)(p))[0]) | ((mz_uint32)(((const mz_uint8 *)(p))[1]) << 8U))
542#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))
545#define MZ_READ_LE64(p) (((mz_uint64)MZ_READ_LE32(p)) | (((mz_uint64)MZ_READ_LE32((const mz_uint8 *)(p) + sizeof(mz_uint32))) << 32U))
548#define MZ_FORCEINLINE __forceinline
549#elif defined(__GNUC__)
550#define MZ_FORCEINLINE __inline__ __attribute__((__always_inline__))
552#define MZ_FORCEINLINE inline
559extern void *miniz_def_alloc_func(
void *opaque,
size_t items,
size_t size);
560extern void miniz_def_free_func(
void *opaque,
void *address);
561extern void *miniz_def_realloc_func(
void *opaque,
void *address,
size_t items,
size_t size);
563#define MZ_UINT16_MAX (0xFFFFU)
564#define MZ_UINT32_MAX (0xFFFFFFFFU)
578#define TDEFL_LESS_MEMORY 0
584 TDEFL_HUFFMAN_ONLY = 0,
585 TDEFL_DEFAULT_MAX_PROBES = 128,
586 TDEFL_MAX_PROBES_MASK = 0xFFF
600 TDEFL_WRITE_ZLIB_HEADER = 0x01000,
601 TDEFL_COMPUTE_ADLER32 = 0x02000,
602 TDEFL_GREEDY_PARSING_FLAG = 0x04000,
603 TDEFL_NONDETERMINISTIC_PARSING_FLAG = 0x08000,
604 TDEFL_RLE_MATCHES = 0x10000,
605 TDEFL_FILTER_MATCHES = 0x20000,
606 TDEFL_FORCE_ALL_STATIC_BLOCKS = 0x40000,
607 TDEFL_FORCE_ALL_RAW_BLOCKS = 0x80000
619void *tdefl_compress_mem_to_heap(
const void *pSrc_buf,
size_t src_buf_len,
size_t *pOut_len,
int flags);
623size_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);
635void *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);
636void *tdefl_write_image_to_png_file_in_memory(
const void *pImage,
int w,
int h,
int num_chans,
size_t *pLen_out);
639typedef mz_bool (*tdefl_put_buf_func_ptr)(
const void *pBuf,
int len,
void *pUser);
642mz_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);
646 TDEFL_MAX_HUFF_TABLES = 3,
647 TDEFL_MAX_HUFF_SYMBOLS_0 = 288,
648 TDEFL_MAX_HUFF_SYMBOLS_1 = 32,
649 TDEFL_MAX_HUFF_SYMBOLS_2 = 19,
650 TDEFL_LZ_DICT_SIZE = 32768,
651 TDEFL_LZ_DICT_SIZE_MASK = TDEFL_LZ_DICT_SIZE - 1,
652 TDEFL_MIN_MATCH_LEN = 3,
653 TDEFL_MAX_MATCH_LEN = 258
660 TDEFL_LZ_CODE_BUF_SIZE = 24 * 1024,
661 TDEFL_OUT_BUF_SIZE = (TDEFL_LZ_CODE_BUF_SIZE * 13) / 10,
662 TDEFL_MAX_HUFF_SYMBOLS = 288,
663 TDEFL_LZ_HASH_BITS = 12,
664 TDEFL_LEVEL1_HASH_SIZE_MASK = 4095,
665 TDEFL_LZ_HASH_SHIFT = (TDEFL_LZ_HASH_BITS + 2) / 3,
666 TDEFL_LZ_HASH_SIZE = 1 << TDEFL_LZ_HASH_BITS
671 TDEFL_LZ_CODE_BUF_SIZE = 64 * 1024,
672 TDEFL_OUT_BUF_SIZE = (TDEFL_LZ_CODE_BUF_SIZE * 13) / 10,
673 TDEFL_MAX_HUFF_SYMBOLS = 288,
674 TDEFL_LZ_HASH_BITS = 15,
675 TDEFL_LEVEL1_HASH_SIZE_MASK = 4095,
676 TDEFL_LZ_HASH_SHIFT = (TDEFL_LZ_HASH_BITS + 2) / 3,
677 TDEFL_LZ_HASH_SIZE = 1 << TDEFL_LZ_HASH_BITS
683 TDEFL_STATUS_BAD_PARAM = -2,
684 TDEFL_STATUS_PUT_BUF_FAILED = -1,
685 TDEFL_STATUS_OKAY = 0,
686 TDEFL_STATUS_DONE = 1
692 TDEFL_SYNC_FLUSH = 2,
693 TDEFL_FULL_FLUSH = 3,
700 tdefl_put_buf_func_ptr m_pPut_buf_func;
701 void *m_pPut_buf_user;
702 mz_uint m_flags, m_max_probes[2];
703 int m_greedy_parsing;
704 mz_uint m_adler32, m_lookahead_pos, m_lookahead_size, m_dict_size;
705 mz_uint8 *m_pLZ_code_buf, *m_pLZ_flags, *m_pOutput_buf, *m_pOutput_buf_end;
706 mz_uint m_num_flags_left, m_total_lz_bytes, m_lz_code_buf_dict_pos, m_bits_in, m_bit_buffer;
707 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;
708 tdefl_status m_prev_return_status;
709 const void *m_pIn_buf;
711 size_t *m_pIn_buf_size, *m_pOut_buf_size;
713 const mz_uint8 *m_pSrc;
714 size_t m_src_buf_left, m_out_buf_ofs;
715 mz_uint8 m_dict[TDEFL_LZ_DICT_SIZE + TDEFL_MAX_MATCH_LEN - 1];
716 mz_uint16 m_huff_count[TDEFL_MAX_HUFF_TABLES][TDEFL_MAX_HUFF_SYMBOLS];
717 mz_uint16 m_huff_codes[TDEFL_MAX_HUFF_TABLES][TDEFL_MAX_HUFF_SYMBOLS];
718 mz_uint8 m_huff_code_sizes[TDEFL_MAX_HUFF_TABLES][TDEFL_MAX_HUFF_SYMBOLS];
719 mz_uint8 m_lz_code_buf[TDEFL_LZ_CODE_BUF_SIZE];
720 mz_uint16 m_next[TDEFL_LZ_DICT_SIZE];
721 mz_uint16 m_hash[TDEFL_LZ_HASH_SIZE];
722 mz_uint8 m_output_buf[TDEFL_OUT_BUF_SIZE];
730tdefl_status tdefl_init(
tdefl_compressor *d, tdefl_put_buf_func_ptr pPut_buf_func,
void *pPut_buf_user,
int flags);
733tdefl_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);
737tdefl_status tdefl_compress_buffer(
tdefl_compressor *d,
const void *pIn_buf,
size_t in_buf_size, tdefl_flush flush);
746mz_uint tdefl_create_comp_flags_from_zip_params(
int level,
int window_bits,
int strategy);
748#ifndef MINIZ_NO_MALLOC
773 TINFL_FLAG_PARSE_ZLIB_HEADER = 1,
774 TINFL_FLAG_HAS_MORE_INPUT = 2,
775 TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF = 4,
776 TINFL_FLAG_COMPUTE_ADLER32 = 8
787void *tinfl_decompress_mem_to_heap(
const void *pSrc_buf,
size_t src_buf_len,
size_t *pOut_len,
int flags);
791#define TINFL_DECOMPRESS_MEM_TO_MEM_FAILED ((size_t)(-1))
792size_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);
796typedef int (*tinfl_put_buf_func_ptr)(
const void *pBuf,
int len,
void *pUser);
797int 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);
802#ifndef MINIZ_NO_MALLOC
811#define TINFL_LZ_DICT_SIZE 32768
818 TINFL_STATUS_FAILED_CANNOT_MAKE_PROGRESS = -4,
821 TINFL_STATUS_BAD_PARAM = -3,
824 TINFL_STATUS_ADLER32_MISMATCH = -2,
827 TINFL_STATUS_FAILED = -1,
833 TINFL_STATUS_DONE = 0,
838 TINFL_STATUS_NEEDS_MORE_INPUT = 1,
844 TINFL_STATUS_HAS_MORE_OUTPUT = 2
848#define tinfl_init(r) \
854#define tinfl_get_adler32(r) (r)->m_check_adler32
858tinfl_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);
863 TINFL_MAX_HUFF_TABLES = 3,
864 TINFL_MAX_HUFF_SYMBOLS_0 = 288,
865 TINFL_MAX_HUFF_SYMBOLS_1 = 32,
866 TINFL_MAX_HUFF_SYMBOLS_2 = 19,
867 TINFL_FAST_LOOKUP_BITS = 10,
868 TINFL_FAST_LOOKUP_SIZE = 1 << TINFL_FAST_LOOKUP_BITS
873 mz_uint8 m_code_size[TINFL_MAX_HUFF_SYMBOLS_0];
874 mz_int16 m_look_up[TINFL_FAST_LOOKUP_SIZE], m_tree[TINFL_MAX_HUFF_SYMBOLS_0 * 2];
877#if MINIZ_HAS_64BIT_REGISTERS
878#define TINFL_USE_64BIT_BITBUF 1
880#define TINFL_USE_64BIT_BITBUF 0
883#if TINFL_USE_64BIT_BITBUF
884typedef mz_uint64 tinfl_bit_buf_t;
885#define TINFL_BITBUF_SIZE (64)
887typedef mz_uint32 tinfl_bit_buf_t;
888#define TINFL_BITBUF_SIZE (32)
893 mz_uint32 m_state, m_num_bits, m_zhdr0, m_zhdr1, m_z_adler32, m_final, m_type, m_check_adler32, m_dist, m_counter, m_num_extra, m_table_sizes[TINFL_MAX_HUFF_TABLES];
894 tinfl_bit_buf_t m_bit_buf;
895 size_t m_dist_from_out_buf_start;
897 mz_uint8 m_raw_header[4], m_len_codes[TINFL_MAX_HUFF_SYMBOLS_0 + TINFL_MAX_HUFF_SYMBOLS_1 + 137];
909#ifndef MINIZ_NO_ARCHIVE_APIS
918 MZ_ZIP_MAX_IO_BUF_SIZE = 64 * 1024,
919 MZ_ZIP_MAX_ARCHIVE_FILENAME_SIZE = 512,
920 MZ_ZIP_MAX_ARCHIVE_FILE_COMMENT_SIZE = 512
926 mz_uint32 m_file_index;
929 mz_uint64 m_central_dir_ofs;
932 mz_uint16 m_version_made_by;
933 mz_uint16 m_version_needed;
934 mz_uint16 m_bit_flag;
945 mz_uint64 m_comp_size;
948 mz_uint64 m_uncomp_size;
951 mz_uint16 m_internal_attr;
952 mz_uint32 m_external_attr;
955 mz_uint64 m_local_header_ofs;
958 mz_uint32 m_comment_size;
961 mz_bool m_is_directory;
964 mz_bool m_is_encrypted;
967 mz_bool m_is_supported;
971 char m_filename[MZ_ZIP_MAX_ARCHIVE_FILENAME_SIZE];
975 char m_comment[MZ_ZIP_MAX_ARCHIVE_FILE_COMMENT_SIZE];
979typedef size_t (*mz_file_read_func)(
void *pOpaque, mz_uint64 file_ofs,
void *pBuf,
size_t n);
980typedef size_t (*mz_file_write_func)(
void *pOpaque, mz_uint64 file_ofs,
const void *pBuf,
size_t n);
981typedef mz_bool (*mz_file_needs_keepalive)(
void *pOpaque);
987 MZ_ZIP_MODE_INVALID = 0,
988 MZ_ZIP_MODE_READING = 1,
989 MZ_ZIP_MODE_WRITING = 2,
990 MZ_ZIP_MODE_WRITING_HAS_BEEN_FINALIZED = 3
994 MZ_ZIP_FLAG_CASE_SENSITIVE = 0x0100,
995 MZ_ZIP_FLAG_IGNORE_PATH = 0x0200,
996 MZ_ZIP_FLAG_COMPRESSED_DATA = 0x0400,
997 MZ_ZIP_FLAG_DO_NOT_SORT_CENTRAL_DIRECTORY = 0x0800,
998 MZ_ZIP_FLAG_VALIDATE_LOCATE_FILE_FLAG = 0x1000,
999 MZ_ZIP_FLAG_VALIDATE_HEADERS_ONLY = 0x2000,
1000 MZ_ZIP_FLAG_WRITE_ZIP64 = 0x4000,
1001 MZ_ZIP_FLAG_WRITE_ALLOW_READING = 0x8000,
1002 MZ_ZIP_FLAG_ASCII_FILENAME = 0x10000
1006 MZ_ZIP_TYPE_INVALID = 0,
1017 MZ_ZIP_NO_ERROR = 0,
1018 MZ_ZIP_UNDEFINED_ERROR,
1019 MZ_ZIP_TOO_MANY_FILES,
1020 MZ_ZIP_FILE_TOO_LARGE,
1021 MZ_ZIP_UNSUPPORTED_METHOD,
1022 MZ_ZIP_UNSUPPORTED_ENCRYPTION,
1023 MZ_ZIP_UNSUPPORTED_FEATURE,
1024 MZ_ZIP_FAILED_FINDING_CENTRAL_DIR,
1025 MZ_ZIP_NOT_AN_ARCHIVE,
1026 MZ_ZIP_INVALID_HEADER_OR_CORRUPTED,
1027 MZ_ZIP_UNSUPPORTED_MULTIDISK,
1028 MZ_ZIP_DECOMPRESSION_FAILED,
1029 MZ_ZIP_COMPRESSION_FAILED,
1030 MZ_ZIP_UNEXPECTED_DECOMPRESSED_SIZE,
1031 MZ_ZIP_CRC_CHECK_FAILED,
1032 MZ_ZIP_UNSUPPORTED_CDIR_SIZE,
1033 MZ_ZIP_ALLOC_FAILED,
1034 MZ_ZIP_FILE_OPEN_FAILED,
1035 MZ_ZIP_FILE_CREATE_FAILED,
1036 MZ_ZIP_FILE_WRITE_FAILED,
1037 MZ_ZIP_FILE_READ_FAILED,
1038 MZ_ZIP_FILE_CLOSE_FAILED,
1039 MZ_ZIP_FILE_SEEK_FAILED,
1040 MZ_ZIP_FILE_STAT_FAILED,
1041 MZ_ZIP_INVALID_PARAMETER,
1042 MZ_ZIP_INVALID_FILENAME,
1043 MZ_ZIP_BUF_TOO_SMALL,
1044 MZ_ZIP_INTERNAL_ERROR,
1045 MZ_ZIP_FILE_NOT_FOUND,
1046 MZ_ZIP_ARCHIVE_TOO_LARGE,
1047 MZ_ZIP_VALIDATION_FAILED,
1048 MZ_ZIP_WRITE_CALLBACK_FAILED,
1054 mz_uint64 m_archive_size;
1055 mz_uint64 m_central_directory_file_ofs;
1058 mz_uint32 m_total_files;
1059 mz_zip_mode m_zip_mode;
1060 mz_zip_type m_zip_type;
1061 mz_zip_error m_last_error;
1063 mz_uint64 m_file_offset_alignment;
1065 mz_alloc_func m_pAlloc;
1066 mz_free_func m_pFree;
1067 mz_realloc_func m_pRealloc;
1068 void *m_pAlloc_opaque;
1070 mz_file_read_func m_pRead;
1071 mz_file_write_func m_pWrite;
1072 mz_file_needs_keepalive m_pNeeds_keepalive;
1085#ifndef MINIZ_DISABLE_ZIP_READER_CRC32_CHECKS
1088 mz_uint64 read_buf_size, read_buf_ofs, read_buf_avail, comp_remaining, out_buf_ofs, cur_file_ofs;
1093 size_t out_blk_remain;
1103mz_bool mz_zip_reader_init(
mz_zip_archive *pZip, mz_uint64 size, mz_uint flags);
1105mz_bool mz_zip_reader_init_mem(
mz_zip_archive *pZip,
const void *pMem,
size_t size, mz_uint flags);
1107#ifndef MINIZ_NO_STDIO
1111mz_bool mz_zip_reader_init_file(
mz_zip_archive *pZip,
const char *pFilename, mz_uint32 flags);
1112mz_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);
1117mz_bool mz_zip_reader_init_cfile(
mz_zip_archive *pZip, MZ_FILE *pFile, mz_uint64 archive_size, mz_uint flags);
1136mz_uint64 mz_zip_get_archive_file_start_offset(
mz_zip_archive *pZip);
1140size_t mz_zip_read_archive_data(
mz_zip_archive *pZip, mz_uint64 file_ofs,
void *pBuf,
size_t n);
1144mz_zip_error mz_zip_set_last_error(
mz_zip_archive *pZip, mz_zip_error err_num);
1148const char *mz_zip_get_error_string(mz_zip_error mz_err);
1151mz_bool mz_zip_reader_is_file_a_directory(
mz_zip_archive *pZip, mz_uint file_index);
1154mz_bool mz_zip_reader_is_file_encrypted(
mz_zip_archive *pZip, mz_uint file_index);
1157mz_bool mz_zip_reader_is_file_supported(
mz_zip_archive *pZip, mz_uint file_index);
1161mz_uint mz_zip_reader_get_filename(
mz_zip_archive *pZip, mz_uint file_index,
char *pFilename, mz_uint filename_buf_size);
1166int mz_zip_reader_locate_file(
mz_zip_archive *pZip,
const char *pName,
const char *pComment, mz_uint flags);
1167int mz_zip_reader_locate_file_v2(
mz_zip_archive *pZip,
const char *pName,
const char *pComment, mz_uint flags, mz_uint32 *file_index);
1182mz_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);
1183mz_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);
1186mz_bool mz_zip_reader_extract_to_mem(
mz_zip_archive *pZip, mz_uint file_index,
void *pBuf,
size_t buf_size, mz_uint flags);
1187mz_bool mz_zip_reader_extract_file_to_mem(
mz_zip_archive *pZip,
const char *pFilename,
void *pBuf,
size_t buf_size, mz_uint flags);
1192void *mz_zip_reader_extract_to_heap(
mz_zip_archive *pZip, mz_uint file_index,
size_t *pSize, mz_uint flags);
1193void *mz_zip_reader_extract_file_to_heap(
mz_zip_archive *pZip,
const char *pFilename,
size_t *pSize, mz_uint flags);
1196mz_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);
1197mz_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);
1205#ifndef MINIZ_NO_STDIO
1208mz_bool mz_zip_reader_extract_to_file(
mz_zip_archive *pZip, mz_uint file_index,
const char *pDst_filename, mz_uint flags);
1209mz_bool mz_zip_reader_extract_file_to_file(
mz_zip_archive *pZip,
const char *pArchive_filename,
const char *pDst_filename, mz_uint flags);
1212mz_bool mz_zip_reader_extract_to_cfile(
mz_zip_archive *pZip, mz_uint file_index, MZ_FILE *File, mz_uint flags);
1213mz_bool mz_zip_reader_extract_file_to_cfile(
mz_zip_archive *pZip,
const char *pArchive_filename, MZ_FILE *pFile, mz_uint flags);
1218 typedef void *mz_zip_streaming_extract_state_ptr;
1219 mz_zip_streaming_extract_state_ptr mz_zip_streaming_extract_begin(
mz_zip_archive *pZip, mz_uint file_index, mz_uint flags);
1220 uint64_t mz_zip_streaming_extract_get_size(
mz_zip_archive *pZip, mz_zip_streaming_extract_state_ptr pState);
1221 uint64_t mz_zip_streaming_extract_get_cur_ofs(
mz_zip_archive *pZip, mz_zip_streaming_extract_state_ptr pState);
1222 mz_bool mz_zip_streaming_extract_seek(
mz_zip_archive *pZip, mz_zip_streaming_extract_state_ptr pState, uint64_t new_ofs);
1223 size_t mz_zip_streaming_extract_read(
mz_zip_archive *pZip, mz_zip_streaming_extract_state_ptr pState,
void *pBuf,
size_t buf_size);
1224 mz_bool mz_zip_streaming_extract_end(
mz_zip_archive *pZip, mz_zip_streaming_extract_state_ptr pState);
1229mz_bool mz_zip_validate_file(
mz_zip_archive *pZip, mz_uint file_index, mz_uint flags);
1232mz_bool mz_zip_validate_archive(
mz_zip_archive *pZip, mz_uint flags);
1235mz_bool mz_zip_validate_mem_archive(
const void *pMem,
size_t size, mz_uint flags, mz_zip_error *pErr);
1236mz_bool mz_zip_validate_file_archive(
const char *pFilename, mz_uint flags, mz_zip_error *pErr);
1243#ifndef MINIZ_NO_ARCHIVE_WRITING_APIS
1248mz_bool mz_zip_writer_init(
mz_zip_archive *pZip, mz_uint64 existing_size);
1249mz_bool mz_zip_writer_init_v2(
mz_zip_archive *pZip, mz_uint64 existing_size, mz_uint flags);
1251mz_bool mz_zip_writer_init_heap(
mz_zip_archive *pZip,
size_t size_to_reserve_at_beginning,
size_t initial_allocation_size);
1252mz_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);
1254#ifndef MINIZ_NO_STDIO
1255mz_bool mz_zip_writer_init_file(
mz_zip_archive *pZip,
const char *pFilename, mz_uint64 size_to_reserve_at_beginning);
1256mz_bool mz_zip_writer_init_file_v2(
mz_zip_archive *pZip,
const char *pFilename, mz_uint64 size_to_reserve_at_beginning, mz_uint flags);
1257mz_bool mz_zip_writer_init_cfile(
mz_zip_archive *pZip, MZ_FILE *pFile, mz_uint flags);
1266mz_bool mz_zip_writer_init_from_reader(
mz_zip_archive *pZip,
const char *pFilename);
1267mz_bool mz_zip_writer_init_from_reader_v2(
mz_zip_archive *pZip,
const char *pFilename, mz_uint flags);
1272mz_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);
1276mz_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,
1277 mz_uint64 uncomp_size, mz_uint32 uncomp_crc32);
1279mz_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,
1280 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,
1281 const char *user_extra_data_central, mz_uint user_extra_data_central_len);
1285mz_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 size_to_add,
1286 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,
1287 const char *user_extra_data_central, mz_uint user_extra_data_central_len);
1289#ifndef MINIZ_NO_STDIO
1292mz_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);
1295mz_bool mz_zip_writer_add_cfile(
mz_zip_archive *pZip,
const char *pArchive_name, MZ_FILE *pSrc_file, mz_uint64 size_to_add,
1296 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,
1297 const char *user_extra_data_central, mz_uint user_extra_data_central_len);
1311mz_bool mz_zip_writer_finalize_heap_archive(
mz_zip_archive *pZip,
void **ppBuf,
size_t *pSize);
1323mz_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);
1324mz_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);
1329void *mz_zip_extract_archive_file_to_heap(
const char *pZip_filename,
const char *pArchive_name,
size_t *pSize, mz_uint flags);
1330void *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);