@@ -102,7 +102,7 @@ STATIC void array_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t
102102#if MICROPY_PY_BUILTINS_BYTEARRAY || MICROPY_PY_ARRAY
103103STATIC mp_obj_array_t * array_new (char typecode , mp_uint_t n ) {
104104 int typecode_size = mp_binary_get_size ('@' , typecode , NULL );
105- if (typecode_size < = 0 ) {
105+ if (typecode_size = = 0 ) {
106106 nlr_raise (mp_obj_new_exception_msg (& mp_type_ValueError , "bad typecode" ));
107107 }
108108 mp_obj_array_t * o = m_new_obj (mp_obj_array_t );
@@ -134,7 +134,7 @@ STATIC mp_obj_t array_construct(char typecode, mp_obj_t initializer) {
134134 && mp_get_buffer (initializer , & bufinfo , MP_BUFFER_READ )) {
135135 // construct array from raw bytes
136136 // we round-down the len to make it a multiple of sz (CPython raises error)
137- int sz = mp_binary_get_size ('@' , typecode , NULL );
137+ size_t sz = mp_binary_get_size ('@' , typecode , NULL );
138138 mp_uint_t len = bufinfo .len / sz ;
139139 mp_obj_array_t * o = array_new (typecode , len );
140140 memcpy (o -> items , bufinfo .buf , len * sz );
@@ -262,7 +262,7 @@ STATIC mp_obj_t array_binary_op(mp_uint_t op, mp_obj_t lhs_in, mp_obj_t rhs_in)
262262 array_get_buffer (lhs_in , & lhs_bufinfo , MP_BUFFER_READ );
263263 mp_get_buffer_raise (rhs_in , & rhs_bufinfo , MP_BUFFER_READ );
264264
265- int sz = mp_binary_get_size ('@' , lhs_bufinfo .typecode , NULL );
265+ size_t sz = mp_binary_get_size ('@' , lhs_bufinfo .typecode , NULL );
266266
267267 // convert byte count to element count (in case rhs is not multiple of sz)
268268 mp_uint_t rhs_len = rhs_bufinfo .len / sz ;
@@ -305,7 +305,7 @@ STATIC mp_obj_t array_append(mp_obj_t self_in, mp_obj_t arg) {
305305 mp_obj_array_t * self = self_in ;
306306
307307 if (self -> free == 0 ) {
308- int item_sz = mp_binary_get_size ('@' , self -> typecode , NULL );
308+ size_t item_sz = mp_binary_get_size ('@' , self -> typecode , NULL );
309309 // TODO: alloc policy
310310 self -> free = 8 ;
311311 self -> items = m_renew (byte , self -> items , item_sz * self -> len , item_sz * (self -> len + self -> free ));
@@ -326,7 +326,7 @@ STATIC mp_obj_t array_extend(mp_obj_t self_in, mp_obj_t arg_in) {
326326 mp_buffer_info_t arg_bufinfo ;
327327 mp_get_buffer_raise (arg_in , & arg_bufinfo , MP_BUFFER_READ );
328328
329- int sz = mp_binary_get_size ('@' , self -> typecode , NULL );
329+ size_t sz = mp_binary_get_size ('@' , self -> typecode , NULL );
330330
331331 // convert byte count to element count
332332 mp_uint_t len = arg_bufinfo .len / sz ;
@@ -371,7 +371,7 @@ STATIC mp_obj_t array_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_obj_t value
371371 // Assign
372372 mp_uint_t src_len ;
373373 void * src_items ;
374- int item_sz = mp_binary_get_size ('@' , o -> typecode , NULL );
374+ size_t item_sz = mp_binary_get_size ('@' , o -> typecode , NULL );
375375 if (MP_OBJ_IS_TYPE (value , & mp_type_array ) || MP_OBJ_IS_TYPE (value , & mp_type_bytearray )) {
376376 mp_obj_array_t * src_slice = value ;
377377 if (item_sz != mp_binary_get_size ('@' , src_slice -> typecode , NULL )) {
@@ -418,7 +418,7 @@ STATIC mp_obj_t array_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_obj_t value
418418 }
419419
420420 mp_obj_array_t * res ;
421- int sz = mp_binary_get_size ('@' , o -> typecode & TYPECODE_MASK , NULL );
421+ size_t sz = mp_binary_get_size ('@' , o -> typecode & TYPECODE_MASK , NULL );
422422 assert (sz > 0 );
423423 if (0 ) {
424424 // dummy
@@ -460,7 +460,7 @@ STATIC mp_obj_t array_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_obj_t value
460460
461461STATIC mp_int_t array_get_buffer (mp_obj_t o_in , mp_buffer_info_t * bufinfo , mp_uint_t flags ) {
462462 mp_obj_array_t * o = o_in ;
463- int sz = mp_binary_get_size ('@' , o -> typecode & TYPECODE_MASK , NULL );
463+ size_t sz = mp_binary_get_size ('@' , o -> typecode & TYPECODE_MASK , NULL );
464464 bufinfo -> buf = o -> items ;
465465 bufinfo -> len = o -> len * sz ;
466466 bufinfo -> typecode = o -> typecode & TYPECODE_MASK ;
0 commit comments