@@ -213,7 +213,7 @@ STATIC mp_obj_t bytes_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_k
213213 return mp_obj_str_builder_end (o );
214214 }
215215
216- int len ;
216+ mp_int_t len ;
217217 byte * data ;
218218 vstr_t * vstr = NULL ;
219219 mp_obj_t o = NULL ;
@@ -293,7 +293,7 @@ mp_obj_t mp_obj_str_binary_op(mp_uint_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
293293 // add 2 strings or bytes
294294
295295 GET_STR_DATA_LEN (rhs_in , rhs_data , rhs_len );
296- int alloc_len = lhs_len + rhs_len ;
296+ mp_uint_t alloc_len = lhs_len + rhs_len ;
297297
298298 /* code for making qstr
299299 byte *q_ptr;
@@ -440,8 +440,8 @@ STATIC mp_obj_t str_join(mp_obj_t self_in, mp_obj_t arg) {
440440 }
441441
442442 // count required length
443- int required_len = 0 ;
444- for (int i = 0 ; i < seq_len ; i ++ ) {
443+ mp_uint_t required_len = 0 ;
444+ for (mp_uint_t i = 0 ; i < seq_len ; i ++ ) {
445445 if (mp_obj_get_type (seq_items [i ]) != self_type ) {
446446 nlr_raise (mp_obj_new_exception_msg (& mp_type_TypeError ,
447447 "join expects a list of str/bytes objects consistent with self object" ));
@@ -456,7 +456,7 @@ STATIC mp_obj_t str_join(mp_obj_t self_in, mp_obj_t arg) {
456456 // make joined string
457457 byte * data ;
458458 mp_obj_t joined_str = mp_obj_str_builder_start (self_type , required_len , & data );
459- for (int i = 0 ; i < seq_len ; i ++ ) {
459+ for (mp_uint_t i = 0 ; i < seq_len ; i ++ ) {
460460 if (i > 0 ) {
461461 memcpy (data , sep_str , sep_len );
462462 data += sep_len ;
@@ -562,7 +562,7 @@ STATIC mp_obj_t str_rsplit(mp_uint_t n_args, const mp_obj_t *args) {
562562 // Preallocate list to the max expected # of elements, as we
563563 // will fill it from the end.
564564 mp_obj_list_t * res = mp_obj_new_list (splits + 1 , NULL );
565- int idx = splits ;
565+ mp_int_t idx = splits ;
566566
567567 if (sep == mp_const_none ) {
568568 assert (!"TODO: rsplit(None,n) not implemented" );
@@ -598,7 +598,7 @@ STATIC mp_obj_t str_rsplit(mp_uint_t n_args, const mp_obj_t *args) {
598598 }
599599 if (idx != 0 ) {
600600 // We split less parts than split limit, now go cleanup surplus
601- int used = org_splits + 1 - idx ;
601+ mp_int_t used = org_splits + 1 - idx ;
602602 memmove (res -> items , & res -> items [idx ], used * sizeof (mp_obj_t ));
603603 mp_seq_clear (res -> items , used , res -> alloc , sizeof (* res -> items ));
604604 res -> len = used ;
@@ -1554,7 +1554,7 @@ STATIC mp_obj_t str_caseconv(unichar (*op)(unichar), mp_obj_t self_in) {
15541554 GET_STR_DATA_LEN (self_in , self_data , self_len );
15551555 byte * data ;
15561556 mp_obj_t s = mp_obj_str_builder_start (mp_obj_get_type (self_in ), self_len , & data );
1557- for (int i = 0 ; i < self_len ; i ++ ) {
1557+ for (mp_uint_t i = 0 ; i < self_len ; i ++ ) {
15581558 * data ++ = op (* self_data ++ );
15591559 }
15601560 * data = 0 ;
@@ -1577,15 +1577,15 @@ STATIC mp_obj_t str_uni_istype(bool (*f)(unichar), mp_obj_t self_in) {
15771577 }
15781578
15791579 if (f != unichar_isupper && f != unichar_islower ) {
1580- for (int i = 0 ; i < self_len ; i ++ ) {
1580+ for (mp_uint_t i = 0 ; i < self_len ; i ++ ) {
15811581 if (!f (* self_data ++ )) {
15821582 return mp_const_false ;
15831583 }
15841584 }
15851585 } else {
15861586 bool contains_alpha = false;
15871587
1588- for (int i = 0 ; i < self_len ; i ++ ) { // only check alphanumeric characters
1588+ for (mp_uint_t i = 0 ; i < self_len ; i ++ ) { // only check alphanumeric characters
15891589 if (unichar_isalpha (* self_data ++ )) {
15901590 contains_alpha = true;
15911591 if (!f (* (self_data - 1 ))) { // -1 because we already incremented above
0 commit comments