55 " deflate 1.2.13 Copyright 1995-2022 Jean-loup Gailly and Mark Adler ";
149#define RANK(f) (((f) * 2) - ((f) > 4 ? 9 : 0))
157#define UPDATE_HASH(s,h,c) (h = (((h) << s->hash_shift) ^ (c)) & s->hash_mask)
171#define INSERT_STRING(s, str, match_head) \
172 (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \
173 match_head = s->head[s->ins_h], \
174 s->head[s->ins_h] = (Pos)(str))
176#define INSERT_STRING(s, str, match_head) \
177 (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \
178 match_head = s->prev[(str) & s->w_mask] = s->head[s->ins_h], \
179 s->head[s->ins_h] = (Pos)(str))
186#define CLEAR_HASH(s) \
188 s->head[s->hash_size - 1] = NIL; \
189 zmemzero((Bytef *)s->head, \
190 (unsigned)(s->hash_size - 1)*sizeof(*s->head)); \
203 uInt wsize = s->w_size;
209 *p = (
Pos)(m >= wsize ? m - wsize :
NIL);
216 *p = (
Pos)(m >= wsize ? m - wsize :
NIL);
237int ZEXPORT
deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
238 version, stream_size)
252 if (version ==
Z_NULL || version[0] != my_version[0] ||
259 if (strm->zalloc == (alloc_func)0) {
264 strm->opaque = (voidpf)0;
267 if (strm->zfree == (free_func)0)
275 if (level != 0) level = 1;
280 if (windowBits < 0) {
282 if (windowBits < -15)
284 windowBits = -windowBits;
287 else if (windowBits > 15) {
292 if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !=
Z_DEFLATED ||
293 windowBits < 8 || windowBits > 15 || level < 0 || level > 9 ||
294 strategy < 0 || strategy >
Z_FIXED || (windowBits == 8 && wrap != 1)) {
297 if (windowBits == 8) windowBits = 9;
306 s->w_bits = (uInt)windowBits;
307 s->w_size = 1 << s->w_bits;
308 s->w_mask = s->w_size - 1;
310 s->hash_bits = (uInt)memLevel + 7;
311 s->hash_size = 1 << s->hash_bits;
312 s->hash_mask = s->hash_size - 1;
315 s->window = (Bytef *)
ZALLOC(
strm, s->w_size, 2*
sizeof(Byte));
325 s->lit_bufsize = 1 << (memLevel + 6);
367 s->pending_buf_size = (
ulg)s->lit_bufsize * 4;
370 s->pending_buf ==
Z_NULL) {
376 s->sym_buf = s->pending_buf + s->lit_bufsize;
377 s->sym_end = (s->lit_bufsize - 1) * 3;
398 strm->zalloc == (alloc_func)0 ||
strm->zfree == (free_func)0)
418 const Bytef *dictionary;
425 z_const
unsigned char *next;
440 if (dictLength >= s->w_size) {
447 dictionary += dictLength - s->w_size;
448 dictLength = s->w_size;
452 avail =
strm->avail_in;
453 next =
strm->next_in;
454 strm->avail_in = dictLength;
455 strm->next_in = (z_const Bytef *)dictionary;
463 s->prev[str & s->w_mask] = s->head[s->ins_h];
465 s->head[s->ins_h] = (
Pos)str;
472 s->strstart += s->lookahead;
473 s->block_start = (long)s->strstart;
474 s->insert = s->lookahead;
476 s->match_length = s->prev_length =
MIN_MATCH-1;
477 s->match_available = 0;
478 strm->next_in = next;
479 strm->avail_in = avail;
499 if (dictionary !=
Z_NULL && len)
500 zmemcpy(dictionary, s->window + s->strstart + s->lookahead - len, len);
516 strm->total_in =
strm->total_out = 0;
522 s->pending_out = s->pending_buf;
577 *bits =
strm->state->bi_valid;
592 if (bits < 0 || bits > 16 ||
593 s->sym_buf < s->pending_out + ((
Buf_size + 7) >> 3))
599 s->bi_buf |= (
ush)((value & ((1 << put) - 1)) << s->bi_valid);
631 s->last_flush != -2) {
636 if (
strm->avail_in || (s->strstart - s->block_start) + s->lookahead)
639 if (s->level !=
level) {
640 if (s->level == 0 && s->matches != 0) {
670 s->max_lazy_match = (uInt)max_lazy;
671 s->nice_match = nice_length;
672 s->max_chain_length = (uInt)max_chain;
705 uLong fixedlen, storelen, wraplen;
710 fixedlen = sourceLen + (sourceLen >> 3) + (sourceLen >> 8) +
711 (sourceLen >> 9) + 4;
715 storelen = sourceLen + (sourceLen >> 5) + (sourceLen >> 7) +
716 (sourceLen >> 11) + 7;
720 return (fixedlen > storelen ? fixedlen : storelen) + 6;
729 wraplen = 6 + (s->strstart ? 4 : 0);
734 if (s->gzhead !=
Z_NULL) {
736 if (s->gzhead->extra !=
Z_NULL)
737 wraplen += 2 + s->gzhead->extra_len;
738 str = s->gzhead->name;
743 str = s->gzhead->comment;
758 if (s->w_bits != 15 || s->hash_bits != 8 + 7)
759 return (s->w_bits <= s->hash_bits ? fixedlen : storelen) + wraplen;
763 return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
764 (sourceLen >> 25) + 13 - 6 + wraplen;
794 if (len >
strm->avail_out) len =
strm->avail_out;
795 if (len == 0)
return;
798 strm->next_out += len;
799 s->pending_out += len;
800 strm->total_out += len;
801 strm->avail_out -= len;
803 if (s->pending == 0) {
804 s->pending_out = s->pending_buf;
811#define HCRC_UPDATE(beg) \
813 if (s->gzhead->hcrc && s->pending > (beg)) \
814 strm->adler = crc32(strm->adler, s->pending_buf + (beg), \
815 s->pending - (beg)); \
838 old_flush = s->last_flush;
839 s->last_flush = flush;
842 if (s->pending != 0) {
844 if (
strm->avail_out == 0) {
859 }
else if (
strm->avail_in == 0 &&
RANK(flush) <=
RANK(old_flush) &&
874 uInt header = (
Z_DEFLATED + ((s->w_bits - 8) << 4)) << 8;
879 else if (s->level < 6)
881 else if (s->level == 6)
885 header |= (level_flags << 6);
887 header += 31 - (header % 31);
892 if (s->strstart != 0) {
901 if (s->pending != 0) {
913 if (s->gzhead ==
Z_NULL) {
927 if (s->pending != 0) {
933 put_byte(s, (s->gzhead->text ? 1 : 0) +
934 (s->gzhead->hcrc ? 2 : 0) +
935 (s->gzhead->extra ==
Z_NULL ? 0 : 4) +
936 (s->gzhead->name ==
Z_NULL ? 0 : 8) +
937 (s->gzhead->comment ==
Z_NULL ? 0 : 16)
939 put_byte(s, (Byte)(s->gzhead->time & 0xff));
940 put_byte(s, (Byte)((s->gzhead->time >> 8) & 0xff));
941 put_byte(s, (Byte)((s->gzhead->time >> 16) & 0xff));
942 put_byte(s, (Byte)((s->gzhead->time >> 24) & 0xff));
947 if (s->gzhead->extra !=
Z_NULL) {
948 put_byte(s, s->gzhead->extra_len & 0xff);
949 put_byte(s, (s->gzhead->extra_len >> 8) & 0xff);
959 if (s->gzhead->extra !=
Z_NULL) {
960 ulg beg = s->pending;
961 uInt left = (s->gzhead->extra_len & 0xffff) - s->gzindex;
962 while (s->pending + left > s->pending_buf_size) {
963 uInt copy = s->pending_buf_size - s->pending;
964 zmemcpy(s->pending_buf + s->pending,
965 s->gzhead->extra + s->gzindex, copy);
966 s->pending = s->pending_buf_size;
970 if (s->pending != 0) {
977 zmemcpy(s->pending_buf + s->pending,
978 s->gzhead->extra + s->gzindex, left);
986 if (s->gzhead->name !=
Z_NULL) {
987 ulg beg = s->pending;
990 if (s->pending == s->pending_buf_size) {
993 if (s->pending != 0) {
999 val = s->gzhead->name[s->gzindex++];
1008 if (s->gzhead->comment !=
Z_NULL) {
1009 ulg beg = s->pending;
1012 if (s->pending == s->pending_buf_size) {
1015 if (s->pending != 0) {
1021 val = s->gzhead->comment[s->gzindex++];
1029 if (s->gzhead->hcrc) {
1030 if (s->pending + 2 > s->pending_buf_size) {
1032 if (s->pending != 0) {
1045 if (s->pending != 0) {
1054 if (
strm->avail_in != 0 || s->lookahead != 0 ||
1067 if (
strm->avail_out == 0) {
1082 }
else if (flush !=
Z_BLOCK) {
1089 if (s->lookahead == 0) {
1091 s->block_start = 0L;
1097 if (
strm->avail_out == 0) {
1129 if (s->wrap > 0) s->wrap = -s->wrap;
1224 unsigned len =
strm->avail_in;
1226 if (len > size) len = size;
1227 if (len == 0)
return 0;
1229 strm->avail_in -= len;
1232 if (
strm->state->wrap == 1) {
1236 else if (
strm->state->wrap == 2) {
1240 strm->next_in += len;
1241 strm->total_in += len;
1252 s->window_size = (
ulg)2L*s->w_size;
1264 s->block_start = 0L;
1267 s->match_length = s->prev_length =
MIN_MATCH-1;
1268 s->match_available = 0;
1286 unsigned chain_length = s->max_chain_length;
1287 register Bytef *scan = s->window + s->strstart;
1288 register Bytef *match;
1290 int best_len = (int)s->prev_length;
1298 uInt wmask = s->w_mask;
1304 register Bytef *strend = s->window + s->strstart +
MAX_MATCH - 1;
1305 register ush scan_start = *(
ushf*)scan;
1306 register ush scan_end = *(
ushf*)(scan + best_len - 1);
1308 register Bytef *strend = s->window + s->strstart +
MAX_MATCH;
1309 register Byte scan_end1 = scan[best_len - 1];
1310 register Byte scan_end = scan[best_len];
1319 if (s->prev_length >= s->good_match) {
1332 match = s->window + cur_match;
1342#if (defined(UNALIGNED_OK) && MAX_MATCH == 258)
1346 if (*(
ushf*)(match + best_len - 1) != scan_end ||
1347 *(
ushf*)match != scan_start)
continue;
1358 Assert(scan[2] == match[2],
"scan[2]?");
1361 }
while (*(
ushf*)(scan += 2) == *(
ushf*)(match += 2) &&
1362 *(
ushf*)(scan += 2) == *(
ushf*)(match += 2) &&
1363 *(
ushf*)(scan += 2) == *(
ushf*)(match += 2) &&
1364 *(
ushf*)(scan += 2) == *(
ushf*)(match += 2) &&
1369 Assert(scan <= s->
window + (
unsigned)(s->window_size - 1),
1371 if (*scan == *match) scan++;
1373 len = (
MAX_MATCH - 1) - (
int)(strend - scan);
1378 if (match[best_len] != scan_end ||
1379 match[best_len - 1] != scan_end1 ||
1381 *++match != scan[1])
continue;
1390 Assert(*scan == *match,
"match[2]?");
1396 }
while (*++scan == *++match && *++scan == *++match &&
1397 *++scan == *++match && *++scan == *++match &&
1398 *++scan == *++match && *++scan == *++match &&
1399 *++scan == *++match && *++scan == *++match &&
1402 Assert(scan <= s->
window + (
unsigned)(s->window_size - 1),
1410 if (len > best_len) {
1411 s->match_start = cur_match;
1415 scan_end = *(
ushf*)(scan + best_len - 1);
1417 scan_end1 = scan[best_len - 1];
1418 scan_end = scan[best_len];
1421 }
while ((cur_match =
prev[cur_match & wmask]) > limit
1422 && --chain_length != 0);
1424 if ((uInt)best_len <= s->
lookahead)
return (uInt)best_len;
1425 return s->lookahead;
1437 register Bytef *scan = s->window + s->strstart;
1438 register Bytef *match;
1440 register Bytef *strend = s->window + s->strstart +
MAX_MATCH;
1452 match = s->window + cur_match;
1456 if (match[0] != scan[0] || match[1] != scan[1])
return MIN_MATCH-1;
1464 scan += 2, match += 2;
1465 Assert(*scan == *match,
"match[2]?");
1471 }
while (*++scan == *++match && *++scan == *++match &&
1472 *++scan == *++match && *++scan == *++match &&
1473 *++scan == *++match && *++scan == *++match &&
1474 *++scan == *++match && *++scan == *++match &&
1477 Assert(scan <= s->
window + (
unsigned)(s->window_size - 1),
"wild scan");
1483 s->match_start = cur_match;
1484 return (uInt)len <= s->lookahead ? (uInt)len : s->
lookahead;
1503 if (
zmemcmp(s->window + match,
1504 s->window + start, length) != EQUAL) {
1505 fprintf(stderr,
" start %u, match %u, length %d\n",
1506 start, match, length);
1508 fprintf(stderr,
"%c%c", s->window[match++], s->window[start++]);
1509 }
while (--length != 0);
1510 z_error(
"invalid match");
1512 if (z_verbose > 1) {
1513 fprintf(stderr,
"\\[%d,%d]", start - match, length);
1514 do { putc(s->window[start++], stderr); }
while (--length != 0);
1518# define check_match(s, start, match, length)
1536 uInt wsize = s->w_size;
1541 more = (unsigned)(s->window_size -(
ulg)s->lookahead -(
ulg)s->strstart);
1544 if (
sizeof(
int) <= 2) {
1545 if (more == 0 && s->strstart == 0 && s->lookahead == 0) {
1548 }
else if (more == (
unsigned)(-1)) {
1559 if (s->strstart >= wsize +
MAX_DIST(s)) {
1561 zmemcpy(s->window, s->window + wsize, (
unsigned)wsize - more);
1562 s->match_start -= wsize;
1563 s->strstart -= wsize;
1564 s->block_start -= (long) wsize;
1565 if (s->insert > s->strstart)
1566 s->insert = s->strstart;
1570 if (s->strm->avail_in == 0)
break;
1583 Assert(more >= 2,
"more < 2");
1585 n =
read_buf(s->strm, s->window + s->strstart + s->lookahead, more);
1589 if (s->lookahead + s->insert >=
MIN_MATCH) {
1590 uInt str = s->strstart - s->insert;
1591 s->ins_h = s->window[str];
1599 s->prev[str & s->w_mask] = s->head[s->ins_h];
1601 s->head[s->ins_h] = (
Pos)str;
1604 if (s->lookahead + s->insert <
MIN_MATCH)
1612 }
while (s->lookahead <
MIN_LOOKAHEAD && s->strm->avail_in != 0);
1621 if (s->high_water < s->window_size) {
1622 ulg curr = s->strstart + (
ulg)(s->lookahead);
1625 if (s->high_water < curr) {
1629 init = s->window_size - curr;
1632 zmemzero(s->window + curr, (
unsigned)init);
1633 s->high_water = curr + init;
1641 if (init > s->window_size - s->high_water)
1642 init = s->window_size - s->high_water;
1643 zmemzero(s->window + s->high_water, (
unsigned)init);
1644 s->high_water += init;
1649 "not enough room for search");
1656#define FLUSH_BLOCK_ONLY(s, last) { \
1657 _tr_flush_block(s, (s->block_start >= 0L ? \
1658 (charf *)&s->window[(unsigned)s->block_start] : \
1660 (ulg)((long)s->strstart - s->block_start), \
1662 s->block_start = s->strstart; \
1663 flush_pending(s->strm); \
1664 Tracev((stderr,"[FLUSH]")); \
1668#define FLUSH_BLOCK(s, last) { \
1669 FLUSH_BLOCK_ONLY(s, last); \
1670 if (s->strm->avail_out == 0) return (last) ? finish_started : need_more; \
1674#define MAX_STORED 65535
1677#define MIN(a, b) ((a) > (b) ? (b) : (a))
1702 unsigned min_block =
MIN(s->pending_buf_size - 5, s->w_size);
1708 unsigned len, left, have, last = 0;
1709 unsigned used = s->strm->avail_in;
1716 have = (s->bi_valid + 42) >> 3;
1717 if (s->strm->avail_out < have)
1720 have = s->strm->avail_out - have;
1721 left = s->strstart - s->block_start;
1722 if (len > (
ulg)left + s->strm->avail_in)
1723 len = left + s->strm->avail_in;
1732 if (len < min_block && ((len == 0 && flush !=
Z_FINISH) ||
1734 len != left + s->strm->avail_in))
1740 last = flush ==
Z_FINISH && len == left + s->strm->avail_in ? 1 : 0;
1744 s->pending_buf[s->pending - 4] = len;
1745 s->pending_buf[s->pending - 3] = len >> 8;
1746 s->pending_buf[s->pending - 2] = ~len;
1747 s->pending_buf[s->pending - 1] = ~len >> 8;
1754 s->compressed_len += len << 3;
1755 s->bits_sent += len << 3;
1762 zmemcpy(s->strm->next_out, s->window + s->block_start, left);
1763 s->strm->next_out += left;
1764 s->strm->avail_out -= left;
1765 s->strm->total_out += left;
1766 s->block_start += left;
1774 read_buf(s->strm, s->strm->next_out, len);
1775 s->strm->next_out += len;
1776 s->strm->avail_out -= len;
1777 s->strm->total_out += len;
1779 }
while (last == 0);
1787 used -= s->strm->avail_in;
1792 if (used >= s->w_size) {
1794 zmemcpy(s->window, s->strm->next_in - s->w_size, s->w_size);
1795 s->strstart = s->w_size;
1796 s->insert = s->strstart;
1799 if (s->window_size - s->strstart <= used) {
1801 s->strstart -= s->w_size;
1802 zmemcpy(s->window, s->window + s->w_size, s->strstart);
1805 if (s->insert > s->strstart)
1806 s->insert = s->strstart;
1808 zmemcpy(s->window + s->strstart, s->strm->next_in - used, used);
1809 s->strstart += used;
1810 s->insert +=
MIN(used, s->w_size - s->insert);
1812 s->block_start = s->strstart;
1814 if (s->high_water < s->strstart)
1815 s->high_water = s->strstart;
1823 s->strm->avail_in == 0 && (
long)s->strstart == s->block_start)
1827 have = s->window_size - s->strstart;
1828 if (s->strm->avail_in > have && s->block_start >= (
long)s->w_size) {
1830 s->block_start -= s->w_size;
1831 s->strstart -= s->w_size;
1832 zmemcpy(s->window, s->window + s->w_size, s->strstart);
1836 if (s->insert > s->strstart)
1837 s->insert = s->strstart;
1839 if (have > s->strm->avail_in)
1840 have = s->strm->avail_in;
1842 read_buf(s->strm, s->window + s->strstart, have);
1843 s->strstart += have;
1844 s->insert +=
MIN(have, s->w_size - s->insert);
1846 if (s->high_water < s->strstart)
1847 s->high_water = s->strstart;
1854 have = (s->bi_valid + 42) >> 3;
1857 min_block =
MIN(have, s->w_size);
1858 left = s->strstart - s->block_start;
1859 if (left >= min_block ||
1861 s->strm->avail_in == 0 && left <= have)) {
1862 len =
MIN(left, have);
1863 last = flush ==
Z_FINISH && s->strm->avail_in == 0 &&
1864 len == left ? 1 : 0;
1866 s->block_start += len;
1899 if (s->lookahead == 0)
break;
1913 if (hash_head !=
NIL && s->strstart - hash_head <=
MAX_DIST(s)) {
1922 check_match(s, s->strstart, s->match_start, s->match_length);
1927 s->lookahead -= s->match_length;
1933 if (s->match_length <= s->max_insert_length &&
1942 }
while (--s->match_length != 0);
1947 s->strstart += s->match_length;
1948 s->match_length = 0;
1949 s->ins_h = s->window[s->strstart];
1950 UPDATE_HASH(s, s->ins_h, s->window[s->strstart + 1]);
1960 Tracevv((stderr,
"%c", s->window[s->strstart]));
2002 if (s->lookahead == 0)
break;
2015 s->prev_length = s->match_length, s->prev_match = s->match_start;
2018 if (hash_head !=
NIL && s->prev_length < s->max_lazy_match &&
2019 s->strstart - hash_head <=
MAX_DIST(s)) {
2027 if (s->match_length <= 5 && (s->strategy ==
Z_FILTERED
2030 s->strstart - s->match_start >
TOO_FAR)
2043 if (s->prev_length >=
MIN_MATCH && s->match_length <= s->prev_length) {
2044 uInt max_insert = s->strstart + s->lookahead -
MIN_MATCH;
2047 check_match(s, s->strstart - 1, s->prev_match, s->prev_length);
2057 s->lookahead -= s->prev_length - 1;
2058 s->prev_length -= 2;
2060 if (++s->strstart <= max_insert) {
2063 }
while (--s->prev_length != 0);
2064 s->match_available = 0;
2070 }
else if (s->match_available) {
2075 Tracevv((stderr,
"%c", s->window[s->strstart - 1]));
2082 if (s->strm->avail_out == 0)
return need_more;
2087 s->match_available = 1;
2093 if (s->match_available) {
2094 Tracevv((stderr,
"%c", s->window[s->strstart - 1]));
2096 s->match_available = 0;
2120 Bytef *scan, *strend;
2132 if (s->lookahead == 0)
break;
2136 s->match_length = 0;
2137 if (s->lookahead >=
MIN_MATCH && s->strstart > 0) {
2138 scan = s->window + s->strstart - 1;
2140 if (
prev == *++scan &&
prev == *++scan &&
prev == *++scan) {
2141 strend = s->window + s->strstart +
MAX_MATCH;
2143 }
while (
prev == *++scan &&
prev == *++scan &&
2144 prev == *++scan &&
prev == *++scan &&
2145 prev == *++scan &&
prev == *++scan &&
2146 prev == *++scan &&
prev == *++scan &&
2148 s->match_length =
MAX_MATCH - (uInt)(strend - scan);
2149 if (s->match_length > s->lookahead)
2150 s->match_length = s->lookahead;
2158 check_match(s, s->strstart, s->strstart - 1, s->match_length);
2162 s->lookahead -= s->match_length;
2163 s->strstart += s->match_length;
2164 s->match_length = 0;
2167 Tracevv((stderr,
"%c", s->window[s->strstart]));
2196 if (s->lookahead == 0) {
2198 if (s->lookahead == 0) {
2206 s->match_length = 0;
2207 Tracevv((stderr,
"%c", s->window[s->strstart]));
uLong ZEXPORT adler32(uLong adler, const Bytef *buf, uInt len)
unsigned long ZEXPORT crc32(unsigned long crc, const unsigned char FAR *buf, uInt len)
int ZEXPORT deflateSetHeader(z_streamp strm, gz_headerp head)
int ZEXPORT deflateInit_(z_streamp strm, int level, const char *version, int stream_size)
#define FLUSH_BLOCK_ONLY(s, last)
local block_state deflate_fast(deflate_state *s, int flush)
int ZEXPORT deflatePending(z_streamp strm, unsigned *pending, int *bits)
#define check_match(s, start, match, length)
#define UPDATE_HASH(s, h, c)
int ZEXPORT deflateCopy(z_streamp dest, z_streamp source)
int ZEXPORT deflateSetDictionary(z_streamp strm, const Bytef *dictionary, uInt dictLength)
int ZEXPORT deflateReset(z_streamp strm)
block_state compress_func OF((deflate_state *s, int flush))
#define INSERT_STRING(s, str, match_head)
local block_state deflate_huff(deflate_state *s, int flush)
local block_state deflate_stored(deflate_state *s, int flush)
int ZEXPORT deflateParams(z_streamp strm, int level, int strategy)
local void fill_window(deflate_state *s)
local void putShortMSB(deflate_state *s, uInt b)
uLong ZEXPORT deflateBound(z_streamp strm, uLong sourceLen)
const char deflate_copyright[]
local int deflateStateCheck(z_streamp strm)
local uInt longest_match(deflate_state *s, IPos cur_match)
local const config configuration_table[10]
local block_state deflate_slow(deflate_state *s, int flush)
#define FLUSH_BLOCK(s, last)
int ZEXPORT deflateTune(z_streamp strm, int good_length, int max_lazy, int nice_length, int max_chain)
int ZEXPORT deflatePrime(z_streamp strm, int bits, int value)
local void lm_init(deflate_state *s)
local unsigned read_buf(z_streamp strm, Bytef *buf, unsigned size)
int ZEXPORT deflateGetDictionary(z_streamp strm, Bytef *dictionary, uInt *dictLength)
int ZEXPORT deflateResetKeep(z_streamp strm)
int ZEXPORT deflateEnd(z_streamp strm)
local void slide_hash(deflate_state *s)
int ZEXPORT deflateInit2_(z_streamp strm, int level, int method, int windowBits, int memLevel, int strategy, const char *version, int stream_size)
local void flush_pending(z_streamp strm)
local block_state deflate_rle(deflate_state *s, int flush)
int ZEXPORT deflate(z_streamp strm, int flush)
#define _tr_tally_dist(s, distance, length, flush)
#define _tr_tally_lit(s, c, flush)
struct tree_desc_s l_desc
struct ct_data_s dyn_dtree[2 *D_CODES+1]
struct ct_data_s bl_tree[2 *BL_CODES+1]
struct tree_desc_s bl_desc
struct tree_desc_s d_desc
struct ct_data_s dyn_ltree[HEAP_SIZE]
void ZLIB_INTERNAL _tr_init(deflate_state *s)
void ZLIB_INTERNAL _tr_stored_block(deflate_state *s, charf *buf, ulg stored_len, int last)
void ZLIB_INTERNAL _tr_flush_bits(deflate_state *s)
void ZLIB_INTERNAL _tr_align(deflate_state *s)
gz_header FAR * gz_headerp
#define Z_DEFAULT_STRATEGY
#define Z_DEFAULT_COMPRESSION
void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr)
voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, unsigned items, unsigned size)
void ZLIB_INTERNAL zmemzero(Bytef *dest, uInt len)
void ZLIB_INTERNAL zmemcpy(Bytef *dest, const Bytef *source, uInt len)
int ZLIB_INTERNAL zmemcmp(Bytef *s1, const Bytef *s2, uInt len) const
#define ERR_RETURN(strm, err)
#define ZALLOC(strm, items, size)
#define Assert(cond, msg)
#define ZFREE(strm, addr)