628{
642#ifdef GUNZIP
643 unsigned char hbuf[4];
644#endif
645 static const unsigned short order[19] =
646 {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
647
651
658 for (;;)
659 switch (
state->mode) {
661 if (
state->wrap == 0) {
663 break;
664 }
666#ifdef GUNZIP
667 if ((
state->wrap & 2) &&
hold == 0x8b1f) {
668 if (
state->wbits == 0)
674 break;
675 }
677 state->head->done = -1;
678 if (!(
state->wrap & 1) ||
679#else
681#endif
682 ((
BITS(8) << 8) + (
hold >> 8)) % 31) {
683 strm->msg = (
char *)
"incorrect header check";
685 break;
686 }
688 strm->msg = (
char *)
"unknown compression method";
690 break;
691 }
694 if (
state->wbits == 0)
697 strm->msg = (
char *)
"invalid window size";
699 break;
700 }
707 break;
708#ifdef GUNZIP
713 strm->msg = (
char *)
"unknown compression method";
715 break;
716 }
717 if (
state->flags & 0xe000) {
718 strm->msg = (
char *)
"unknown header flags set";
720 break;
721 }
724 if ((
state->flags & 0x0200) && (
state->wrap & 4))
728
733 if ((
state->flags & 0x0200) && (
state->wrap & 4))
737
743 }
744 if ((
state->flags & 0x0200) && (
state->wrap & 4))
748
750 if (
state->flags & 0x0400) {
755 if ((
state->flags & 0x0200) && (
state->wrap & 4))
758 }
762
764 if (
state->flags & 0x0400) {
771 state->head->extra_max) {
775 }
776 if ((
state->flags & 0x0200) && (
state->wrap & 4))
781 }
782 if (
state->length)
goto inf_leave;
783 }
786
788 if (
state->flags & 0x0800) {
789 if (
have == 0)
goto inf_leave;
791 do {
798 if ((
state->flags & 0x0200) && (
state->wrap & 4))
802 if (
len)
goto inf_leave;
803 }
808
810 if (
state->flags & 0x1000) {
811 if (
have == 0)
goto inf_leave;
813 do {
820 if ((
state->flags & 0x0200) && (
state->wrap & 4))
824 if (
len)
goto inf_leave;
825 }
829
831 if (
state->flags & 0x0200) {
834 strm->msg = (
char *)
"header crc mismatch";
836 break;
837 }
839 }
842 state->head->done = 1;
843 }
846 break;
847#endif
853
855 if (
state->havedict == 0) {
858 }
861
864
869 break;
870 }
875 case 0:
877 state->last ?
" (last)" :
""));
879 break;
880 case 1:
883 state->last ?
" (last)" :
""));
887 goto inf_leave;
888 }
889 break;
890 case 2:
892 state->last ?
" (last)" :
""));
894 break;
895 case 3:
896 strm->msg = (
char *)
"invalid block type";
898 }
900 break;
904 if ((
hold & 0xffff) != ((
hold >> 16) ^ 0xffff)) {
905 strm->msg = (
char *)
"invalid stored block lengths";
907 break;
908 }
914 if (flush ==
Z_TREES)
goto inf_leave;
915
918
924 if (
copy == 0)
goto inf_leave;
931 break;
932 }
935 break;
944#ifndef PKZIP_BUG_WORKAROUND
946 strm->msg = (
char *)
"too many length or distance symbols";
948 break;
949 }
950#endif
954
960 }
961 while (
state->have < 19)
969 strm->msg = (
char *)
"invalid code lengths set";
971 break;
972 }
976
979 for (;;) {
981 if ((
unsigned)(here.
bits) <=
bits)
break;
983 }
987 }
988 else {
989 if (here.
val == 16) {
992 if (
state->have == 0) {
993 strm->msg = (
char *)
"invalid bit length repeat";
995 break;
996 }
1000 }
1001 else if (here.
val == 17) {
1007 }
1008 else {
1014 }
1016 strm->msg = (
char *)
"invalid bit length repeat";
1018 break;
1019 }
1022 }
1023 }
1024
1025
1027
1028
1029 if (
state->lens[256] == 0) {
1030 strm->msg = (
char *)
"invalid code -- missing end-of-block";
1032 break;
1033 }
1034
1035
1036
1037
1044 strm->msg = (
char *)
"invalid literal/lengths set";
1046 break;
1047 }
1049 state->distbits = 6;
1053 strm->msg = (
char *)
"invalid distances set";
1055 break;
1056 }
1059 if (flush ==
Z_TREES)
goto inf_leave;
1060
1063
1071 break;
1072 }
1074 for (;;) {
1076 if ((
unsigned)(here.
bits) <=
bits)
break;
1078 }
1079 if (here.
op && (here.
op & 0xf0) == 0) {
1081 for (;;) {
1086 }
1089 }
1093 if ((
int)(here.
op) == 0) {
1095 "inflate: literal '%c'\n" :
1096 "inflate: literal 0x%02x\n", here.
val));
1098 break;
1099 }
1104 break;
1105 }
1107 strm->msg = (
char *)
"invalid literal/length code";
1109 break;
1110 }
1113
1120 }
1124
1126 for (;;) {
1128 if ((
unsigned)(here.
bits) <=
bits)
break;
1130 }
1131 if ((here.
op & 0xf0) == 0) {
1133 for (;;) {
1138 }
1141 }
1145 strm->msg = (
char *)
"invalid distance code";
1147 break;
1148 }
1150 state->extra = (
unsigned)(here.
op) & 15;
1152
1159 }
1160#ifdef INFLATE_STRICT
1162 strm->msg = (
char *)
"invalid distance too far back";
1164 break;
1165 }
1166#endif
1169
1171 if (
left == 0)
goto inf_leave;
1177 strm->msg = (
char *)
"invalid distance too far back";
1179 break;
1180 }
1181#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
1188 do {
1192 break;
1193#endif
1194 }
1198 }
1199 else
1202 }
1203 else {
1206 }
1210 do {
1214 break;
1216 if (
left == 0)
goto inf_leave;
1220 break;
1231 if ((
state->wrap & 4) && (
1234#endif
1236 strm->msg = (
char *)
"incorrect data check";
1238 break;
1239 }
1242 }
1243#ifdef GUNZIP
1245
1250 strm->msg = (
char *)
"incorrect length check";
1252 break;
1253 }
1256 }
1257#endif
1259
1262 goto inf_leave;
1265 goto inf_leave;
1269
1270 default:
1272 }
1273
1274
1275
1276
1277
1278
1279
1280 inf_leave:
1287 }
1302}
INT copy(TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], INT append, DWORD lpdwFlags, BOOL bTouch)
#define CRC2(check, word)
#define CRC4(check, word)
static void inflate_fast(z_streamp strm, unsigned start)
static int inflateStateCheck(z_streamp strm)
static void fixedtables(struct inflate_state FAR *state)
static uLong adler32(uLong adler, const Bytef *buf, uInt len)
static int updatewindow(z_streamp strm, const Bytef *end, unsigned copy)
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
GLuint GLdouble GLdouble GLint GLint order
#define UPDATE_CHECK(check, buf, len)