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);
293 windowBits < 8 || windowBits > 15 || level < 0 || level > 9 ||
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;
321 s->lit_bufsize = 1 << (memLevel + 6);
363 s->pending_buf_size = (
ulg)
s->lit_bufsize * 4;
372 s->sym_buf =
s->pending_buf +
s->lit_bufsize;
373 s->sym_end = (
s->lit_bufsize - 1) * 3;
436 if (dictLength >=
s->w_size) {
444 dictLength =
s->w_size;
450 strm->avail_in = dictLength;
459 s->prev[
str &
s->w_mask] =
s->head[
s->ins_h];
468 s->strstart +=
s->lookahead;
469 s->block_start = (
long)
s->strstart;
470 s->insert =
s->lookahead;
473 s->match_available = 0;
492 len =
s->strstart +
s->lookahead;
512 strm->total_in =
strm->total_out = 0;
518 s->pending_out =
s->pending_buf;
588 if (bits < 0 || bits > 16 ||
589 s->sym_buf <
s->pending_out + ((
Buf_size + 7) >> 3))
595 s->bi_buf |= (
ush)((
value & ((1 <<
put) - 1)) <<
s->bi_valid);
621 if (level < 0 || level > 9 || strategy < 0 || strategy >
Z_FIXED) {
627 s->last_flush != -2) {
632 if (
strm->avail_in || (
s->strstart -
s->block_start) +
s->lookahead)
636 if (
s->level == 0 &&
s->matches != 0) {
665 s->good_match = (
uInt)good_length;
666 s->max_lazy_match = (
uInt)max_lazy;
667 s->nice_match = nice_length;
668 s->max_chain_length = (
uInt)max_chain;
701 uLong fixedlen, storelen, wraplen;
706 fixedlen = sourceLen + (sourceLen >> 3) + (sourceLen >> 8) +
707 (sourceLen >> 9) + 4;
711 storelen = sourceLen + (sourceLen >> 5) + (sourceLen >> 7) +
712 (sourceLen >> 11) + 7;
716 return (fixedlen > storelen ? fixedlen : storelen) + 6;
725 wraplen = 6 + (
s->strstart ? 4 : 0);
732 if (
s->gzhead->extra !=
Z_NULL)
733 wraplen += 2 +
s->gzhead->extra_len;
734 str =
s->gzhead->name;
739 str =
s->gzhead->comment;
754 if (
s->w_bits != 15 ||
s->hash_bits != 8 + 7)
755 return (
s->w_bits <=
s->hash_bits ? fixedlen : storelen) + wraplen;
759 return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
760 (sourceLen >> 25) + 13 - 6 + wraplen;
791 if (
len == 0)
return;
795 s->pending_out +=
len;
799 if (
s->pending == 0) {
800 s->pending_out =
s->pending_buf;
807#define HCRC_UPDATE(beg) \
809 if (s->gzhead->hcrc && s->pending > (beg)) \
810 strm->adler = crc32(strm->adler, s->pending_buf + (beg), \
811 s->pending - (beg)); \
834 old_flush =
s->last_flush;
838 if (
s->pending != 0) {
840 if (
strm->avail_out == 0) {
875 else if (
s->level < 6)
877 else if (
s->level == 6)
881 header |= (level_flags << 6);
888 if (
s->strstart != 0) {
897 if (
s->pending != 0) {
923 if (
s->pending != 0) {
930 (
s->gzhead->hcrc ? 2 : 0) +
931 (
s->gzhead->extra ==
Z_NULL ? 0 : 4) +
932 (
s->gzhead->name ==
Z_NULL ? 0 : 8) +
933 (
s->gzhead->comment ==
Z_NULL ? 0 : 16)
943 if (
s->gzhead->extra !=
Z_NULL) {
945 put_byte(
s, (
s->gzhead->extra_len >> 8) & 0xff);
955 if (
s->gzhead->extra !=
Z_NULL) {
956 ulg beg =
s->pending;
957 uInt left = (
s->gzhead->extra_len & 0xffff) -
s->gzindex;
961 s->gzhead->extra +
s->gzindex,
copy);
962 s->pending =
s->pending_buf_size;
966 if (
s->pending != 0) {
974 s->gzhead->extra +
s->gzindex,
left);
982 if (
s->gzhead->name !=
Z_NULL) {
983 ulg beg =
s->pending;
986 if (
s->pending ==
s->pending_buf_size) {
989 if (
s->pending != 0) {
1004 if (
s->gzhead->comment !=
Z_NULL) {
1005 ulg beg =
s->pending;
1008 if (
s->pending ==
s->pending_buf_size) {
1011 if (
s->pending != 0) {
1017 val =
s->gzhead->comment[
s->gzindex++];
1025 if (
s->gzhead->hcrc) {
1026 if (
s->pending + 2 >
s->pending_buf_size) {
1028 if (
s->pending != 0) {
1041 if (
s->pending != 0) {
1050 if (
strm->avail_in != 0 ||
s->lookahead != 0 ||
1063 if (
strm->avail_out == 0) {
1085 if (
s->lookahead == 0) {
1087 s->block_start = 0
L;
1093 if (
strm->avail_out == 0) {
1125 if (
s->wrap > 0)
s->wrap = -
s->wrap;
1197 ds->pending_out =
ds->pending_buf + (
ss->pending_out -
ss->pending_buf);
1198 ds->sym_buf =
ds->pending_buf +
ds->lit_bufsize;
1200 ds->l_desc.dyn_tree =
ds->dyn_ltree;
1201 ds->d_desc.dyn_tree =
ds->dyn_dtree;
1202 ds->bl_desc.dyn_tree =
ds->bl_tree;
1220 unsigned len =
strm->avail_in;
1223 if (
len == 0)
return 0;
1228 if (
strm->state->wrap == 1) {
1232 else if (
strm->state->wrap == 2) {
1248 s->window_size = (
ulg)2L*
s->w_size;
1260 s->block_start = 0
L;
1264 s->match_available = 0;
1282 unsigned chain_length =
s->max_chain_length;
1283 register Bytef *scan =
s->window +
s->strstart;
1286 int best_len = (
int)
s->prev_length;
1294 uInt wmask =
s->w_mask;
1301 register ush scan_start = *(
ushf*)scan;
1302 register ush scan_end = *(
ushf*)(scan + best_len - 1);
1305 register Byte scan_end1 = scan[best_len - 1];
1306 register Byte scan_end = scan[best_len];
1315 if (
s->prev_length >=
s->good_match) {
1328 match =
s->window + cur_match;
1338#if (defined(UNALIGNED_OK) && MAX_MATCH == 258)
1342 if (*(
ushf*)(
match + best_len - 1) != scan_end ||
1367 if (*scan == *
match) scan++;
1374 if (
match[best_len] != scan_end ||
1375 match[best_len - 1] != scan_end1 ||
1377 *++
match != scan[1])
continue;
1392 }
while (*++scan == *++
match && *++scan == *++
match &&
1393 *++scan == *++
match && *++scan == *++
match &&
1394 *++scan == *++
match && *++scan == *++
match &&
1395 *++scan == *++
match && *++scan == *++
match &&
1406 if (
len > best_len) {
1407 s->match_start = cur_match;
1411 scan_end = *(
ushf*)(scan + best_len - 1);
1413 scan_end1 = scan[best_len - 1];
1414 scan_end = scan[best_len];
1417 }
while ((cur_match =
prev[cur_match & wmask]) >
limit
1418 && --chain_length != 0);
1420 if ((
uInt)best_len <=
s->lookahead)
return (
uInt)best_len;
1421 return s->lookahead;
1433 register Bytef *scan =
s->window +
s->strstart;
1448 match =
s->window + cur_match;
1460 scan += 2,
match += 2;
1467 }
while (*++scan == *++
match && *++scan == *++
match &&
1468 *++scan == *++
match && *++scan == *++
match &&
1469 *++scan == *++
match && *++scan == *++
match &&
1470 *++scan == *++
match && *++scan == *++
match &&
1473 Assert(scan <= s->
window + (
unsigned)(
s->window_size - 1),
"wild scan");
1479 s->match_start = cur_match;
1506 z_error(
"invalid match");
1508 if (z_verbose > 1) {
1514# define check_match(s, start, match, length)
1532 uInt wsize =
s->w_size;
1540 if (
sizeof(
int) <= 2) {
1541 if (more == 0 &&
s->strstart == 0 &&
s->lookahead == 0) {
1544 }
else if (more == (
unsigned)(-1)) {
1557 zmemcpy(
s->window,
s->window + wsize, (
unsigned)wsize - more);
1558 s->match_start -= wsize;
1559 s->strstart -= wsize;
1560 s->block_start -= (
long) wsize;
1561 if (
s->insert >
s->strstart)
1562 s->insert =
s->strstart;
1566 if (
s->strm->avail_in == 0)
break;
1579 Assert(more >= 2,
"more < 2");
1581 n =
read_buf(
s->strm,
s->window +
s->strstart +
s->lookahead, more);
1587 s->ins_h =
s->window[
str];
1595 s->prev[
str &
s->w_mask] =
s->head[
s->ins_h];
1617 if (
s->high_water <
s->window_size) {
1618 ulg curr =
s->strstart + (
ulg)(
s->lookahead);
1621 if (
s->high_water < curr) {
1625 init =
s->window_size - curr;
1629 s->high_water = curr +
init;
1637 if (
init >
s->window_size -
s->high_water)
1638 init =
s->window_size -
s->high_water;
1640 s->high_water +=
init;
1645 "not enough room for search");
1652#define FLUSH_BLOCK_ONLY(s, last) { \
1653 _tr_flush_block(s, (s->block_start >= 0L ? \
1654 (charf *)&s->window[(unsigned)s->block_start] : \
1656 (ulg)((long)s->strstart - s->block_start), \
1658 s->block_start = s->strstart; \
1659 flush_pending(s->strm); \
1660 Tracev((stderr,"[FLUSH]")); \
1664#define FLUSH_BLOCK(s, last) { \
1665 FLUSH_BLOCK_ONLY(s, last); \
1666 if (s->strm->avail_out == 0) return (last) ? finish_started : need_more; \
1670#define MAX_STORED 65535
1673#define MIN(a, b) ((a) > (b) ? (b) : (a))
1698 unsigned min_block =
MIN(
s->pending_buf_size - 5,
s->w_size);
1705 unsigned used =
s->strm->avail_in;
1712 have = (
s->bi_valid + 42) >> 3;
1713 if (
s->strm->avail_out < have)
1716 have =
s->strm->avail_out - have;
1717 left =
s->strstart -
s->block_start;
1740 s->pending_buf[
s->pending - 4] =
len;
1741 s->pending_buf[
s->pending - 3] =
len >> 8;
1742 s->pending_buf[
s->pending - 2] =
~len;
1743 s->pending_buf[
s->pending - 1] =
~len >> 8;
1750 s->compressed_len +=
len << 3;
1751 s->bits_sent +=
len << 3;
1759 s->strm->next_out +=
left;
1760 s->strm->avail_out -=
left;
1761 s->strm->total_out +=
left;
1762 s->block_start +=
left;
1771 s->strm->next_out +=
len;
1772 s->strm->avail_out -=
len;
1773 s->strm->total_out +=
len;
1775 }
while (
last == 0);
1783 used -=
s->strm->avail_in;
1788 if (
used >=
s->w_size) {
1790 zmemcpy(
s->window,
s->strm->next_in -
s->w_size,
s->w_size);
1791 s->strstart =
s->w_size;
1792 s->insert =
s->strstart;
1795 if (
s->window_size -
s->strstart <=
used) {
1797 s->strstart -=
s->w_size;
1798 zmemcpy(
s->window,
s->window +
s->w_size,
s->strstart);
1801 if (
s->insert >
s->strstart)
1802 s->insert =
s->strstart;
1805 s->strstart +=
used;
1806 s->insert +=
MIN(
used,
s->w_size -
s->insert);
1808 s->block_start =
s->strstart;
1810 if (
s->high_water <
s->strstart)
1811 s->high_water =
s->strstart;
1819 s->strm->avail_in == 0 && (
long)
s->strstart ==
s->block_start)
1823 have =
s->window_size -
s->strstart;
1824 if (
s->strm->avail_in > have &&
s->block_start >= (
long)
s->w_size) {
1826 s->block_start -=
s->w_size;
1827 s->strstart -=
s->w_size;
1828 zmemcpy(
s->window,
s->window +
s->w_size,
s->strstart);
1832 if (
s->insert >
s->strstart)
1833 s->insert =
s->strstart;
1835 if (have >
s->strm->avail_in)
1836 have =
s->strm->avail_in;
1839 s->strstart += have;
1840 s->insert +=
MIN(have,
s->w_size -
s->insert);
1842 if (
s->high_water <
s->strstart)
1843 s->high_water =
s->strstart;
1850 have = (
s->bi_valid + 42) >> 3;
1853 min_block =
MIN(have,
s->w_size);
1854 left =
s->strstart -
s->block_start;
1855 if (
left >= min_block ||
1857 s->strm->avail_in == 0 &&
left <= have)) {
1862 s->block_start +=
len;
1895 if (
s->lookahead == 0)
break;
1909 if (hash_head !=
NIL &&
s->strstart - hash_head <=
MAX_DIST(
s)) {
1923 s->lookahead -=
s->match_length;
1929 if (
s->match_length <=
s->max_insert_length &&
1938 }
while (--
s->match_length != 0);
1943 s->strstart +=
s->match_length;
1944 s->match_length = 0;
1945 s->ins_h =
s->window[
s->strstart];
1998 if (
s->lookahead == 0)
break;
2011 s->prev_length =
s->match_length,
s->prev_match =
s->match_start;
2014 if (hash_head !=
NIL &&
s->prev_length <
s->max_lazy_match &&
2039 if (
s->prev_length >=
MIN_MATCH &&
s->match_length <=
s->prev_length) {
2053 s->lookahead -=
s->prev_length - 1;
2054 s->prev_length -= 2;
2056 if (++
s->strstart <= max_insert) {
2059 }
while (--
s->prev_length != 0);
2060 s->match_available = 0;
2066 }
else if (
s->match_available) {
2078 if (
s->strm->avail_out == 0)
return need_more;
2083 s->match_available = 1;
2089 if (
s->match_available) {
2092 s->match_available = 0;
2116 Bytef *scan, *strend;
2128 if (
s->lookahead == 0)
break;
2132 s->match_length = 0;
2133 if (
s->lookahead >=
MIN_MATCH &&
s->strstart > 0) {
2134 scan =
s->window +
s->strstart - 1;
2136 if (
prev == *++scan &&
prev == *++scan &&
prev == *++scan) {
2139 }
while (
prev == *++scan &&
prev == *++scan &&
2140 prev == *++scan &&
prev == *++scan &&
2141 prev == *++scan &&
prev == *++scan &&
2142 prev == *++scan &&
prev == *++scan &&
2145 if (
s->match_length >
s->lookahead)
2146 s->match_length =
s->lookahead;
2158 s->lookahead -=
s->match_length;
2159 s->strstart +=
s->match_length;
2160 s->match_length = 0;
2192 if (
s->lookahead == 0) {
2194 if (
s->lookahead == 0) {
2202 s->match_length = 0;
struct outqueuenode * head
INT copy(TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], INT append, DWORD lpdwFlags, BOOL bTouch)
while(CdLookupNextInitialFileDirent(IrpContext, Fcb, FileContext))
const config configuration_table[10]
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)
int ZEXPORT deflatePending(z_streamp strm, unsigned *pending, int *bits)
block_state deflate_stored(deflate_state *s, int flush)
#define check_match(s, start, match, length)
void putShortMSB(deflate_state *s, uInt b)
#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)
void flush_pending(z_streamp strm)
int ZEXPORT deflateReset(z_streamp strm)
block_state compress_func OF((deflate_state *s, int flush))
#define INSERT_STRING(s, str, match_head)
int ZEXPORT deflateParams(z_streamp strm, int level, int strategy)
uLong ZEXPORT deflateBound(z_streamp strm, uLong sourceLen)
const char deflate_copyright[]
block_state deflate_fast(deflate_state *s, int flush)
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)
uInt longest_match(deflate_state *s, IPos cur_match)
int ZEXPORT deflatePrime(z_streamp strm, int bits, int value)
int ZEXPORT deflateGetDictionary(z_streamp strm, Bytef *dictionary, uInt *dictLength)
block_state deflate_huff(deflate_state *s, int flush)
int deflateStateCheck(z_streamp strm)
int ZEXPORT deflateResetKeep(z_streamp strm)
int ZEXPORT deflateEnd(z_streamp strm)
void fill_window(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)
void lm_init(deflate_state *s)
int ZEXPORT deflate(z_streamp strm, int flush)
void slide_hash(deflate_state *s)
block_state deflate_rle(deflate_state *s, int flush)
#define _tr_tally_dist(s, distance, length, flush)
#define _tr_tally_lit(s, c, flush)
#define crc32(crc, buf, len)
#define zmemzero(dest, len)
#define ZALLOC(strm, items, size)
#define Assert(cond, msg)
#define ZFREE(strm, addr)
static uLong adler32(uLong adler, const Bytef *buf, uInt len)
void(* free_func)(voidpf opaque, voidpf address)
gz_header FAR * gz_headerp
voidpf(* alloc_func)(voidpf opaque, uInt items, uInt size)
#define Z_DEFAULT_STRATEGY
#define Z_DEFAULT_COMPRESSION
static const WCHAR version[]
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
#define wrap(journal, var)
int zmemcmp(Bytef *s1, const Bytef *s2, uInt len) const
void zcfree(voidpf opaque, voidpf ptr)
voidpf zcalloc(voidpf opaque, unsigned items, unsigned size)
#define ERR_RETURN(strm, err)
GLboolean GLboolean GLboolean b
GLenum GLuint GLenum GLsizei const GLchar * buf
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
GLuint GLsizei GLsizei * length
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
_Check_return_opt_ _CRTIMP int __cdecl putc(_In_ int _Ch, _Inout_ FILE *_File)
static const struct encodedFiletime times[]
static IHTMLWindow2 * window
static unsigned(__cdecl *hash_bstr)(bstr_t s)
static unsigned __int64 next
int const char int stream_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)