35
35
36
36
#if MICROPY_PY_UZLIB
37
37
38
+ #define UZLIB_CONF_PARANOID_CHECKS (1)
38
39
#include "../../lib/uzlib/src/tinf.h"
39
40
40
41
#if 0 // print debugging info
@@ -50,7 +51,7 @@ typedef struct _mp_obj_decompio_t {
50
51
bool eof ;
51
52
} mp_obj_decompio_t ;
52
53
53
- STATIC unsigned char read_src_stream (TINF_DATA * data ) {
54
+ STATIC int read_src_stream (TINF_DATA * data ) {
54
55
byte * p = (void * )data ;
55
56
p -= offsetof(mp_obj_decompio_t , decomp );
56
57
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
112
113
}
113
114
114
115
o -> decomp .dest = buf ;
115
- o -> decomp .destSize = size ;
116
+ o -> decomp .dest_limit = ( unsigned char * ) buf + size ;
116
117
int st = uzlib_uncompress_chksum (& o -> decomp );
117
118
if (st == TINF_DONE ) {
118
119
o -> eof = true;
@@ -157,10 +158,10 @@ STATIC mp_obj_t mod_uzlib_decompress(size_t n_args, const mp_obj_t *args) {
157
158
byte * dest_buf = m_new (byte , dest_buf_size );
158
159
159
160
decomp -> dest = dest_buf ;
160
- decomp -> destSize = dest_buf_size ;
161
+ decomp -> dest_limit = dest_buf + dest_buf_size ;
161
162
DEBUG_printf ("uzlib: Initial out buffer: " UINT_FMT " bytes\n" , decomp -> destSize );
162
163
decomp -> source = bufinfo .buf ;
163
-
164
+ decomp -> source_limit = ( unsigned char * ) bufinfo . buf + bufinfo . len ;
164
165
int st ;
165
166
bool is_zlib = true;
166
167
@@ -187,7 +188,7 @@ STATIC mp_obj_t mod_uzlib_decompress(size_t n_args, const mp_obj_t *args) {
187
188
dest_buf = m_renew (byte , dest_buf , dest_buf_size , dest_buf_size + 256 );
188
189
dest_buf_size += 256 ;
189
190
decomp -> dest = dest_buf + offset ;
190
- decomp -> destSize = 256 ;
191
+ decomp -> dest_limit = dest_buf + offset + 256 ;
191
192
}
192
193
193
194
mp_uint_t final_sz = decomp -> dest - dest_buf ;
@@ -218,6 +219,7 @@ const mp_obj_module_t mp_module_uzlib = {
218
219
// Source files #include'd here to make sure they're compiled in
219
220
// only if module is enabled by config setting.
220
221
222
+ #pragma GCC diagnostic ignored "-Wsign-compare"
221
223
#include "../../lib/uzlib/src/tinflate.c"
222
224
#include "../../lib/uzlib/src/tinfzlib.c"
223
225
#include "../../lib/uzlib/src/tinfgzip.c"
0 commit comments