extmod/moduzlib: Update for uzlib 2.9.2.
This commit is contained in:
parent
b1cca8fbe0
commit
35687a87ec
|
@ -48,7 +48,7 @@ typedef struct _mp_obj_decompio_t {
|
||||||
bool eof;
|
bool eof;
|
||||||
} mp_obj_decompio_t;
|
} 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;
|
byte *p = (void*)data;
|
||||||
p -= offsetof(mp_obj_decompio_t, decomp);
|
p -= offsetof(mp_obj_decompio_t, decomp);
|
||||||
mp_obj_decompio_t *self = (mp_obj_decompio_t*)p;
|
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.dest = buf;
|
||||||
o->decomp.destSize = size;
|
o->decomp.dest_limit = (byte*)buf + size;
|
||||||
int st = uzlib_uncompress_chksum(&o->decomp);
|
int st = uzlib_uncompress_chksum(&o->decomp);
|
||||||
if (st == TINF_DONE) {
|
if (st == TINF_DONE) {
|
||||||
o->eof = true;
|
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);
|
byte *dest_buf = m_new(byte, dest_buf_size);
|
||||||
|
|
||||||
decomp->dest = dest_buf;
|
decomp->dest = dest_buf;
|
||||||
decomp->destSize = dest_buf_size;
|
decomp->dest_limit = dest_buf + dest_buf_size;
|
||||||
DEBUG_printf("uzlib: Initial out buffer: " UINT_FMT " bytes\n", decomp->destSize);
|
DEBUG_printf("uzlib: Initial out buffer: " UINT_FMT " bytes\n", dest_buf_size);
|
||||||
decomp->source = bufinfo.buf;
|
decomp->source = bufinfo.buf;
|
||||||
|
decomp->source_limit = (byte*)bufinfo.buf + bufinfo.len;
|
||||||
|
|
||||||
int st;
|
int st;
|
||||||
bool is_zlib = true;
|
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 = m_renew(byte, dest_buf, dest_buf_size, dest_buf_size + 256);
|
||||||
dest_buf_size += 256;
|
dest_buf_size += 256;
|
||||||
decomp->dest = dest_buf + offset;
|
decomp->dest = dest_buf + offset;
|
||||||
decomp->destSize = 256;
|
decomp->dest_limit = decomp->dest + 256;
|
||||||
}
|
}
|
||||||
|
|
||||||
mp_uint_t final_sz = decomp->dest - dest_buf;
|
mp_uint_t final_sz = decomp->dest - dest_buf;
|
||||||
|
|
Loading…
Reference in New Issue