@@ -284,8 +284,8 @@ STATIC mp_obj_t str_find(uint n_args, const mp_obj_t *args) {
284284 GET_STR_DATA_LEN (args [0 ], haystack , haystack_len );
285285 GET_STR_DATA_LEN (args [1 ], needle , needle_len );
286286
287- size_t start = 0 ;
288- size_t end = haystack_len ;
287+ machine_uint_t start = 0 ;
288+ machine_uint_t end = haystack_len ;
289289 /* TODO use a non-exception-throwing mp_get_index */
290290 if (n_args >= 3 && args [2 ] != mp_const_none ) {
291291 start = mp_get_index (& str_type , haystack_len , args [2 ], true);
@@ -318,8 +318,8 @@ STATIC mp_obj_t str_startswith(mp_obj_t self_in, mp_obj_t arg) {
318318 return MP_BOOL (memcmp (str , prefix , prefix_len ) == 0 );
319319}
320320
321- STATIC bool chr_in_str (const byte * const str , const size_t str_len , int c ) {
322- for (size_t i = 0 ; i < str_len ; i ++ ) {
321+ STATIC bool chr_in_str (const byte * const str , const machine_uint_t str_len , int c ) {
322+ for (machine_uint_t i = 0 ; i < str_len ; i ++ ) {
323323 if (str [i ] == c ) {
324324 return true;
325325 }
@@ -347,10 +347,10 @@ STATIC mp_obj_t str_strip(uint n_args, const mp_obj_t *args) {
347347
348348 GET_STR_DATA_LEN (args [0 ], orig_str , orig_str_len );
349349
350- size_t first_good_char_pos = 0 ;
350+ machine_uint_t first_good_char_pos = 0 ;
351351 bool first_good_char_pos_set = false;
352- size_t last_good_char_pos = 0 ;
353- for (size_t i = 0 ; i < orig_str_len ; i ++ ) {
352+ machine_uint_t last_good_char_pos = 0 ;
353+ for (machine_uint_t i = 0 ; i < orig_str_len ; i ++ ) {
354354 if (!chr_in_str (chars_to_del , chars_to_del_len , orig_str [i ])) {
355355 last_good_char_pos = i ;
356356 if (!first_good_char_pos_set ) {
@@ -367,7 +367,7 @@ STATIC mp_obj_t str_strip(uint n_args, const mp_obj_t *args) {
367367
368368 assert (last_good_char_pos >= first_good_char_pos );
369369 //+1 to accomodate the last character
370- size_t stripped_len = last_good_char_pos - first_good_char_pos + 1 ;
370+ machine_uint_t stripped_len = last_good_char_pos - first_good_char_pos + 1 ;
371371 return mp_obj_new_str (orig_str + first_good_char_pos , stripped_len , false);
372372}
373373
0 commit comments