py: Use size_t as len argument and return type of mp_get_index.
These values are used to compute memory addresses and so size_t is the more appropriate type to use.
This commit is contained in:
@@ -388,7 +388,7 @@ mp_obj_t mp_obj_str_binary_op(mp_uint_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
|
||||
// objstrunicode defines own version
|
||||
const byte *str_index_to_ptr(const mp_obj_type_t *type, const byte *self_data, size_t self_len,
|
||||
mp_obj_t index, bool is_slice) {
|
||||
mp_uint_t index_val = mp_get_index(type, self_len, index, is_slice);
|
||||
size_t index_val = mp_get_index(type, self_len, index, is_slice);
|
||||
return self_data + index_val;
|
||||
}
|
||||
#endif
|
||||
@@ -408,7 +408,7 @@ STATIC mp_obj_t bytes_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
|
||||
return mp_obj_new_str_of_type(type, self_data + slice.start, slice.stop - slice.start);
|
||||
}
|
||||
#endif
|
||||
mp_uint_t index_val = mp_get_index(type, self_len, index, false);
|
||||
size_t index_val = mp_get_index(type, self_len, index, false);
|
||||
// If we have unicode enabled the type will always be bytes, so take the short cut.
|
||||
if (MICROPY_PY_BUILTINS_STR_UNICODE || type == &mp_type_bytes) {
|
||||
return MP_OBJ_NEW_SMALL_INT(self_data[index_val]);
|
||||
|
||||
Reference in New Issue
Block a user