17 void *new_tree = calloc(new_capacity,
sizeof(*code->
tree));
19 warn(
"OOM during decompression");
24 code->
tree = new_tree;
35 int lastnode, bitpos, bit;
42 if (length < code->minlength)
46 for (bitpos = length - 1; bitpos >= 0; bitpos--) {
47 bit = (codebits >> bitpos) & 1;
49 warn(
"Invalid data in bitstream");
61 warn(
"Invalid data in bitstream");
70 int symbolsleft = numsymbols;
77 for (i = 1; i <= 0x0F; i++) {
78 for (j = 0; j < numsymbols; j++) {
83 if (--symbolsleft <= 0)
94 int currtablesize = 1 << (maxdepth - depth);
96 if (node < 0 || code->numentries <= node) {
97 warn(
"Invalid data in bitstream");
103 for (i = 0; i < currtablesize; i++) {
108 else if (depth == maxdepth) {
130 warn(
"OOM during decompression");
141 memset(code, 0,
sizeof(*code));