49 for (i = 0; i + 7 <
block_len; i += 8, ptr += 8)
62 s1 %= 65521U,
s2 %= 65521U;
66 return (
s2 << 16) +
s1;
73 static const mz_uint32 s_crc32[16] = { 0, 0x1db71064, 0x3b6e20c8, 0x26d930ac, 0x76dc4190, 0x6b6b51f4, 0x4db26158, 0x5005713c,
74 0xedb88320, 0xf00f9344, 0xd6d6a3e8, 0xcb61b38c, 0x9b64c2b0, 0x86d3d2d4, 0xa00ae278, 0xbdbdf21c };
87#elif defined(USE_EXTERNAL_MZCRC)
99 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F, 0xE963A535,
100 0x9E6495A3, 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, 0x09B64C2B, 0x7EB17CBD,
101 0xE7B82D07, 0x90BF1D91, 0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, 0x1ADAD47D,
102 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, 0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC,
103 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5, 0x3B6E20C8, 0x4C69105E, 0xD56041E4,
104 0xA2677172, 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, 0x35B5A8FA, 0x42B2986C,
105 0xDBBBC9D6, 0xACBCF940, 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59, 0x26D930AC,
106 0x51DE003A, 0xC8D75180, 0xBFD06116, 0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F,
107 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, 0x2F6F7C87, 0x58684C11, 0xC1611DAB,
108 0xB6662D3D, 0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, 0x71B18589, 0x06B6B51F,
109 0x9FBFE4A5, 0xE8B8D433, 0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, 0x7F6A0DBB,
110 0x086D3D2D, 0x91646C97, 0xE6635C01, 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E,
111 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, 0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA,
112 0xFCB9887C, 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65, 0x4DB26158, 0x3AB551CE,
113 0xA3BC0074, 0xD4BB30E2, 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB, 0x4369E96A,
114 0x346ED9FC, 0xAD678846, 0xDA60B8D0, 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9,
115 0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, 0x5768B525, 0x206F85B3, 0xB966D409,
116 0xCE61E49F, 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, 0x59B33D17, 0x2EB40D81,
117 0xB7BD5C3B, 0xC0BA6CAD, 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, 0xEAD54739,
118 0x9DD277AF, 0x04DB2615, 0x73DC1683, 0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8,
119 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1, 0xF00F9344, 0x8708A3D2, 0x1E01F268,
120 0x6906C2FE, 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7, 0xFED41B76, 0x89D32BE0,
121 0x10DA7A5A, 0x67DD4ACC, 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, 0xD6D6A3E8,
122 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B,
123 0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, 0xDF60EFC3, 0xA867DF55, 0x316E8EEF,
124 0x4669BE79, 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, 0xCC0C7795, 0xBB0B4703,
125 0x220216B9, 0x5505262F, 0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, 0xC2D7FFA7,
126 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D, 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A,
127 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713, 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE,
128 0x0CB61B38, 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, 0x86D3D2D4, 0xF1D4E242,
129 0x68DDB3F8, 0x1FDA836E, 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777, 0x88085AE6,
130 0xFF0F6A70, 0x66063BCA, 0x11010B5C, 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45,
131 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, 0xA7672661, 0xD06016F7, 0x4969474D,
132 0x3E6E77DB, 0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0, 0xA9BCAE53, 0xDEBB9EC5,
133 0x47B2CF7F, 0x30B5FFE9, 0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, 0xBAD03605,
134 0xCDD70693, 0x54DE5729, 0x23D967BF, 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94,
135 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D
188#ifndef MINIZ_NO_ZLIB_APIS
190#ifndef MINIZ_NO_DEFLATE_APIS
361#ifndef MINIZ_NO_INFLATE_APIS
454 if (
pState->m_window_bits > 0)
460 if (
pState->m_last_status < 0)
474 pState->m_last_status = status;
514 pState->m_last_status = status;
607 {
MZ_OK,
"" }, {
MZ_STREAM_END,
"stream end" }, {
MZ_NEED_DICT,
"need dictionary" }, {
MZ_ERRNO,
"file error" }, {
MZ_STREAM_ERROR,
"stream error" }, {
MZ_DATA_ERROR,
"data error" }, {
MZ_MEM_ERROR,
"out of memory" }, {
MZ_BUF_ERROR,
"buf error" }, {
MZ_VERSION_ERROR,
"version error" }, {
MZ_PARAM_ERROR,
"parameter error" }
676#ifndef MINIZ_NO_DEFLATE_APIS
687 257, 258, 259, 260, 261, 262, 263, 264, 265, 265, 266, 266, 267, 267, 268, 268, 269, 269, 269, 269, 270, 270, 270, 270, 271, 271, 271, 271, 272, 272, 272, 272,
688 273, 273, 273, 273, 273, 273, 273, 273, 274, 274, 274, 274, 274, 274, 274, 274, 275, 275, 275, 275, 275, 275, 275, 275, 276, 276, 276, 276, 276, 276, 276, 276,
689 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278,
690 279, 279, 279, 279, 279, 279, 279, 279, 279, 279, 279, 279, 279, 279, 279, 279, 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, 280,
691 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281,
692 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282,
693 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283,
694 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 285
698 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 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 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
708 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
709 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
710 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
711 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
712 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
713 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
714 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17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28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29
737 0, 0, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
738 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
739 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13
764 for (i = 0; i < 256; i++)
791 A[0].m_key +=
A[1].m_key;
794 for (next = 1; next <
n - 1; next++)
798 A[next].m_key =
A[root].m_key;
802 A[next].m_key =
A[leaf++].m_key;
803 if (leaf >=
n || (root < next &&
A[root].
m_key <
A[leaf].
m_key))
812 for (next =
n - 3; next >= 0; next--)
820 while (root >= 0 && (
int)
A[root].m_key ==
dpth)
912 for (l =
code_size; l > 0; l--, code >>= 1)
918#define TDEFL_PUT_BITS(b, l) \
923 MZ_ASSERT(bits <= ((1U << len) - 1U)); \
924 d->m_bit_buffer |= (bits << d->m_bits_in); \
925 d->m_bits_in += len; \
926 while (d->m_bits_in >= 8) \
928 if (d->m_pOutput_buf < d->m_pOutput_buf_end) \
929 *d->m_pOutput_buf++ = (mz_uint8)(d->m_bit_buffer); \
930 d->m_bit_buffer >>= 8; \
936#define TDEFL_RLE_PREV_CODE_SIZE() \
938 if (rle_repeat_count) \
940 if (rle_repeat_count < 3) \
942 d->m_huff_count[2][prev_code_size] = (mz_uint16)(d->m_huff_count[2][prev_code_size] + rle_repeat_count); \
943 while (rle_repeat_count--) \
944 packed_code_sizes[num_packed_code_sizes++] = prev_code_size; \
948 d->m_huff_count[2][16] = (mz_uint16)(d->m_huff_count[2][16] + 1); \
949 packed_code_sizes[num_packed_code_sizes++] = 16; \
950 packed_code_sizes[num_packed_code_sizes++] = (mz_uint8)(rle_repeat_count - 3); \
952 rle_repeat_count = 0; \
956#define TDEFL_RLE_ZERO_CODE_SIZE() \
960 if (rle_z_count < 3) \
962 d->m_huff_count[2][0] = (mz_uint16)(d->m_huff_count[2][0] + rle_z_count); \
963 while (rle_z_count--) \
964 packed_code_sizes[num_packed_code_sizes++] = 0; \
966 else if (rle_z_count <= 10) \
968 d->m_huff_count[2][17] = (mz_uint16)(d->m_huff_count[2][17] + 1); \
969 packed_code_sizes[num_packed_code_sizes++] = 17; \
970 packed_code_sizes[num_packed_code_sizes++] = (mz_uint8)(rle_z_count - 3); \
974 d->m_huff_count[2][18] = (mz_uint16)(d->m_huff_count[2][18] + 1); \
975 packed_code_sizes[num_packed_code_sizes++] = 18; \
976 packed_code_sizes[num_packed_code_sizes++] = (mz_uint8)(rle_z_count - 11); \
982 static const mz_uint8 s_tdefl_packed_code_size_syms_swizzle[] = { 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 };
990 d->m_huff_count[0][256] = 1;
1065 TDEFL_PUT_BITS(d->m_huff_codes[2][code], d->m_huff_code_sizes[2][code]);
1074 mz_uint8 *p = &d->m_huff_code_sizes[0][0];
1076 for (i = 0; i <= 143; ++i)
1078 for (; i <= 255; ++i)
1080 for (; i <= 279; ++i)
1082 for (; i <= 287; ++i)
1085 memset(d->m_huff_code_sizes[1], 5, 32);
1093 static const mz_uint mz_bitmasks[17] = { 0x0000, 0x0001, 0x0003, 0x0007, 0x000F, 0x001F, 0x003F, 0x007F, 0x00FF, 0x01FF, 0x03FF, 0x07FF, 0x0FFF, 0x1FFF, 0x3FFF, 0x7FFF, 0xFFFF };
1095#if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && MINIZ_LITTLE_ENDIAN && MINIZ_HAS_64BIT_REGISTERS
1105#define TDEFL_PUT_BITS_FAST(b, l) \
1107 bit_buffer |= (((mz_uint64)(b)) << bits_in); \
1172#undef TDEFL_PUT_BITS_FAST
1176 d->m_bit_buffer = 0;
1186 TDEFL_PUT_BITS(d->m_huff_codes[0][256], d->m_huff_code_sizes[0][256]);
1188 return (d->m_pOutput_buf < d->m_pOutput_buf_end);
1233 TDEFL_PUT_BITS(d->m_huff_codes[0][256], d->m_huff_code_sizes[0][256]);
1235 return (d->m_pOutput_buf < d->m_pOutput_buf_end);
1248 static const mz_uint s_tdefl_num_probes[11] = { 0, 1, 6, 32, 16, 32, 128, 256, 512, 768, 1500 };
1261 MZ_ASSERT(!d->m_output_flush_remaining);
1262 d->m_output_flush_ofs = 0;
1263 d->m_output_flush_remaining = 0;
1265 *d->m_pLZ_flags = (
mz_uint8)(*d->m_pLZ_flags >> d->m_num_flags_left);
1266 d->m_pLZ_code_buf -= (d->m_num_flags_left == 8);
1275 for (i = 0; i <
mz_un; i++)
1305 ((d->m_lookahead_pos - d->m_lz_code_buf_dict_pos) <= d->m_dict_size))
1315 for (i = 2; i; --i, d->m_total_lz_bytes ^= 0xFFFF)
1319 for (i = 0; i < d->m_total_lz_bytes; ++i)
1343 for (i = 0; i < 4; i++)
1358 for (i = 2; i; --i,
z ^= 0xFFFF)
1365 MZ_ASSERT(d->m_pOutput_buf < d->m_pOutput_buf_end);
1370 d->m_pLZ_code_buf = d->m_lz_code_buf + 1;
1371 d->m_pLZ_flags = d->m_lz_code_buf;
1372 d->m_num_flags_left = 8;
1373 d->m_lz_code_buf_dict_pos += d->m_total_lz_bytes;
1374 d->m_total_lz_bytes = 0;
1379 if (d->m_pPut_buf_func)
1381 *d->m_pIn_buf_size = d->m_pSrc - (
const mz_uint8 *)d->m_pIn_buf;
1382 if (!(*d->m_pPut_buf_func)(d->m_output_buf,
n, d->m_pPut_buf_user))
1393 d->m_output_flush_remaining =
n;
1398 d->m_out_buf_ofs +=
n;
1402 return d->m_output_flush_remaining;
1405#if MINIZ_USE_UNALIGNED_LOADS_AND_STORES
1406#ifdef MINIZ_UNALIGNED_USE_MEMCPY
1420#define TDEFL_READ_UNALIGNED_WORD(p) *(const mz_uint16 *)(p)
1421#define TDEFL_READ_UNALIGNED_WORD2(p) *(const mz_uint16 *)(p)
1438#define TDEFL_PROBE \
1439 next_probe_pos = d->m_next[probe_pos]; \
1440 if ((!next_probe_pos) || ((dist = (mz_uint16)(lookahead_pos - next_probe_pos)) > max_dist)) \
1442 probe_pos = next_probe_pos & TDEFL_LZ_DICT_SIZE_MASK; \
1443 if (TDEFL_READ_UNALIGNED_WORD(&d->m_dict[probe_pos + match_len - 1]) == c01) \
1491#define TDEFL_PROBE \
1492 next_probe_pos = d->m_next[probe_pos]; \
1493 if ((!next_probe_pos) || ((dist = (mz_uint16)(lookahead_pos - next_probe_pos)) > max_dist)) \
1495 probe_pos = next_probe_pos & TDEFL_LZ_DICT_SIZE_MASK; \
1496 if ((d->m_dict[probe_pos + match_len] == c0) && (d->m_dict[probe_pos + match_len - 1] == c1)) \
1521#if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && MINIZ_LITTLE_ENDIAN
1522#ifdef MINIZ_UNALIGNED_USE_MEMCPY
1530#define TDEFL_READ_UNALIGNED_WORD32(p) *(const mz_uint32 *)(p)
1539 while ((d->m_src_buf_left) || ((d->m_flush) && (
lookahead_size)))
1601#ifdef MINIZ_UNALIGNED_USE_MEMCPY
1668 d->m_huff_count[0][
lit]++;
1708 d->m_total_lz_bytes++;
1709 *d->m_pLZ_code_buf++ =
lit;
1710 *d->m_pLZ_flags = (
mz_uint8)(*d->m_pLZ_flags >> 1);
1711 if (--d->m_num_flags_left == 0)
1713 d->m_num_flags_left = 8;
1714 d->m_pLZ_flags = d->m_pLZ_code_buf++;
1716 d->m_huff_count[0][
lit]++;
1732 d->m_pLZ_code_buf += 3;
1734 *d->m_pLZ_flags = (
mz_uint8)((*d->m_pLZ_flags >> 1) | 0x80);
1735 if (--d->m_num_flags_left == 0)
1737 d->m_num_flags_left = 8;
1738 d->m_pLZ_flags = d->m_pLZ_code_buf++;
1753 while ((
src_buf_left) || ((flush) && (d->m_lookahead_size)))
1790 mz_uint ins_pos = d->m_lookahead_pos + (d->m_lookahead_size - 1) - 2;
1832 if (d->m_saved_match_len)
1840 d->m_saved_match_len = 0;
1845 d->m_saved_lit = d->m_dict[
cur_pos];
1854 d->m_saved_match_len = 0;
1866 d->m_saved_lit = d->m_dict[
MZ_MIN(
cur_pos,
sizeof(d->m_dict) - 1)];
1877 ((d->m_total_lz_bytes > 31 * 1024) && (((((
mz_uint)(d->m_pLZ_code_buf - d->m_lz_code_buf) * 115) >> 7) >= d->m_total_lz_bytes) || (d->m_flags &
TDEFL_FORCE_ALL_RAW_BLOCKS))))
1894 if (d->m_pIn_buf_size)
1896 *d->m_pIn_buf_size = d->m_pSrc - (
const mz_uint8 *)d->m_pIn_buf;
1899 if (d->m_pOut_buf_size)
1901 size_t n =
MZ_MIN(*d->m_pOut_buf_size - d->m_out_buf_ofs, d->m_output_flush_remaining);
1902 memcpy((
mz_uint8 *)d->m_pOut_buf + d->m_out_buf_ofs, d->m_output_buf + d->m_output_flush_ofs,
n);
1903 d->m_output_flush_ofs += (
mz_uint)
n;
1904 d->m_output_flush_remaining -= (
mz_uint)
n;
1905 d->m_out_buf_ofs +=
n;
1907 *d->m_pOut_buf_size = d->m_out_buf_ofs;
1930 d->m_out_buf_ofs = 0;
1944 if ((d->m_output_flush_remaining) || (d->m_finished))
1947#if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && MINIZ_LITTLE_ENDIAN
1953 return d->m_prev_return_status;
1959 return d->m_prev_return_status;
1965 if ((flush) && (!d->m_lookahead_size) && (!d->m_src_buf_left) && (!d->m_output_flush_remaining))
1968 return d->m_prev_return_status;
1991 d->m_flags = (
mz_uint)(flags);
1992 d->m_max_probes[0] = 1 + ((flags & 0xFFF) + 2) / 3;
1994 d->m_max_probes[1] = 1 + (((flags & 0xFFF) >> 2) + 2) / 3;
1997 d->m_lookahead_pos = d->m_lookahead_size = d->m_dict_size = d->m_total_lz_bytes = d->m_lz_code_buf_dict_pos = d->m_bits_in = 0;
1998 d->m_output_flush_ofs = d->m_output_flush_remaining = d->m_finished = d->m_block_index = d->m_bit_buffer = d->m_wants_to_finish = 0;
1999 d->m_pLZ_code_buf = d->m_lz_code_buf + 1;
2000 d->m_pLZ_flags = d->m_lz_code_buf;
2001 *d->m_pLZ_flags = 0;
2002 d->m_num_flags_left = 8;
2003 d->m_pOutput_buf = d->m_output_buf;
2004 d->m_pOutput_buf_end = d->m_output_buf;
2006 d->m_saved_match_dist = d->m_saved_match_len = d->m_saved_lit = 0;
2008 d->m_pIn_buf =
NULL;
2009 d->m_pOut_buf =
NULL;
2010 d->m_pIn_buf_size =
NULL;
2011 d->m_pOut_buf_size =
NULL;
2014 d->m_src_buf_left = 0;
2015 d->m_out_buf_ofs = 0;
2025 return d->m_prev_return_status;
2030 return d->m_adler32;
2050 size_t m_size, m_capacity;
2063 if (!p->m_expandable)
2130#pragma warning(push)
2131#pragma warning(disable : 4204)
2140 static const mz_uint s_tdefl_png_num_probes[11] = { 0, 1, 6, 32, 16, 32, 128, 256, 512, 768, 1500 };
2157 for (
z = 41;
z; --
z)
2161 for (
y = 0;
y <
h; ++
y)
2175 static const mz_uint8 chans[] = { 0x00, 0x00, 0x04, 0x02, 0x06 };
2177 0x0a, 0x1a, 0x0a, 0x00, 0x00,
2178 0x00, 0x0d, 0x49, 0x48, 0x44,
2179 0x52, 0x00, 0x00, 0x00, 0x00,
2180 0x00, 0x00, 0x00, 0x00, 0x08,
2181 0x00, 0x00, 0x00, 0x00, 0x00,
2182 0x00, 0x00, 0x00, 0x00, 0x00,
2183 0x00, 0x00, 0x49, 0x44, 0x41,
2195 for (i = 0; i < 4; ++i,
c <<= 8)
2208 for (i = 0; i < 4; ++i,
c <<= 8)
2221#ifndef MINIZ_NO_MALLOC
2273#ifndef MINIZ_NO_INFLATE_APIS
2282#define TINFL_MEMCPY(d, s, l) memcpy(d, s, l)
2283#define TINFL_MEMSET(p, c, l) memset(p, c, l)
2285#define TINFL_CR_BEGIN \
2286 switch (r->m_state) \
2285#define TINFL_CR_BEGIN \ …
2289#define TINFL_CR_RETURN(state_index, result) \
2293 r->m_state = state_index; \
2295 case state_index:; \
2289#define TINFL_CR_RETURN(state_index, result) \ …
2298#define TINFL_CR_RETURN_FOREVER(state_index, result) \
2303 TINFL_CR_RETURN(state_index, result); \
2298#define TINFL_CR_RETURN_FOREVER(state_index, result) \ …
2307#define TINFL_CR_FINISH }
2309#define TINFL_GET_BYTE(state_index, c) \
2312 while (pIn_buf_cur >= pIn_buf_end) \
2314 TINFL_CR_RETURN(state_index, (decomp_flags & TINFL_FLAG_HAS_MORE_INPUT) ? TINFL_STATUS_NEEDS_MORE_INPUT : TINFL_STATUS_FAILED_CANNOT_MAKE_PROGRESS); \
2316 c = *pIn_buf_cur++; \
2309#define TINFL_GET_BYTE(state_index, c) \ …
2320#define TINFL_NEED_BITS(state_index, n) \
2324 TINFL_GET_BYTE(state_index, c); \
2325 bit_buf |= (((tinfl_bit_buf_t)c) << num_bits); \
2327 } while (num_bits < (mz_uint)(n))
2320#define TINFL_NEED_BITS(state_index, n) \ …
2328#define TINFL_SKIP_BITS(state_index, n) \
2331 if (num_bits < (mz_uint)(n)) \
2333 TINFL_NEED_BITS(state_index, n); \
2328#define TINFL_SKIP_BITS(state_index, n) \ …
2339#define TINFL_GET_BITS(state_index, b, n) \
2342 if (num_bits < (mz_uint)(n)) \
2344 TINFL_NEED_BITS(state_index, n); \
2346 b = bit_buf & ((1 << (n)) - 1); \
2339#define TINFL_GET_BITS(state_index, b, n) \ …
2356#define TINFL_HUFF_BITBUF_FILL(state_index, pLookUp, pTree) \
2359 temp = pLookUp[bit_buf & (TINFL_FAST_LOOKUP_SIZE - 1)]; \
2362 code_len = temp >> 9; \
2363 if ((code_len) && (num_bits >= code_len)) \
2366 else if (num_bits > TINFL_FAST_LOOKUP_BITS) \
2368 code_len = TINFL_FAST_LOOKUP_BITS; \
2371 temp = pTree[~temp + ((bit_buf >> code_len++) & 1)]; \
2372 } while ((temp < 0) && (num_bits >= (code_len + 1))); \
2376 TINFL_GET_BYTE(state_index, c); \
2377 bit_buf |= (((tinfl_bit_buf_t)c) << num_bits); \
2379 } while (num_bits < 15);
2356#define TINFL_HUFF_BITBUF_FILL(state_index, pLookUp, pTree) \ …
2387#define TINFL_HUFF_DECODE(state_index, sym, pLookUp, pTree) \
2391 mz_uint code_len, c; \
2392 if (num_bits < 15) \
2394 if ((pIn_buf_end - pIn_buf_cur) < 2) \
2396 TINFL_HUFF_BITBUF_FILL(state_index, pLookUp, pTree); \
2400 bit_buf |= (((tinfl_bit_buf_t)pIn_buf_cur[0]) << num_bits) | (((tinfl_bit_buf_t)pIn_buf_cur[1]) << (num_bits + 8)); \
2405 if ((temp = pLookUp[bit_buf & (TINFL_FAST_LOOKUP_SIZE - 1)]) >= 0) \
2406 code_len = temp >> 9, temp &= 511; \
2409 code_len = TINFL_FAST_LOOKUP_BITS; \
2412 temp = pTree[~temp + ((bit_buf >> code_len++) & 1)]; \
2413 } while (temp < 0); \
2416 bit_buf >>= code_len; \
2417 num_bits -= code_len; \
2387#define TINFL_HUFF_DECODE(state_index, sym, pLookUp, pTree) \ …
2425 else if (
r->m_type == 1)
2433 static const mz_uint16 s_length_base[31] = { 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0 };
2434 static const mz_uint8 s_length_extra[31] = { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 0, 0 };
2435 static const mz_uint16 s_dist_base[32] = { 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577, 0, 0 };
2436 static const mz_uint8 s_dist_extra[32] = { 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13 };
2437 static const mz_uint8 s_length_dezigzag[19] = { 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 };
2464 num_bits =
r->m_num_bits;
2467 counter =
r->m_counter;
2473 r->m_z_adler32 =
r->m_check_adler32 = 1;
2478 counter = (((
r->m_zhdr0 * 256 +
r->m_zhdr1) % 31 != 0) || (
r->m_zhdr1 & 32) || ((
r->m_zhdr0 & 15) != 8));
2480 counter |= (((1U << (8U + (
r->m_zhdr0 >> 4))) > 32768U) || ((
out_buf_size_mask + 1) < (
size_t)((
size_t)1 << (8U + (
r->m_zhdr0 >> 4)))));
2490 r->m_type =
r->m_final >> 1;
2494 for (counter = 0; counter < 4; ++counter)
2501 if ((counter = (
r->m_raw_header[0] | (
r->m_raw_header[1] << 8))) != (
mz_uint)(0xFFFF ^ (
r->m_raw_header[2] | (
r->m_raw_header[3] << 8))))
2505 while ((counter) && (num_bits))
2533 else if (
r->m_type == 3)
2543 r->m_table_sizes[0] = 288;
2544 r->m_table_sizes[1] = 32;
2546 for (i = 0; i <= 143; ++i)
2548 for (; i <= 255; ++i)
2550 for (; i <= 279; ++i)
2552 for (; i <= 287; ++i)
2557 for (counter = 0; counter < 3; counter++)
2563 for (counter = 0; counter <
r->m_table_sizes[2]; counter++)
2569 r->m_table_sizes[2] = 19;
2571 for (; (
int)
r->m_type >= 0;
r->m_type--)
2584 for (i = 0; i <
r->m_table_sizes[
r->m_type]; ++i)
2588 for (i = 1; i <= 15; ++i)
2593 if ((65536 != total) && (
used_syms > 1))
2639 for (counter = 0; counter < (
r->m_table_sizes[0] +
r->m_table_sizes[1]);)
2648 if ((
dist == 16) && (!counter))
2654 s +=
"\03\03\013"[
dist - 16];
2655 TINFL_MEMSET(
r->m_len_codes + counter, (
dist == 16) ?
r->m_len_codes[counter - 1] : 0, s);
2658 if ((
r->m_table_sizes[0] +
r->m_table_sizes[1]) != counter)
2663 TINFL_MEMCPY(
r->m_code_size_1,
r->m_len_codes +
r->m_table_sizes[0],
r->m_table_sizes[1]);
2686#if TINFL_USE_64BIT_BITBUF
2717#if !TINFL_USE_64BIT_BITBUF
2739 if (
sym2 == 0 && counter == 0)
2755 if ((counter &= 511) == 256)
2797#if MINIZ_USE_UNALIGNED_LOADS_AND_STORES
2798 else if ((counter >= 9) && (counter <=
dist))
2803#ifdef MINIZ_UNALIGNED_USE_MEMCPY
2811 if ((counter &= 7) < 3)
2842 }
while (!(
r->m_final & 1));
2857 for (counter = 0; counter < 4; ++counter)
2864 r->m_z_adler32 = (
r->m_z_adler32 << 8) | s;
2883 r->m_num_bits = num_bits;
2886 r->m_counter = counter;
2895 mz_uint32 i,
s1 =
r->m_check_adler32 & 0xffff,
s2 =
r->m_check_adler32 >> 16;
2899 for (i = 0; i + 7 <
block_len; i += 8, ptr += 8)
2912 s1 %= 65521U,
s2 %= 65521U;
2916 r->m_check_adler32 = (
s2 << 16) +
s1;
3001#ifndef MINIZ_NO_MALLOC
3049#ifndef MINIZ_NO_ARCHIVE_APIS
3058#ifdef MINIZ_NO_STDIO
3059#define MZ_FILE void *
3061#include <sys/stat.h>
3063#if defined(_MSC_VER) || defined(__MINGW64__) || defined(__MINGW32__)
3065#ifndef WIN32_LEAN_AND_MEAN
3066#define WIN32_LEAN_AND_MEAN
3069#define MICROSOFT_WINDOWS_WINBASE_H_DEFINE_INTERLOCKED_CPLUSPLUS_OVERLOADS 0
3106#if defined(__MINGW32__)
3107static int mz_stat(
const char *path,
struct _stat *buffer)
3124#ifndef MINIZ_NO_TIME
3125#include <sys/utime.h>
3127#define MZ_FOPEN mz_fopen
3128#define MZ_FCLOSE fclose
3129#define MZ_FREAD fread
3130#define MZ_FWRITE fwrite
3131#define MZ_FTELL64 _ftelli64
3132#define MZ_FSEEK64 _fseeki64
3133#if defined(__MINGW32__)
3134#define MZ_FILE_STAT_STRUCT _stat
3135#define MZ_FILE_STAT mz_stat
3137#define MZ_FILE_STAT_STRUCT _stat64
3138#define MZ_FILE_STAT mz_stat64
3140#define MZ_FFLUSH fflush
3141#define MZ_FREOPEN mz_freopen
3142#define MZ_DELETE_FILE remove
3144#elif defined(__WATCOMC__)
3145#ifndef MINIZ_NO_TIME
3146#include <sys/utime.h>
3148#define MZ_FOPEN(f, m) fopen(f, m)
3149#define MZ_FCLOSE fclose
3150#define MZ_FREAD fread
3151#define MZ_FWRITE fwrite
3152#define MZ_FTELL64 _ftelli64
3153#define MZ_FSEEK64 _fseeki64
3154#define MZ_FILE_STAT_STRUCT stat
3155#define MZ_FILE_STAT stat
3156#define MZ_FFLUSH fflush
3157#define MZ_FREOPEN(f, m, s) freopen(f, m, s)
3158#define MZ_DELETE_FILE remove
3160#elif defined(__TINYC__)
3161#ifndef MINIZ_NO_TIME
3162#include <sys/utime.h>
3164#define MZ_FOPEN(f, m) fopen(f, m)
3165#define MZ_FCLOSE fclose
3166#define MZ_FREAD fread
3167#define MZ_FWRITE fwrite
3168#define MZ_FTELL64 ftell
3169#define MZ_FSEEK64 fseek
3170#define MZ_FILE_STAT_STRUCT stat
3171#define MZ_FILE_STAT stat
3172#define MZ_FFLUSH fflush
3173#define MZ_FREOPEN(f, m, s) freopen(f, m, s)
3174#define MZ_DELETE_FILE remove
3176#elif defined(__USE_LARGEFILE64)
3177#ifndef MINIZ_NO_TIME
3180#define MZ_FOPEN(f, m) fopen64(f, m)
3181#define MZ_FCLOSE fclose
3182#define MZ_FREAD fread
3183#define MZ_FWRITE fwrite
3184#define MZ_FTELL64 ftello64
3185#define MZ_FSEEK64 fseeko64
3186#define MZ_FILE_STAT_STRUCT stat64
3187#define MZ_FILE_STAT stat64
3188#define MZ_FFLUSH fflush
3189#define MZ_FREOPEN(p, m, s) freopen64(p, m, s)
3190#define MZ_DELETE_FILE remove
3192#elif defined(__APPLE__) || defined(__FreeBSD__) || (defined(__linux__) && defined(__x86_64__))
3193#ifndef MINIZ_NO_TIME
3196#define MZ_FOPEN(f, m) fopen(f, m)
3197#define MZ_FCLOSE fclose
3198#define MZ_FREAD fread
3199#define MZ_FWRITE fwrite
3200#define MZ_FTELL64 ftello
3201#define MZ_FSEEK64 fseeko
3202#define MZ_FILE_STAT_STRUCT stat
3203#define MZ_FILE_STAT stat
3204#define MZ_FFLUSH fflush
3205#define MZ_FREOPEN(p, m, s) freopen(p, m, s)
3206#define MZ_DELETE_FILE remove
3209#pragma message("Using fopen, ftello, fseeko, stat() etc. path for file I/O - this path may not support large files.")
3210#ifndef MINIZ_NO_TIME
3213#define MZ_FOPEN(f, m) fopen(f, m)
3214#define MZ_FCLOSE fclose
3215#define MZ_FREAD fread
3216#define MZ_FWRITE fwrite
3217#ifdef __STRICT_ANSI__
3218#define MZ_FTELL64 ftell
3219#define MZ_FSEEK64 fseek
3221#define MZ_FTELL64 ftello
3222#define MZ_FSEEK64 fseeko
3224#define MZ_FILE_STAT_STRUCT stat
3225#define MZ_FILE_STAT stat
3226#define MZ_FFLUSH fflush
3227#define MZ_FREOPEN(f, m, s) freopen(f, m, s)
3228#define MZ_DELETE_FILE remove
3232#define MZ_TOLOWER(c) ((((c) >= 'A') && ((c) <= 'Z')) ? ((c) - 'A' + 'a') : (c))
3355#define MZ_ZIP_ARRAY_SET_ELEMENT_SIZE(array_ptr, element_size) (array_ptr)->m_element_size = element_size
3357#if defined(DEBUG) || defined(_DEBUG)
3363#define MZ_ZIP_ARRAY_ELEMENT(array_ptr, element_type, index) ((element_type *)((array_ptr)->m_p))[mz_zip_array_range_check(array_ptr, index)]
3365#define MZ_ZIP_ARRAY_ELEMENT(array_ptr, element_type, index) ((element_type *)((array_ptr)->m_p))[index]
3400#ifndef MINIZ_NO_ARCHIVE_WRITING_APIS
3423#ifndef MINIZ_NO_ARCHIVE_WRITING_APIS
3440#ifndef MINIZ_NO_TIME
3446 tm.tm_year = ((
dos_date >> 9) & 127) + 1980 - 1900;
3455#ifndef MINIZ_NO_ARCHIVE_WRITING_APIS
3477#ifndef MINIZ_NO_STDIO
3478#ifndef MINIZ_NO_ARCHIVE_WRITING_APIS
3487 *
pTime = file_stat.st_mtime;
3497 memset(&t, 0,
sizeof(t));
3566#define MZ_SWAP_UINT32(a, b) \
3566#define MZ_SWAP_UINT32(a, b) \ …
3590 start = (size - 2U) >> 1U;
3596 if ((
child = (root << 1U) + 1U) >= size)
3616 if ((
child = (root << 1U) + 1U) >= end)
3647 for (i =
n - 4; i >= 0; --i)
3667 cur_file_ofs =
MZ_MAX(cur_file_ofs - (
sizeof(
buf_u32) - 3), 0);
3670 *
pOfs = cur_file_ofs;
4013#ifndef MINIZ_NO_STDIO
4042 if ((!pZip) || (!pZip->
m_pRead))
4102#ifndef MINIZ_NO_STDIO
4179 if ((!pZip) || (!
pFile))
4314 if ((!p) || (!
pStat))
4324#ifndef MINIZ_NO_TIME
4338 pStat->m_filename[
n] =
'\0';
4342 pStat->m_comment_size =
n;
4344 pStat->m_comment[
n] =
'\0';
4431 for (i = 0; i < len; ++i)
4552 }
while (--
ofs >= 0);
4571 mz_uint64 needed_size, cur_file_ofs, comp_remaining, out_buf_ofs = 0, read_buf_size, read_buf_ofs = 0, read_buf_avail;
4623#ifndef MINIZ_DISABLE_ZIP_READER_CRC32_CHECKS
4641 read_buf_size = read_buf_avail = file_stat.
m_comp_size;
4658 if (((
sizeof(
size_t) ==
sizeof(
mz_uint32))) && (read_buf_size > 0x7FFFFFFF))
4674 read_buf_avail =
MZ_MIN(read_buf_size, comp_remaining);
4675 if (pZip->
m_pRead(pZip->
m_pIO_opaque, cur_file_ofs, pRead_buf, (
size_t)read_buf_avail) != read_buf_avail)
4681 cur_file_ofs += read_buf_avail;
4682 comp_remaining -= read_buf_avail;
4700#ifndef MINIZ_DISABLE_ZIP_READER_CRC32_CHECKS
4789#ifndef MINIZ_DISABLE_ZIP_READER_CRC32_CHECKS
4792 mz_uint64 read_buf_size, read_buf_ofs = 0, read_buf_avail, comp_remaining, out_buf_ofs = 0, cur_file_ofs;
4794 void *pRead_buf =
NULL;
4795 void *pWrite_buf =
NULL;
4833 read_buf_size = read_buf_avail = file_stat.
m_comp_size;
4861#ifndef MINIZ_DISABLE_ZIP_READER_CRC32_CHECKS
4872 while (comp_remaining)
4874 read_buf_avail =
MZ_MIN(read_buf_size, comp_remaining);
4875 if (pZip->
m_pRead(pZip->
m_pIO_opaque, cur_file_ofs, pRead_buf, (
size_t)read_buf_avail) != read_buf_avail)
4882#ifndef MINIZ_DISABLE_ZIP_READER_CRC32_CHECKS
4889 if (
pCallback(
pOpaque, out_buf_ofs, pRead_buf, (
size_t)read_buf_avail) != read_buf_avail)
4896 cur_file_ofs += read_buf_avail;
4897 out_buf_ofs += read_buf_avail;
4898 comp_remaining -= read_buf_avail;
4920 read_buf_avail =
MZ_MIN(read_buf_size, comp_remaining);
4921 if (pZip->
m_pRead(pZip->
m_pIO_opaque, cur_file_ofs, pRead_buf, (
size_t)read_buf_avail) != read_buf_avail)
4927 cur_file_ofs += read_buf_avail;
4928 comp_remaining -= read_buf_avail;
4946#ifndef MINIZ_DISABLE_ZIP_READER_CRC32_CHECKS
4968#ifndef MINIZ_DISABLE_ZIP_READER_CRC32_CHECKS
4969 else if (file_crc32 != file_stat.
m_crc32)
5042#ifndef MINIZ_DISABLE_ZIP_READER_CRC32_CHECKS
5045 pState->read_buf_ofs = 0;
5049 pState->out_blk_remain = 0;
5052 pState->cur_file_ofs =
pState->file_stat.m_local_header_ofs;
5080 pState->comp_remaining =
pState->file_stat.m_comp_size;
5098 pState->read_buf_size = 0;
5100 pState->read_buf_avail = 0;
5101 pState->comp_remaining =
pState->file_stat.m_comp_size;
5149 if (
pState->pZip->m_pState->m_pMem)
5167#ifndef MINIZ_DISABLE_ZIP_READER_CRC32_CHECKS
5188 if (!
pState->out_blk_remain)
5191 if ((!
pState->read_buf_avail) && (!
pState->pZip->m_pState->m_pMem))
5205 pState->read_buf_ofs = 0;
5218 if (
pState->out_blk_remain)
5226#ifndef MINIZ_DISABLE_ZIP_READER_CRC32_CHECKS
5264 if (
pState->out_buf_ofs !=
pState->file_stat.m_uncomp_size)
5269#ifndef MINIZ_DISABLE_ZIP_READER_CRC32_CHECKS
5270 else if (
pState->file_crc32 !=
pState->file_stat.m_crc32)
5279 if (!
pState->pZip->m_pState->m_pMem)
5293#ifndef MINIZ_NO_STDIO
5327#if !defined(MINIZ_NO_TIME) && !defined(MINIZ_NO_STDIO)
5646 if ((!
pMem) || (!size))
5681#ifndef MINIZ_NO_STDIO
5726#ifndef MINIZ_NO_ARCHIVE_WRITING_APIS
5746#define MZ_WRITE_LE16(p, v) mz_write_le16((mz_uint8 *)(p), (mz_uint16)(v))
5747#define MZ_WRITE_LE32(p, v) mz_write_le32((mz_uint8 *)(p), (mz_uint32)(v))
5748#define MZ_WRITE_LE64(p, v) mz_write_le64((mz_uint8 *)(p), (mz_uint64)(v))
5788#ifndef MINIZ_NO_ARCHIVE_WRITING_APIS
5807#ifndef MINIZ_NO_STDIO
5922#ifndef MINIZ_NO_STDIO
6045#ifdef MINIZ_NO_STDIO
6121 if ((
int)
pState->m_pZip->m_pWrite(
pState->m_pZip->m_pIO_opaque,
pState->m_cur_archive_file_ofs,
pBuf, len) != len)
6124 pState->m_cur_archive_file_ofs += len;
6125 pState->m_comp_size += len;
6129#define MZ_ZIP64_MAX_LOCAL_EXTRA_FIELD_SIZE (sizeof(mz_uint16) * 2 + sizeof(mz_uint64) * 2)
6130#define MZ_ZIP64_MAX_CENTRAL_EXTRA_FIELD_SIZE (sizeof(mz_uint16) * 2 + sizeof(mz_uint64) * 3)
6166 static mz_bool mz_zip_writer_create_local_dir_header(
mz_zip_archive *pZip,
mz_uint8 *
pDst,
mz_uint16 filename_size,
mz_uint16 extra_size,
mz_uint64 uncomp_size,
mz_uint64 comp_size,
mz_uint32 uncomp_crc32,
mz_uint16 method,
mz_uint16 bit_flags,
mz_uint16 dos_time,
mz_uint16 dos_date)
6231 if (!
mz_zip_writer_create_central_dir_header(pZip,
central_dir_header,
filename_size, (
mz_uint16)(
extra_size +
user_extra_data_len),
comment_size,
uncomp_size,
comp_size,
uncomp_crc32, method,
bit_flags,
dos_time,
dos_date,
local_header_ofs,
ext_attributes))
6288 return mz_zip_writer_add_mem_ex_v2(pZip,
pArchive_name,
pBuf,
buf_size,
pComment,
comment_size,
level_and_flags,
uncomp_size,
uncomp_crc32,
NULL,
NULL, 0,
NULL, 0);
6350#ifndef MINIZ_NO_TIME
6446 if (!
mz_zip_writer_create_local_dir_header(pZip,
local_dir_header, (
mz_uint16)
archive_name_size, (
mz_uint16)(
extra_size +
user_extra_data_len), 0, 0, 0, method,
bit_flags,
dos_time,
dos_date))
6473 if (!
mz_zip_writer_create_local_dir_header(pZip,
local_dir_header, (
mz_uint16)
archive_name_size, (
mz_uint16)
user_extra_data_len, 0, 0, 0, method,
bit_flags,
dos_time,
dos_date))
6512 state.m_pZip = pZip;
6514 state.m_comp_size = 0;
6567 comment_size,
uncomp_size,
comp_size,
uncomp_crc32, method,
bit_flags,
dos_time,
dos_date,
local_dir_header_ofs,
ext_attributes,
6655#ifndef MINIZ_NO_TIME
6701 if (!
mz_zip_writer_create_local_dir_header(pZip,
local_dir_header, (
mz_uint16)
archive_name_size, (
mz_uint16)(
extra_size +
user_extra_data_len), 0, 0, 0, method,
gen_flags,
dos_time,
dos_date))
6725 if (!
mz_zip_writer_create_local_dir_header(pZip,
local_dir_header, (
mz_uint16)
archive_name_size, (
mz_uint16)
user_extra_data_len, 0, 0, 0, method,
gen_flags,
dos_time,
dos_date))
6793 state.m_pZip = pZip;
6795 state.m_comp_size = 0;
6937#ifndef MINIZ_NO_STDIO
6967#if !defined(MINIZ_NO_TIME) && !defined(MINIZ_NO_STDIO)
6981 status =
mz_zip_writer_add_cfile(pZip,
pArchive_name,
pSrc_file,
uncomp_size,
pFile_time,
pComment,
comment_size,
level_and_flags,
NULL, 0,
NULL, 0);
7508#ifndef MINIZ_NO_STDIO
7550#ifndef MINIZ_NO_STDIO
7755 return "undefined error";
7757 return "too many files";
7759 return "file too large";
7761 return "unsupported method";
7763 return "unsupported encryption";
7765 return "unsupported feature";
7767 return "failed finding central directory";
7769 return "not a ZIP archive";
7771 return "invalid header or archive is corrupted";
7773 return "unsupported multidisk archive";
7775 return "decompression failed or archive is corrupted";
7777 return "compression failed";
7779 return "unexpected decompressed size";
7781 return "CRC-32 check failed";
7783 return "unsupported central directory size";
7785 return "allocation failed";
7787 return "file open failed";
7789 return "file create failed";
7791 return "file write failed";
7793 return "file read failed";
7795 return "file close failed";
7797 return "file seek failed";
7799 return "file stat failed";
7801 return "invalid parameter";
7803 return "invalid filename";
7805 return "buffer too small";
7807 return "internal error";
7809 return "file not found";
7811 return "archive is too large";
7813 return "validation failed";
7815 return "write callback failed";
7817 return "total errors";
7822 return "unknown error";
7909#ifndef MINIZ_NO_ARCHIVE_WRITING_APIS
static bool has_id(const jsont &json)
Return true iff the argument has a "@id" key.
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
void err(int eval, const char *fmt,...)
#define TINFL_HUFF_DECODE(state_index, sym, pLookUp, pTree)
mz_ulong mz_adler32(mz_ulong adler, const unsigned char *ptr, size_t buf_len)
mz_bool mz_zip_is_zip64(mz_zip_archive *pZip)
mz_bool mz_zip_reader_end(mz_zip_archive *pZip)
mz_bool mz_zip_validate_archive(mz_zip_archive *pZip, mz_uint flags)
mz_zip_type mz_zip_get_type(mz_zip_archive *pZip)
static size_t mz_zip_file_read_func(void *pOpaque, mz_uint64 file_ofs, void *pBuf, size_t n)
mz_bool mz_zip_end(mz_zip_archive *pZip)
mz_uint mz_zip_reader_get_num_files(mz_zip_archive *pZip)
static void mz_zip_array_init(mz_zip_array *pArray, mz_uint32 element_size)
static void mz_zip_reader_sort_central_dir_offsets_by_filename(mz_zip_archive *pZip)
mz_bool mz_zip_reader_init_file(mz_zip_archive *pZip, const char *pFilename, mz_uint32 flags)
#define TINFL_GET_BYTE(state_index, c)
#define MZ_ZIP_ARRAY_SET_ELEMENT_SIZE(array_ptr, element_size)
size_t mz_zip_get_central_dir_size(mz_zip_archive *pZip)
static int mz_zip_filename_compare(const mz_zip_array *pCentral_dir_array, const mz_zip_array *pCentral_dir_offsets, mz_uint l_index, const char *pR, mz_uint r_len)
static mz_bool mz_zip_file_stat_internal(mz_zip_archive *pZip, mz_uint file_index, const mz_uint8 *pCentral_dir_header, mz_zip_archive_file_stat *pStat, mz_bool *pFound_zip64_extra_data)
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)
static mz_bool mz_zip_reader_filename_less(const mz_zip_array *pCentral_dir_array, const mz_zip_array *pCentral_dir_offsets, mz_uint l_index, mz_uint r_index)
static const mz_uint8 * mz_zip_get_cdh(mz_zip_archive *pZip, mz_uint file_index)
mz_zip_reader_extract_iter_state * mz_zip_reader_extract_iter_new(mz_zip_archive *pZip, mz_uint file_index, mz_uint flags)
static mz_bool mz_zip_reader_locate_header_sig(mz_zip_archive *pZip, mz_uint32 record_sig, mz_uint32 record_size, mz_int64 *pOfs)
mz_zip_mode mz_zip_get_mode(mz_zip_archive *pZip)
#define MZ_FREOPEN(f, m, s)
MINIZ_EXPORT void * miniz_def_alloc_func(void *opaque, size_t items, size_t size)
MINIZ_EXPORT void * miniz_def_realloc_func(void *opaque, void *address, size_t items, size_t size)
size_t mz_zip_read_archive_data(mz_zip_archive *pZip, mz_uint64 file_ofs, void *pBuf, size_t n)
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)
mz_bool mz_zip_reader_is_file_a_directory(mz_zip_archive *pZip, mz_uint file_index)
void * tinfl_decompress_mem_to_heap(const void *pSrc_buf, size_t src_buf_len, size_t *pOut_len, int flags)
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)
unsigned char mz_validate_uint32[sizeof(mz_uint32)==4 ? 1 :-1]
#define TINFL_MEMCPY(d, s, l)
static mz_bool mz_zip_string_equal(const char *pA, const char *pB, mz_uint len, mz_uint flags)
#define TINFL_GET_BITS(state_index, b, n)
mz_bool mz_zip_reader_locate_file_v2(mz_zip_archive *pZip, const char *pName, const char *pComment, mz_uint flags, mz_uint32 *pIndex)
mz_bool mz_zip_reader_extract_to_cfile(mz_zip_archive *pZip, mz_uint file_index, FILE *pFile, mz_uint flags)
static void tinfl_clear_tree(tinfl_decompressor *r)
static mz_bool mz_zip_reader_init_internal(mz_zip_archive *pZip, mz_uint flags)
static mz_bool mz_zip_reader_end_internal(mz_zip_archive *pZip, mz_bool set_last_error)
mz_zip_error mz_zip_peek_last_error(mz_zip_archive *pZip)
mz_bool mz_zip_reader_init(mz_zip_archive *pZip, mz_uint64 size, mz_uint flags)
mz_zip_error mz_zip_get_last_error(mz_zip_archive *pZip)
mz_bool mz_zip_reader_extract_file_to_file(mz_zip_archive *pZip, const char *pArchive_filename, const char *pDst_filename, mz_uint flags)
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)
mz_bool mz_zip_validate_file_archive(const char *pFilename, mz_uint flags, mz_zip_error *pErr)
mz_bool mz_zip_reader_init_mem(mz_zip_archive *pZip, const void *pMem, size_t size, mz_uint flags)
const char * mz_version(void)
static size_t mz_zip_file_write_callback(void *pOpaque, mz_uint64 ofs, const void *pBuf, size_t n)
const char * mz_zip_get_error_string(mz_zip_error mz_err)
mz_bool mz_zip_reader_init_cfile(mz_zip_archive *pZip, FILE *pFile, mz_uint64 archive_size, mz_uint flags)
void * mz_zip_reader_extract_to_heap(mz_zip_archive *pZip, mz_uint file_index, size_t *pSize, mz_uint flags)
FILE * mz_zip_get_cfile(mz_zip_archive *pZip)
static mz_bool mz_zip_reader_read_central_dir(mz_zip_archive *pZip, mz_uint flags)
#define TINFL_MEMSET(p, c, l)
static mz_bool mz_zip_reader_extract_to_mem_no_alloc1(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, const mz_zip_archive_file_stat *st)
int mz_zip_reader_locate_file(mz_zip_archive *pZip, const char *pName, const char *pComment, mz_uint flags)
mz_bool mz_zip_reader_is_file_encrypted(mz_zip_archive *pZip, mz_uint file_index)
mz_ulong mz_crc32(mz_ulong crc, const mz_uint8 *ptr, size_t buf_len)
void mz_zip_zero_struct(mz_zip_archive *pZip)
mz_bool mz_zip_reader_extract_file_to_cfile(mz_zip_archive *pZip, const char *pArchive_filename, FILE *pFile, mz_uint flags)
mz_uint64 mz_zip_get_archive_size(mz_zip_archive *pZip)
size_t mz_zip_reader_extract_iter_read(mz_zip_reader_extract_iter_state *pState, void *pvBuf, size_t buf_size)
static size_t mz_zip_mem_read_func(void *pOpaque, mz_uint64 file_ofs, void *pBuf, size_t n)
mz_bool mz_zip_reader_is_file_supported(mz_zip_archive *pZip, mz_uint file_index)
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)
#define TINFL_CR_RETURN(state_index, result)
#define TINFL_CR_RETURN_FOREVER(state_index, result)
mz_zip_error mz_zip_set_last_error(mz_zip_archive *pZip, mz_zip_error err_num)
MINIZ_EXPORT void miniz_def_free_func(void *opaque, void *address)
tinfl_decompressor * tinfl_decompressor_alloc(void)
mz_zip_reader_extract_iter_state * mz_zip_reader_extract_file_iter_new(mz_zip_archive *pZip, const char *pFilename, mz_uint flags)
mz_bool mz_zip_reader_file_stat(mz_zip_archive *pZip, mz_uint file_index, mz_zip_archive_file_stat *pStat)
static mz_bool mz_zip_locate_file_binary_search(mz_zip_archive *pZip, const char *pFilename, mz_uint32 *pIndex)
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)
mz_uint64 mz_zip_get_archive_file_start_offset(mz_zip_archive *pZip)
static mz_bool mz_zip_set_error(mz_zip_archive *pZip, mz_zip_error err_num)
unsigned char mz_validate_uint64[sizeof(mz_uint64)==8 ? 1 :-1]
void * mz_zip_reader_extract_file_to_heap(mz_zip_archive *pZip, const char *pFilename, size_t *pSize, mz_uint flags)
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)
#define MZ_FILE_STAT_STRUCT
@ MZ_ZIP64_ECDH_VERSION_MADE_BY_OFS
@ MZ_ZIP_CDH_FILENAME_LEN_OFS
@ MZ_ZIP_LDH_BIT_FLAG_HAS_LOCATOR
@ MZ_ZIP_LOCAL_DIR_HEADER_SIG
@ MZ_ZIP_CDH_FILE_DATE_OFS
@ MZ_ZIP_LDH_BIT_FLAG_OFS
@ MZ_ZIP_ECDH_NUM_DISK_CDIR_OFS
@ MZ_ZIP_CDH_VERSION_NEEDED_OFS
@ MZ_ZIP_DATA_DESCRIPTER_SIZE64
@ MZ_ZIP_CDH_LOCAL_HEADER_OFS
@ MZ_ZIP64_END_OF_CENTRAL_DIR_HEADER_SIG
@ MZ_ZIP_GENERAL_PURPOSE_BIT_FLAG_UTF8
@ MZ_ZIP64_ECDH_NUM_DISK_CDIR_OFS
@ MZ_ZIP_CDH_COMPRESSED_SIZE_OFS
@ MZ_ZIP_DATA_DESCRIPTER_SIZE32
@ MZ_ZIP_ECDH_CDIR_NUM_ENTRIES_ON_DISK_OFS
@ MZ_ZIP_GENERAL_PURPOSE_BIT_FLAG_COMPRESSED_PATCH_FLAG
@ MZ_ZIP64_ECDL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NAL_ATTR_OFS
@ MZ_ZIP_GENERAL_PURPOSE_BIT_FLAG_LOCAL_DIR_IS_MASKED
@ MZ_ZIP64_ECDH_NUM_THIS_DISK_OFS
@ MZ_ZIP_END_OF_CENTRAL_DIR_HEADER_SIZE
@ MZ_ZIP_LOCAL_DIR_HEADER_SIZE
@ MZ_ZIP64_ECDH_CDIR_OFS_OFS
@ MZ_ZIP_LDH_DECOMPRESSED_SIZE_OFS
@ MZ_ZIP_CDH_BIT_FLAG_OFS
@ MZ_ZIP_CDH_COMMENT_LEN_OFS
@ MZ_ZIP_CENTRAL_DIR_HEADER_SIZE
@ MZ_ZIP64_END_OF_CENTRAL_DIR_HEADER_SIZE
@ MZ_ZIP_DATA_DESCRIPTOR_ID
@ MZ_ZIP_CDH_VERSION_MADE_BY_OFS
@ MZ_ZIP_ECDH_NUM_THIS_DISK_OFS
@ MZ_ZIP_GENERAL_PURPOSE_BIT_FLAG_IS_ENCRYPTED
@ MZ_ZIP64_ECDH_SIZE_OF_RECORD_OFS
static void mz_zip_array_clear(mz_zip_archive *pZip, mz_zip_array *pArray)
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)
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)
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)
#define MZ_SWAP_UINT32(a, b)
mz_bool mz_zip_validate_mem_archive(const void *pMem, size_t size, mz_uint flags, mz_zip_error *pErr)
mz_bool mz_zip_validate_file(mz_zip_archive *pZip, mz_uint file_index, mz_uint flags)
static size_t mz_zip_compute_crc32_callback(void *pOpaque, mz_uint64 file_ofs, const void *pBuf, size_t n)
#define MZ_ZIP_ARRAY_ELEMENT(array_ptr, element_type, index)
mz_bool mz_zip_reader_extract_iter_free(mz_zip_reader_extract_iter_state *pState)
static mz_bool mz_zip_array_resize(mz_zip_archive *pZip, mz_zip_array *pArray, size_t new_size, mz_uint growing)
unsigned char mz_validate_uint16[sizeof(mz_uint16)==2 ? 1 :-1]
static mz_bool mz_zip_array_ensure_capacity(mz_zip_archive *pZip, mz_zip_array *pArray, size_t min_new_capacity, mz_uint growing)
mz_zip_error mz_zip_clear_last_error(mz_zip_archive *pZip)
#define TINFL_SKIP_BITS(state_index, n)
mz_bool mz_zip_reader_extract_to_file(mz_zip_archive *pZip, mz_uint file_index, const char *pDst_filename, mz_uint flags)
mz_uint mz_zip_reader_get_filename(mz_zip_archive *pZip, mz_uint file_index, char *pFilename, mz_uint filename_buf_size)
void tinfl_decompressor_free(tinfl_decompressor *pDecomp)
static mz_bool mz_zip_reader_eocd64_valid(mz_zip_archive *pZip, uint64_t offset, uint8_t *buf)
@ MZ_ZIP_MAX_ARCHIVE_FILE_COMMENT_SIZE
@ MZ_ZIP_MAX_ARCHIVE_FILENAME_SIZE
@ MZ_ZIP_FLAG_ASCII_FILENAME
@ MZ_ZIP_FLAG_WRITE_HEADER_SET_SIZE
@ MZ_ZIP_FLAG_WRITE_ZIP64
@ MZ_ZIP_FLAG_WRITE_ALLOW_READING
@ MZ_ZIP_FLAG_VALIDATE_HEADERS_ONLY
@ MZ_ZIP_FLAG_VALIDATE_LOCATE_FILE_FLAG
@ MZ_ZIP_FLAG_COMPRESSED_DATA
@ MZ_ZIP_FLAG_READ_ALLOW_WRITING
@ MZ_ZIP_FLAG_DO_NOT_SORT_CENTRAL_DIRECTORY
@ MZ_ZIP_FLAG_CASE_SENSITIVE
@ MZ_ZIP_FLAG_IGNORE_PATH
size_t(* mz_file_write_func)(void *pOpaque, mz_uint64 file_ofs, const void *pBuf, size_t n)
@ TINFL_STATUS_ADLER32_MISMATCH
@ TINFL_STATUS_NEEDS_MORE_INPUT
@ TINFL_STATUS_HAS_MORE_OUTPUT
@ TINFL_STATUS_FAILED_CANNOT_MAKE_PROGRESS
#define TINFL_LZ_DICT_SIZE
#define MZ_CLEAR_OBJ(obj)
int(* tinfl_put_buf_func_ptr)(const void *pBuf, int len, void *pUser)
#define tinfl_get_adler32(r)
size_t(* mz_file_read_func)(void *pOpaque, mz_uint64 file_ofs, void *pBuf, size_t n)
#define MZ_CLEAR_ARR(obj)
#define TINFL_DECOMPRESS_MEM_TO_MEM_FAILED
@ TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF
@ TINFL_FLAG_HAS_MORE_INPUT
@ TINFL_FLAG_COMPUTE_ADLER32
@ TINFL_FLAG_PARSE_ZLIB_HEADER
@ MZ_ZIP_MODE_WRITING_HAS_BEEN_FINALIZED
#define MZ_CLEAR_PTR(obj)
@ MZ_ZIP_UNSUPPORTED_METHOD
@ MZ_ZIP_UNSUPPORTED_FEATURE
@ MZ_ZIP_FILE_OPEN_FAILED
@ MZ_ZIP_WRITE_CALLBACK_FAILED
@ MZ_ZIP_CRC_CHECK_FAILED
@ MZ_ZIP_FILE_CLOSE_FAILED
@ MZ_ZIP_FILE_CREATE_FAILED
@ MZ_ZIP_VALIDATION_FAILED
@ MZ_ZIP_FILE_STAT_FAILED
@ MZ_ZIP_INVALID_FILENAME
@ MZ_ZIP_COMPRESSION_FAILED
@ MZ_ZIP_UNSUPPORTED_ENCRYPTION
@ MZ_ZIP_UNSUPPORTED_MULTIDISK
@ MZ_ZIP_ARCHIVE_TOO_LARGE
@ MZ_ZIP_DECOMPRESSION_FAILED
@ MZ_ZIP_FILE_WRITE_FAILED
@ MZ_ZIP_INVALID_PARAMETER
@ MZ_ZIP_INVALID_HEADER_OR_CORRUPTED
@ MZ_ZIP_UNSUPPORTED_CDIR_SIZE
@ MZ_ZIP_FILE_READ_FAILED
@ MZ_ZIP_FAILED_FINDING_CENTRAL_DIR
@ MZ_ZIP_UNEXPECTED_DECOMPRESSED_SIZE
@ MZ_ZIP_FILE_SEEK_FAILED
mz_uint32 tinfl_bit_buf_t
void * malloc(__CPROVER_size_t malloc_size)
void * memset(void *s, int c, size_t n)
int memcmp(const void *s1, const void *s2, size_t n)
size_t strlen(const char *s)
void * memcpy(void *dst, const void *src, size_t n)
mz_uint64 m_local_header_ofs
char m_filename[MZ_ZIP_MAX_ARCHIVE_FILENAME_SIZE]
mz_uint64 m_central_directory_file_ofs
mz_zip_error m_last_error
mz_file_needs_keepalive m_pNeeds_keepalive
mz_file_write_func m_pWrite
mz_zip_internal_state * m_pState
mz_realloc_func m_pRealloc
mz_file_read_func m_pRead
mz_uint64 m_file_offset_alignment
mz_bool m_zip64_has_extended_info_fields
mz_zip_array m_sorted_central_dir_offsets
mz_uint64 m_file_archive_start_ofs
mz_zip_array m_central_dir_offsets
mz_zip_array m_central_dir
time_t time(time_t *tloc)
struct tm * localtime(const time_t *clock)
time_t mktime(struct tm *timeptr)