Merge pull request #1180 from jepler/update-uzlib-to-v2.9

uzlib: Upgrade to uzlib v2.9 release
This commit is contained in:
Scott Shawcroft 2018-09-09 22:33:14 -07:00 committed by GitHub
commit d9f62a43cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 6 deletions

View File

@ -35,6 +35,7 @@
#if MICROPY_PY_UZLIB #if MICROPY_PY_UZLIB
#define UZLIB_CONF_PARANOID_CHECKS (1)
#include "../../lib/uzlib/src/tinf.h" #include "../../lib/uzlib/src/tinf.h"
#if 0 // print debugging info #if 0 // print debugging info
@ -50,7 +51,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;
@ -112,7 +113,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 = (unsigned char*)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;
@ -157,10 +158,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", decomp->destSize);
decomp->source = bufinfo.buf; decomp->source = bufinfo.buf;
decomp->source_limit = (unsigned char *)bufinfo.buf + bufinfo.len;
int st; int st;
bool is_zlib = true; bool is_zlib = true;
@ -187,7 +188,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 = dest_buf + offset + 256;
} }
mp_uint_t final_sz = decomp->dest - dest_buf; mp_uint_t final_sz = decomp->dest - dest_buf;
@ -218,6 +219,7 @@ const mp_obj_module_t mp_module_uzlib = {
// Source files #include'd here to make sure they're compiled in // Source files #include'd here to make sure they're compiled in
// only if module is enabled by config setting. // only if module is enabled by config setting.
#pragma GCC diagnostic ignored "-Wsign-compare"
#include "../../lib/uzlib/src/tinflate.c" #include "../../lib/uzlib/src/tinflate.c"
#include "../../lib/uzlib/src/tinfzlib.c" #include "../../lib/uzlib/src/tinfzlib.c"
#include "../../lib/uzlib/src/tinfgzip.c" #include "../../lib/uzlib/src/tinfgzip.c"

@ -1 +1 @@
Subproject commit 27176508e188c0900877e810be34198cd88dcb63 Subproject commit f966da0fab121e910ea74f037f074538a2e6dbbb