mirror of
https://github.com/micropython/micropython.git
synced 2026-01-08 05:00:26 +01:00
all: Reformat C and Python source code with tools/codeformat.py.
This is run with uncrustify 0.70.1, and black 19.10b0.
This commit is contained in:
@@ -49,9 +49,9 @@ typedef struct _mp_obj_decompio_t {
|
||||
} mp_obj_decompio_t;
|
||||
|
||||
STATIC int read_src_stream(TINF_DATA *data) {
|
||||
byte *p = (void*)data;
|
||||
byte *p = (void *)data;
|
||||
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;
|
||||
|
||||
const mp_stream_p_t *stream = mp_get_stream(self->src_stream);
|
||||
int err;
|
||||
@@ -91,7 +91,7 @@ STATIC mp_obj_t decompio_make_new(const mp_obj_type_t *type, size_t n_args, size
|
||||
} else if (dict_opt >= 0) {
|
||||
dict_opt = uzlib_zlib_parse_header(&o->decomp);
|
||||
if (dict_opt < 0) {
|
||||
header_error:
|
||||
header_error:
|
||||
mp_raise_ValueError("compression header");
|
||||
}
|
||||
dict_sz = 1 << dict_opt;
|
||||
@@ -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_limit = (byte*)buf + size;
|
||||
o->decomp.dest_limit = (byte *)buf + size;
|
||||
int st = uzlib_uncompress_chksum(&o->decomp);
|
||||
if (st == TINF_DONE) {
|
||||
o->eof = true;
|
||||
@@ -119,7 +119,7 @@ STATIC mp_uint_t decompio_read(mp_obj_t o_in, void *buf, mp_uint_t size, int *er
|
||||
*errcode = MP_EINVAL;
|
||||
return MP_STREAM_ERROR;
|
||||
}
|
||||
return o->decomp.dest - (byte*)buf;
|
||||
return o->decomp.dest - (byte *)buf;
|
||||
}
|
||||
|
||||
#if !MICROPY_ENABLE_DYNRUNTIME
|
||||
@@ -142,7 +142,7 @@ STATIC const mp_obj_type_t decompio_type = {
|
||||
.name = MP_QSTR_DecompIO,
|
||||
.make_new = decompio_make_new,
|
||||
.protocol = &decompio_stream_p,
|
||||
.locals_dict = (void*)&decompio_locals_dict,
|
||||
.locals_dict = (void *)&decompio_locals_dict,
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -162,7 +162,7 @@ STATIC mp_obj_t mod_uzlib_decompress(size_t n_args, const mp_obj_t *args) {
|
||||
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;
|
||||
decomp->source_limit = (byte *)bufinfo.buf + bufinfo.len;
|
||||
|
||||
int st;
|
||||
bool is_zlib = true;
|
||||
@@ -195,13 +195,13 @@ STATIC mp_obj_t mod_uzlib_decompress(size_t n_args, const mp_obj_t *args) {
|
||||
|
||||
mp_uint_t final_sz = decomp->dest - dest_buf;
|
||||
DEBUG_printf("uzlib: Resizing from " UINT_FMT " to final size: " UINT_FMT " bytes\n", dest_buf_size, final_sz);
|
||||
dest_buf = (byte*)m_renew(byte, dest_buf, dest_buf_size, final_sz);
|
||||
dest_buf = (byte *)m_renew(byte, dest_buf, dest_buf_size, final_sz);
|
||||
mp_obj_t res = mp_obj_new_bytearray_by_ref(final_sz, dest_buf);
|
||||
m_del_obj(TINF_DATA, decomp);
|
||||
return res;
|
||||
|
||||
error:
|
||||
nlr_raise(mp_obj_new_exception_arg1(&mp_type_ValueError, MP_OBJ_NEW_SMALL_INT(st)));
|
||||
nlr_raise(mp_obj_new_exception_arg1(&mp_type_ValueError, MP_OBJ_NEW_SMALL_INT(st)));
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_uzlib_decompress_obj, 1, 3, mod_uzlib_decompress);
|
||||
|
||||
@@ -216,7 +216,7 @@ STATIC MP_DEFINE_CONST_DICT(mp_module_uzlib_globals, mp_module_uzlib_globals_tab
|
||||
|
||||
const mp_obj_module_t mp_module_uzlib = {
|
||||
.base = { &mp_type_module },
|
||||
.globals = (mp_obj_dict_t*)&mp_module_uzlib_globals,
|
||||
.globals = (mp_obj_dict_t *)&mp_module_uzlib_globals,
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user