Lines 811-818
int32_t cli_bcapi_inflate_init(struct cli_bc_ctx *ctx, int32_t from, int32_t to,
Link Here
|
811 |
cli_dbgmsg("bytecode api: inflate_init: invalid buffers!\n"); |
811 |
cli_dbgmsg("bytecode api: inflate_init: invalid buffers!\n"); |
812 |
return -1; |
812 |
return -1; |
813 |
} |
813 |
} |
814 |
memset(&stream, 0, sizeof(stream)); |
814 |
b = cli_realloc(ctx->inflates, sizeof(*ctx->inflates)*n); |
815 |
ret = inflateInit2(&stream, windowBits); |
815 |
if (!b) { |
|
|
816 |
return -1; |
817 |
} |
818 |
ctx->inflates = b; |
819 |
ctx->ninflates = n; |
820 |
b = &b[n-1]; |
821 |
|
822 |
b->from = from; |
823 |
b->to = to; |
824 |
b->needSync = 0; |
825 |
memset(&b->stream, 0, sizeof(stream)); |
826 |
ret = inflateInit2(&b->stream, windowBits); |
816 |
switch (ret) { |
827 |
switch (ret) { |
817 |
case Z_MEM_ERROR: |
828 |
case Z_MEM_ERROR: |
818 |
cli_dbgmsg("bytecode api: inflateInit2: out of memory!\n"); |
829 |
cli_dbgmsg("bytecode api: inflateInit2: out of memory!\n"); |
Lines 830-848
int32_t cli_bcapi_inflate_init(struct cli_bc_ctx *ctx, int32_t from, int32_t to,
Link Here
|
830 |
return -1; |
841 |
return -1; |
831 |
} |
842 |
} |
832 |
|
843 |
|
833 |
b = cli_realloc(ctx->inflates, sizeof(*ctx->inflates)*n); |
|
|
834 |
if (!b) { |
835 |
inflateEnd(&stream); |
836 |
return -1; |
837 |
} |
838 |
ctx->inflates = b; |
839 |
ctx->ninflates = n; |
840 |
b = &b[n-1]; |
841 |
|
842 |
b->from = from; |
843 |
b->to = to; |
844 |
b->needSync = 0; |
845 |
memcpy(&b->stream, &stream, sizeof(stream)); |
846 |
return n-1; |
844 |
return n-1; |
847 |
} |
845 |
} |
848 |
|
846 |
|