1258{
1272#ifdef GUNZIP
1273 unsigned char hbuf[4];
1274#endif
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};
1277
1281
1288 for (;;)
1289 switch (
state->mode) {
1291 if (
state->wrap == 0) {
1293 break;
1294 }
1296#ifdef GUNZIP
1297 if ((
state->wrap & 2) &&
hold == 0x8b1f) {
1298 if (
state->wbits == 0)
1304 break;
1305 }
1308 state->head->done = -1;
1309 if (!(
state->wrap & 1) ||
1310#else
1312#endif
1313 ((
BITS(8) << 8) + (
hold >> 8)) % 31) {
1314 strm->msg = (
char *)
"incorrect header check";
1316 break;
1317 }
1319 strm->msg = (
char *)
"unknown compression method";
1321 break;
1322 }
1325 if (
state->wbits == 0)
1328 strm->msg = (
char *)
"invalid window size";
1330 break;
1331 }
1337 break;
1338#ifdef GUNZIP
1343 strm->msg = (
char *)
"unknown compression method";
1345 break;
1346 }
1347 if (
state->flags & 0xe000) {
1348 strm->msg = (
char *)
"unknown header flags set";
1350 break;
1351 }
1354 if ((
state->flags & 0x0200) && (
state->wrap & 4))
1362 if ((
state->flags & 0x0200) && (
state->wrap & 4))
1371 }
1372 if ((
state->flags & 0x0200) && (
state->wrap & 4))
1377 if (
state->flags & 0x0400) {
1382 if ((
state->flags & 0x0200) && (
state->wrap & 4))
1385 }
1390 if (
state->flags & 0x0400) {
1400 }
1401 if ((
state->flags & 0x0200) && (
state->wrap & 4))
1406 }
1407 if (
state->length)
goto inf_leave;
1408 }
1412 if (
state->flags & 0x0800) {
1413 if (
have == 0)
goto inf_leave;
1415 do {
1422 if ((
state->flags & 0x0200) && (
state->wrap & 4))
1426 if (
len)
goto inf_leave;
1427 }
1433 if (
state->flags & 0x1000) {
1434 if (
have == 0)
goto inf_leave;
1436 do {
1443 if ((
state->flags & 0x0200) && (
state->wrap & 4))
1447 if (
len)
goto inf_leave;
1448 }
1453 if (
state->flags & 0x0200) {
1456 strm->msg = (
char *)
"header crc mismatch";
1458 break;
1459 }
1461 }
1464 state->head->done = 1;
1465 }
1468 break;
1469#endif
1476 if (
state->havedict == 0) {
1479 }
1488 break;
1489 }
1494 case 0:
1496 state->last ?
" (last)" :
""));
1498 break;
1499 case 1:
1502 state->last ?
" (last)" :
""));
1506 goto inf_leave;
1507 }
1508 break;
1509 case 2:
1511 state->last ?
" (last)" :
""));
1513 break;
1514 case 3:
1515 strm->msg = (
char *)
"invalid block type";
1517 }
1519 break;
1523 if ((
hold & 0xffff) != ((
hold >> 16) ^ 0xffff)) {
1524 strm->msg = (
char *)
"invalid stored block lengths";
1526 break;
1527 }
1533 if (flush ==
Z_TREES)
goto inf_leave;
1541 if (
copy == 0)
goto inf_leave;
1548 break;
1549 }
1552 break;
1561#ifndef PKZIP_BUG_WORKAROUND
1562 if (
state->nlen > 286 ||
state->ndist > 30) {
1563 strm->msg = (
char *)
"too many length or distance symbols";
1565 break;
1566 }
1567#endif
1576 }
1577 while (
state->have < 19)
1585 strm->msg = (
char *)
"invalid code lengths set";
1587 break;
1588 }
1594 for (;;) {
1596 if ((
unsigned)(here.
bits) <=
bits)
break;
1598 }
1599 if (here.
val < 16) {
1602 }
1603 else {
1604 if (here.
val == 16) {
1607 if (
state->have == 0) {
1608 strm->msg = (
char *)
"invalid bit length repeat";
1610 break;
1611 }
1615 }
1616 else if (here.
val == 17) {
1622 }
1623 else {
1629 }
1631 strm->msg = (
char *)
"invalid bit length repeat";
1633 break;
1634 }
1637 }
1638 }
1639
1640
1642
1643
1644 if (
state->lens[256] == 0) {
1645 strm->msg = (
char *)
"invalid code -- missing end-of-block";
1647 break;
1648 }
1649
1650
1651
1652
1659 strm->msg = (
char *)
"invalid literal/lengths set";
1661 break;
1662 }
1664 state->distbits = 6;
1668 strm->msg = (
char *)
"invalid distances set";
1670 break;
1671 }
1674 if (flush ==
Z_TREES)
goto inf_leave;
1684 break;
1685 }
1687 for (;;) {
1689 if ((
unsigned)(here.
bits) <=
bits)
break;
1691 }
1692 if (here.
op && (here.
op & 0xf0) == 0) {
1694 for (;;) {
1699 }
1702 }
1706 if ((
int)(here.
op) == 0) {
1708 "inflate: literal '%c'\n" :
1709 "inflate: literal 0x%02x\n", here.
val));
1711 break;
1712 }
1717 break;
1718 }
1720 strm->msg = (
char *)
"invalid literal/length code";
1722 break;
1723 }
1732 }
1737 for (;;) {
1739 if ((
unsigned)(here.
bits) <=
bits)
break;
1741 }
1742 if ((here.
op & 0xf0) == 0) {
1744 for (;;) {
1749 }
1752 }
1756 strm->msg = (
char *)
"invalid distance code";
1758 break;
1759 }
1761 state->extra = (
unsigned)(here.
op) & 15;
1769 }
1770#ifdef INFLATE_STRICT
1772 strm->msg = (
char *)
"invalid distance too far back";
1774 break;
1775 }
1776#endif
1780 if (
left == 0)
goto inf_leave;
1786 strm->msg = (
char *)
"invalid distance too far back";
1788 break;
1789 }
1790#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
1797 do {
1801 break;
1802#endif
1803 }
1807 }
1808 else
1811 }
1812 else {
1815 }
1819 do {
1823 break;
1825 if (
left == 0)
goto inf_leave;
1829 break;
1840 if ((
state->wrap & 4) && (
1843#endif
1845 strm->msg = (
char *)
"incorrect data check";
1847 break;
1848 }
1851 }
1852#ifdef GUNZIP
1857 if (
hold != (
state->total & 0xffffffffUL)) {
1858 strm->msg = (
char *)
"incorrect length check";
1860 break;
1861 }
1864 }
1865#endif
1869 goto inf_leave;
1872 goto inf_leave;
1876 default:
1878 }
1879
1880
1881
1882
1883
1884
1885
1886 inf_leave:
1893 }
1908}
#define CRC2(check, word)
static int inflate_table(codetype type, unsigned short FAR *lens, unsigned codes, code FAR *FAR *table, unsigned FAR *bits, unsigned short FAR *work)
#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)
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 *)
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
GLuint GLdouble GLdouble GLint GLint order
static unsigned(__cdecl *hash_bstr)(bstr_t s)
static unsigned __int64 next