extmod/moduzlib: Update for uzlib 2.9.2.

This commit is contained in:
Paul Sokolovsky 2018-11-30 23:48:03 +03:00 committed by Damien George
parent b1cca8fbe0
commit 35687a87ec
1 changed files with 6 additions and 5 deletions

View File

@ -48,7 +48,7 @@ typedef struct _mp_obj_decompio_t {
bool eof;
} mp_obj_decompio_t;
STATIC unsigned char read_src_stream(TINF_DATA *data) {
STATIC int read_src_stream(TINF_DATA *data) {
byte *p = (void*)data;
p -= offsetof(mp_obj_decompio_t, decomp);
mp_obj_decompio_t *self = (mp_obj_decompio_t*)p;
@ -110,7 +110,7 @@ STATIC mp_uint_t decompio_read(mp_obj_t o_in, void *buf, mp_uint_t size, int *er
}
o->decomp.dest = buf;
o->decomp.destSize = size;
o->decomp.dest_limit = (byte*)buf + size;
int st = uzlib_uncompress_chksum(&o->decomp);
if (st == TINF_DONE) {
o->eof = true;
@ -155,9 +155,10 @@ STATIC mp_obj_t mod_uzlib_decompress(size_t n_args, const mp_obj_t *args) {
byte *dest_buf = m_new(byte, dest_buf_size);
decomp->dest = dest_buf;
decomp->destSize = dest_buf_size;
DEBUG_printf("uzlib: Initial out buffer: " UINT_FMT " bytes\n", decomp->destSize);
decomp->dest_limit = dest_buf + dest_buf_size;
DEBUG_printf("uzlib: Initial out buffer: " UINT_FMT " bytes\n", dest_buf_size);
decomp->source = bufinfo.buf;
decomp->source_limit = (byte*)bufinfo.buf + bufinfo.len;
int st;
bool is_zlib = true;
@ -185,7 +186,7 @@ STATIC mp_obj_t mod_uzlib_decompress(size_t n_args, const mp_obj_t *args) {
dest_buf = m_renew(byte, dest_buf, dest_buf_size, dest_buf_size + 256);
dest_buf_size += 256;
decomp->dest = dest_buf + offset;
decomp->destSize = 256;
decomp->dest_limit = decomp->dest + 256;
}
mp_uint_t final_sz = decomp->dest - dest_buf;