| 1832 | |
| 1833 | |
| 1834 | int inflate_trees_bits( |
| 1835 | uInt *c, // 19 code lengths |
| 1836 | uInt *bb, // bits tree desired/actual depth |
| 1837 | inflate_huft * *tb, // bits tree result |
| 1838 | inflate_huft *hp, // space for trees |
| 1839 | z_streamp z) // for messages |
| 1840 | { |
| 1841 | int r; |
| 1842 | uInt hn = 0; // hufts used in space |
| 1843 | uInt *v; // work area for huft_build |
| 1844 | |
| 1845 | if ((v = (uInt*)ZALLOC(z, 19, sizeof(uInt))) == Z_NULL) |
| 1846 | return Z_MEM_ERROR; |
| 1847 | r = huft_build(c, 19, 19, (uInt*)Z_NULL, (uInt*)Z_NULL, |
| 1848 | tb, bb, hp, &hn, v); |
| 1849 | if (r == Z_DATA_ERROR) |
| 1850 | z->msg = (char*)"oversubscribed dynamic bit lengths tree"; |
| 1851 | else if (r == Z_BUF_ERROR || *bb == 0) |
| 1852 | { |
| 1853 | z->msg = (char*)"incomplete dynamic bit lengths tree"; |
| 1854 | r = Z_DATA_ERROR; |
| 1855 | } |
| 1856 | ZFREE(z, v); |
| 1857 | return r; |
| 1858 | } |
| 1859 | |
| 1860 | |
| 1861 | int inflate_trees_dynamic( |