1#ifdef DBGHELP_STATIC_LIB
37#define DEF_WBITS MAX_WBITS
39#define zmemzero(dest, len) memset(dest, 0, len)
41#define Assert(cond,msg)
49#define ZALLOC(strm, items, size) \
50 (*((strm)->zalloc))((strm)->opaque, (items), (size))
51#define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
52#define TRY_FREE(s, p) {if (p) ZFREE(s, p);}
55#define ZSWAP32(q) ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \
56 (((q) & 0xff00) << 8) + (((q) & 0xff) << 24))
62#define DO1(buf,i) {adler += (buf)[i]; sum2 += adler;}
63#define DO2(buf,i) DO1(buf,i); DO1(buf,i+1);
64#define DO4(buf,i) DO2(buf,i); DO2(buf,i+2);
65#define DO8(buf,i) DO4(buf,i); DO4(buf,i+4);
66#define DO16(buf) DO8(buf,0); DO8(buf,8);
68#define MOD(a) a %= BASE
69#define MOD28(a) a %= BASE
70#define MOD63(a) a %= BASE
78 sum2 = (adler >> 16) & 0xffff;
89 return adler | (sum2 << 16);
105 return adler | (sum2 << 16);
136 return adler | (sum2 << 16);
145#define ENOUGH_LENS 852
146#define ENOUGH_DISTS 592
147#define ENOUGH (ENOUGH_LENS+ENOUGH_DISTS)
280 unsigned char FAR *beg;
318 lcode =
state->lencode;
319 dcode =
state->distcode;
320 lmask = (1U <<
state->lenbits) - 1;
321 dmask = (1U <<
state->distbits) - 1;
332 here = lcode[
hold & lmask];
340 "inflate: literal '%c'\n" :
341 "inflate: literal 0x%02x\n", here.
val));
363 here = dcode[
hold & dmask];
383 strm->msg = (
char *)
"invalid distance too far back";
397 (
char *)
"invalid distance too far back";
401#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
488 else if ((
op & 64) == 0) {
489 here = dcode[here.
val + (
hold & ((1U <<
op) - 1))];
493 strm->msg = (
char *)
"invalid distance code";
498 else if ((
op & 64) == 0) {
499 here = lcode[here.
val + (
hold & ((1U <<
op) - 1))];
508 strm->msg = (
char *)
"invalid literal/length code";
551 const unsigned short FAR *
base;
555 unsigned short offs[
MAXBITS+1];
556 static const unsigned short lbase[31] = {
557 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
558 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
559 static const unsigned short lext[31] = {
560 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
561 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 77, 202};
562 static const unsigned short dbase[32] = {
563 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
564 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
565 8193, 12289, 16385, 24577, 0, 0};
566 static const unsigned short dext[32] = {
567 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,
568 23, 23, 24, 24, 25, 25, 26, 26, 27, 27,
569 28, 28, 29, 29, 64, 64};
605 for (sym = 0; sym <
codes; sym++)
614 here.
op = (
unsigned char)64;
631 if (
left < 0)
return -1;
642 for (sym = 0; sym <
codes; sym++)
714 here.
op = (
unsigned char)0;
722 here.
op = (
unsigned char)(32 + 64);
727 incr = 1U << (
len - drop);
736 incr = 1U << (
len - 1);
765 while (curr + drop <
max) {
767 if (
left <= 0)
break;
780 (*table)[low].op = (
unsigned char)curr;
781 (*table)[low].bits = (
unsigned char)
root;
790 here.
op = (
unsigned char)64;
828 state->dmax = 32768U;
874 if (
windowBits && (windowBits < 8 || windowBits > 15))
927 {96,7,0},{0,8,80},{0,8,16},{20,8,115},{18,7,31},{0,8,112},{0,8,48},
928 {0,9,192},{16,7,10},{0,8,96},{0,8,32},{0,9,160},{0,8,0},{0,8,128},
929 {0,8,64},{0,9,224},{16,7,6},{0,8,88},{0,8,24},{0,9,144},{19,7,59},
930 {0,8,120},{0,8,56},{0,9,208},{17,7,17},{0,8,104},{0,8,40},{0,9,176},
931 {0,8,8},{0,8,136},{0,8,72},{0,9,240},{16,7,4},{0,8,84},{0,8,20},
932 {21,8,227},{19,7,43},{0,8,116},{0,8,52},{0,9,200},{17,7,13},{0,8,100},
933 {0,8,36},{0,9,168},{0,8,4},{0,8,132},{0,8,68},{0,9,232},{16,7,8},
934 {0,8,92},{0,8,28},{0,9,152},{20,7,83},{0,8,124},{0,8,60},{0,9,216},
935 {18,7,23},{0,8,108},{0,8,44},{0,9,184},{0,8,12},{0,8,140},{0,8,76},
936 {0,9,248},{16,7,3},{0,8,82},{0,8,18},{21,8,163},{19,7,35},{0,8,114},
937 {0,8,50},{0,9,196},{17,7,11},{0,8,98},{0,8,34},{0,9,164},{0,8,2},
938 {0,8,130},{0,8,66},{0,9,228},{16,7,7},{0,8,90},{0,8,26},{0,9,148},
939 {20,7,67},{0,8,122},{0,8,58},{0,9,212},{18,7,19},{0,8,106},{0,8,42},
940 {0,9,180},{0,8,10},{0,8,138},{0,8,74},{0,9,244},{16,7,5},{0,8,86},
941 {0,8,22},{64,8,0},{19,7,51},{0,8,118},{0,8,54},{0,9,204},{17,7,15},
942 {0,8,102},{0,8,38},{0,9,172},{0,8,6},{0,8,134},{0,8,70},{0,9,236},
943 {16,7,9},{0,8,94},{0,8,30},{0,9,156},{20,7,99},{0,8,126},{0,8,62},
944 {0,9,220},{18,7,27},{0,8,110},{0,8,46},{0,9,188},{0,8,14},{0,8,142},
945 {0,8,78},{0,9,252},{96,7,0},{0,8,81},{0,8,17},{21,8,131},{18,7,31},
946 {0,8,113},{0,8,49},{0,9,194},{16,7,10},{0,8,97},{0,8,33},{0,9,162},
947 {0,8,1},{0,8,129},{0,8,65},{0,9,226},{16,7,6},{0,8,89},{0,8,25},
948 {0,9,146},{19,7,59},{0,8,121},{0,8,57},{0,9,210},{17,7,17},{0,8,105},
949 {0,8,41},{0,9,178},{0,8,9},{0,8,137},{0,8,73},{0,9,242},{16,7,4},
950 {0,8,85},{0,8,21},{16,8,258},{19,7,43},{0,8,117},{0,8,53},{0,9,202},
951 {17,7,13},{0,8,101},{0,8,37},{0,9,170},{0,8,5},{0,8,133},{0,8,69},
952 {0,9,234},{16,7,8},{0,8,93},{0,8,29},{0,9,154},{20,7,83},{0,8,125},
953 {0,8,61},{0,9,218},{18,7,23},{0,8,109},{0,8,45},{0,9,186},{0,8,13},
954 {0,8,141},{0,8,77},{0,9,250},{16,7,3},{0,8,83},{0,8,19},{21,8,195},
955 {19,7,35},{0,8,115},{0,8,51},{0,9,198},{17,7,11},{0,8,99},{0,8,35},
956 {0,9,166},{0,8,3},{0,8,131},{0,8,67},{0,9,230},{16,7,7},{0,8,91},
957 {0,8,27},{0,9,150},{20,7,67},{0,8,123},{0,8,59},{0,9,214},{18,7,19},
958 {0,8,107},{0,8,43},{0,9,182},{0,8,11},{0,8,139},{0,8,75},{0,9,246},
959 {16,7,5},{0,8,87},{0,8,23},{64,8,0},{19,7,51},{0,8,119},{0,8,55},
960 {0,9,206},{17,7,15},{0,8,103},{0,8,39},{0,9,174},{0,8,7},{0,8,135},
961 {0,8,71},{0,9,238},{16,7,9},{0,8,95},{0,8,31},{0,9,158},{20,7,99},
962 {0,8,127},{0,8,63},{0,9,222},{18,7,27},{0,8,111},{0,8,47},{0,9,190},
963 {0,8,15},{0,8,143},{0,8,79},{0,9,254},{96,7,0},{0,8,80},{0,8,16},
964 {20,8,115},{18,7,31},{0,8,112},{0,8,48},{0,9,193},{16,7,10},{0,8,96},
965 {0,8,32},{0,9,161},{0,8,0},{0,8,128},{0,8,64},{0,9,225},{16,7,6},
966 {0,8,88},{0,8,24},{0,9,145},{19,7,59},{0,8,120},{0,8,56},{0,9,209},
967 {17,7,17},{0,8,104},{0,8,40},{0,9,177},{0,8,8},{0,8,136},{0,8,72},
968 {0,9,241},{16,7,4},{0,8,84},{0,8,20},{21,8,227},{19,7,43},{0,8,116},
969 {0,8,52},{0,9,201},{17,7,13},{0,8,100},{0,8,36},{0,9,169},{0,8,4},
970 {0,8,132},{0,8,68},{0,9,233},{16,7,8},{0,8,92},{0,8,28},{0,9,153},
971 {20,7,83},{0,8,124},{0,8,60},{0,9,217},{18,7,23},{0,8,108},{0,8,44},
972 {0,9,185},{0,8,12},{0,8,140},{0,8,76},{0,9,249},{16,7,3},{0,8,82},
973 {0,8,18},{21,8,163},{19,7,35},{0,8,114},{0,8,50},{0,9,197},{17,7,11},
974 {0,8,98},{0,8,34},{0,9,165},{0,8,2},{0,8,130},{0,8,66},{0,9,229},
975 {16,7,7},{0,8,90},{0,8,26},{0,9,149},{20,7,67},{0,8,122},{0,8,58},
976 {0,9,213},{18,7,19},{0,8,106},{0,8,42},{0,9,181},{0,8,10},{0,8,138},
977 {0,8,74},{0,9,245},{16,7,5},{0,8,86},{0,8,22},{64,8,0},{19,7,51},
978 {0,8,118},{0,8,54},{0,9,205},{17,7,15},{0,8,102},{0,8,38},{0,9,173},
979 {0,8,6},{0,8,134},{0,8,70},{0,9,237},{16,7,9},{0,8,94},{0,8,30},
980 {0,9,157},{20,7,99},{0,8,126},{0,8,62},{0,9,221},{18,7,27},{0,8,110},
981 {0,8,46},{0,9,189},{0,8,14},{0,8,142},{0,8,78},{0,9,253},{96,7,0},
982 {0,8,81},{0,8,17},{21,8,131},{18,7,31},{0,8,113},{0,8,49},{0,9,195},
983 {16,7,10},{0,8,97},{0,8,33},{0,9,163},{0,8,1},{0,8,129},{0,8,65},
984 {0,9,227},{16,7,6},{0,8,89},{0,8,25},{0,9,147},{19,7,59},{0,8,121},
985 {0,8,57},{0,9,211},{17,7,17},{0,8,105},{0,8,41},{0,9,179},{0,8,9},
986 {0,8,137},{0,8,73},{0,9,243},{16,7,4},{0,8,85},{0,8,21},{16,8,258},
987 {19,7,43},{0,8,117},{0,8,53},{0,9,203},{17,7,13},{0,8,101},{0,8,37},
988 {0,9,171},{0,8,5},{0,8,133},{0,8,69},{0,9,235},{16,7,8},{0,8,93},
989 {0,8,29},{0,9,155},{20,7,83},{0,8,125},{0,8,61},{0,9,219},{18,7,23},
990 {0,8,109},{0,8,45},{0,9,187},{0,8,13},{0,8,141},{0,8,77},{0,9,251},
991 {16,7,3},{0,8,83},{0,8,19},{21,8,195},{19,7,35},{0,8,115},{0,8,51},
992 {0,9,199},{17,7,11},{0,8,99},{0,8,35},{0,9,167},{0,8,3},{0,8,131},
993 {0,8,67},{0,9,231},{16,7,7},{0,8,91},{0,8,27},{0,9,151},{20,7,67},
994 {0,8,123},{0,8,59},{0,9,215},{18,7,19},{0,8,107},{0,8,43},{0,9,183},
995 {0,8,11},{0,8,139},{0,8,75},{0,9,247},{16,7,5},{0,8,87},{0,8,23},
996 {64,8,0},{19,7,51},{0,8,119},{0,8,55},{0,9,207},{17,7,15},{0,8,103},
997 {0,8,39},{0,9,175},{0,8,7},{0,8,135},{0,8,71},{0,9,239},{16,7,9},
998 {0,8,95},{0,8,31},{0,9,159},{20,7,99},{0,8,127},{0,8,63},{0,9,223},
999 {18,7,27},{0,8,111},{0,8,47},{0,9,191},{0,8,15},{0,8,143},{0,8,79},
1004 {16,5,1},{23,5,257},{19,5,17},{27,5,4097},{17,5,5},{25,5,1025},
1005 {21,5,65},{29,5,16385},{16,5,3},{24,5,513},{20,5,33},{28,5,8193},
1006 {18,5,9},{26,5,2049},{22,5,129},{64,5,0},{16,5,2},{23,5,385},
1007 {19,5,25},{27,5,6145},{17,5,7},{25,5,1537},{21,5,97},{29,5,24577},
1008 {16,5,4},{24,5,769},{20,5,49},{28,5,12289},{18,5,13},{26,5,3073},
1015 state->distbits = 5;
1041 state->window = (
unsigned char FAR *)
1043 sizeof(
unsigned char));
1048 if (
state->wsize == 0) {
1071 state->wnext += dist;
1081#define crc32(crc,buf,len) RtlComputeCrc32(crc,buf,len)
1085# define UPDATE(check, buf, len) \
1086 (state->flags ? crc32(check, buf, len) : adler32(check, buf, len))
1088# define UPDATE(check, buf, len) adler32(check, buf, len)
1093# define CRC2(check, word) \
1095 hbuf[0] = (unsigned char)(word); \
1096 hbuf[1] = (unsigned char)((word) >> 8); \
1097 check = crc32(check, hbuf, 2); \
1100# define CRC4(check, word) \
1102 hbuf[0] = (unsigned char)(word); \
1103 hbuf[1] = (unsigned char)((word) >> 8); \
1104 hbuf[2] = (unsigned char)((word) >> 16); \
1105 hbuf[3] = (unsigned char)((word) >> 24); \
1106 check = crc32(check, hbuf, 4); \
1113 put = strm->next_out; \
1114 left = strm->avail_out; \
1115 next = strm->next_in; \
1116 have = strm->avail_in; \
1117 hold = state->hold; \
1118 bits = state->bits; \
1124 strm->next_out = put; \
1125 strm->avail_out = left; \
1126 strm->next_in = next; \
1127 strm->avail_in = have; \
1128 state->hold = hold; \
1129 state->bits = bits; \
1143 if (have == 0) goto inf_leave; \
1145 hold += (unsigned long)(*next++) << bits; \
1151#define NEEDBITS(n) \
1153 while (bits < (unsigned)(n)) \
1159 ((unsigned)hold & ((1U << (n)) - 1))
1162#define DROPBITS(n) \
1165 bits -= (unsigned)(n); \
1171 hold >>= bits & 7; \
1273 unsigned char hbuf[4];
1275 static const unsigned short order[19] =
1276 {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
1289 switch (
state->mode) {
1291 if (
state->wrap == 0) {
1297 if ((
state->wrap & 2) &&
hold == 0x8b1f) {
1298 if (
state->wbits == 0)
1308 state->head->done = -1;
1309 if (!(
state->wrap & 1) ||
1313 ((
BITS(8) << 8) + (
hold >> 8)) % 31) {
1314 strm->msg = (
char *)
"incorrect header check";
1319 strm->msg = (
char *)
"unknown compression method";
1325 if (
state->wbits == 0)
1328 strm->msg = (
char *)
"invalid window size";
1343 strm->msg = (
char *)
"unknown compression method";
1347 if (
state->flags & 0xe000) {
1348 strm->msg = (
char *)
"unknown header flags set";
1354 if ((
state->flags & 0x0200) && (
state->wrap & 4))
1362 if ((
state->flags & 0x0200) && (
state->wrap & 4))
1372 if ((
state->flags & 0x0200) && (
state->wrap & 4))
1377 if (
state->flags & 0x0400) {
1382 if ((
state->flags & 0x0200) && (
state->wrap & 4))
1390 if (
state->flags & 0x0400) {
1401 if ((
state->flags & 0x0200) && (
state->wrap & 4))
1407 if (
state->length)
goto inf_leave;
1412 if (
state->flags & 0x0800) {
1413 if (
have == 0)
goto inf_leave;
1422 if ((
state->flags & 0x0200) && (
state->wrap & 4))
1426 if (
len)
goto inf_leave;
1433 if (
state->flags & 0x1000) {
1434 if (
have == 0)
goto inf_leave;
1443 if ((
state->flags & 0x0200) && (
state->wrap & 4))
1447 if (
len)
goto inf_leave;
1453 if (
state->flags & 0x0200) {
1456 strm->msg = (
char *)
"header crc mismatch";
1464 state->head->done = 1;
1476 if (
state->havedict == 0) {
1496 state->last ?
" (last)" :
""));
1502 state->last ?
" (last)" :
""));
1511 state->last ?
" (last)" :
""));
1515 strm->msg = (
char *)
"invalid block type";
1523 if ((
hold & 0xffff) != ((
hold >> 16) ^ 0xffff)) {
1524 strm->msg = (
char *)
"invalid stored block lengths";
1541 if (
copy == 0)
goto inf_leave;
1561#ifndef PKZIP_BUG_WORKAROUND
1562 if (
state->nlen > 286 ||
state->ndist > 30) {
1563 strm->msg = (
char *)
"too many length or distance symbols";
1577 while (
state->have < 19)
1585 strm->msg = (
char *)
"invalid code lengths set";
1596 if ((
unsigned)(here.
bits) <=
bits)
break;
1599 if (here.
val < 16) {
1604 if (here.
val == 16) {
1607 if (
state->have == 0) {
1608 strm->msg = (
char *)
"invalid bit length repeat";
1616 else if (here.
val == 17) {
1631 strm->msg = (
char *)
"invalid bit length repeat";
1644 if (
state->lens[256] == 0) {
1645 strm->msg = (
char *)
"invalid code -- missing end-of-block";
1659 strm->msg = (
char *)
"invalid literal/lengths set";
1664 state->distbits = 6;
1668 strm->msg = (
char *)
"invalid distances set";
1689 if ((
unsigned)(here.
bits) <=
bits)
break;
1692 if (here.
op && (here.
op & 0xf0) == 0) {
1706 if ((
int)(here.
op) == 0) {
1708 "inflate: literal '%c'\n" :
1709 "inflate: literal 0x%02x\n", here.
val));
1720 strm->msg = (
char *)
"invalid literal/length code";
1739 if ((
unsigned)(here.
bits) <=
bits)
break;
1742 if ((here.
op & 0xf0) == 0) {
1756 strm->msg = (
char *)
"invalid distance code";
1761 state->extra = (
unsigned)(here.
op) & 15;
1770#ifdef INFLATE_STRICT
1772 strm->msg = (
char *)
"invalid distance too far back";
1780 if (
left == 0)
goto inf_leave;
1786 strm->msg = (
char *)
"invalid distance too far back";
1790#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
1825 if (
left == 0)
goto inf_leave;
1840 if ((
state->wrap & 4) && (
1845 strm->msg = (
char *)
"incorrect data check";
1857 if (
hold != (
state->total & 0xffffffffUL)) {
1858 strm->msg = (
char *)
"incorrect length check";
_STLP_MOVE_TO_STD_NAMESPACE void fill(_ForwardIter __first, _ForwardIter __last, const _Tp &__val)
INT copy(TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], INT append, DWORD lpdwFlags, BOOL bTouch)
#define crc32(crc, buf, len)
#define CRC2(check, word)
static int inflateReset2(z_streamp strm, int windowBits)
static int inflate_table(codetype type, unsigned short FAR *lens, unsigned codes, code FAR *FAR *table, unsigned FAR *bits, unsigned short FAR *work)
#define ZALLOC(strm, items, size)
static int inflateReset(z_streamp strm)
static int inflateResetKeep(z_streamp strm)
#define CRC4(check, word)
static void inflate_fast(z_streamp strm, unsigned start)
#define UPDATE(check, buf, len)
static int inflateStateCheck(z_streamp strm)
static void fixedtables(struct inflate_state FAR *state)
#define ZFREE(strm, addr)
int inflate(z_streamp strm, int flush)
static uLong adler32(uLong adler, const Bytef *buf, uInt len)
int inflateEnd(z_streamp strm)
static int updatewindow(z_streamp strm, const Bytef *end, unsigned copy)
void(* free_func)(voidpf opaque, voidpf address)
gz_header FAR * gz_headerp
voidpf(* alloc_func)(voidpf opaque, uInt items, uInt size)
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
#define wrap(journal, var)
GLuint GLuint GLsizei GLenum type
GLuint GLuint GLsizei count
GLenum GLuint GLenum GLsizei const GLchar * buf
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
GLuint GLdouble GLdouble GLint GLint order
static IHTMLWindow2 * window
static unsigned(__cdecl *hash_bstr)(bstr_t s)
static unsigned __int64 next
#define inflateInit2(strm, windowBits)
#define inflateInit(strm)
unsigned char FAR * window
code const FAR * distcode
static const code distfix[32]
static const code lenfix[512]