From da36f5232dcf02c448ee9933e358b711cfe03f30 Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 16 Feb 2017 16:41:43 +1100 Subject: [PATCH] py/objint: Convert mp_uint_t to size_t where appropriate. --- py/obj.h | 2 +- py/objint.c | 2 +- py/objint_longlong.c | 2 +- py/objint_mpz.c | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/py/obj.h b/py/obj.h index 1b926ce144..1169a9095e 100644 --- a/py/obj.h +++ b/py/obj.h @@ -607,7 +607,7 @@ static inline mp_obj_t mp_obj_new_bool(mp_int_t x) { return x ? mp_const_true : mp_obj_t mp_obj_new_cell(mp_obj_t obj); mp_obj_t mp_obj_new_int(mp_int_t value); mp_obj_t mp_obj_new_int_from_uint(mp_uint_t value); -mp_obj_t mp_obj_new_int_from_str_len(const char **str, mp_uint_t len, bool neg, mp_uint_t base); +mp_obj_t mp_obj_new_int_from_str_len(const char **str, size_t len, bool neg, unsigned int base); mp_obj_t mp_obj_new_int_from_ll(long long val); // this must return a multi-precision integer object (or raise an overflow exception) mp_obj_t mp_obj_new_int_from_ull(unsigned long long val); // this must return a multi-precision integer object (or raise an overflow exception) mp_obj_t mp_obj_new_str(const char* data, size_t len, bool make_qstr_if_not_already); diff --git a/py/objint.c b/py/objint.c index 222aa1de71..2a7e3f3fd9 100644 --- a/py/objint.c +++ b/py/objint.c @@ -291,7 +291,7 @@ mp_obj_t mp_obj_int_binary_op(mp_uint_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) { } // This is called only with strings whose value doesn't fit in SMALL_INT -mp_obj_t mp_obj_new_int_from_str_len(const char **str, mp_uint_t len, bool neg, mp_uint_t base) { +mp_obj_t mp_obj_new_int_from_str_len(const char **str, size_t len, bool neg, unsigned int base) { mp_raise_msg(&mp_type_OverflowError, "long int not supported in this build"); return mp_const_none; } diff --git a/py/objint_longlong.c b/py/objint_longlong.c index dbfb39809a..b798c91cdf 100644 --- a/py/objint_longlong.c +++ b/py/objint_longlong.c @@ -273,7 +273,7 @@ mp_obj_t mp_obj_new_int_from_float(mp_float_t val) { } #endif -mp_obj_t mp_obj_new_int_from_str_len(const char **str, mp_uint_t len, bool neg, mp_uint_t base) { +mp_obj_t mp_obj_new_int_from_str_len(const char **str, size_t len, bool neg, unsigned int base) { // TODO this does not honor the given length of the string, but it all cases it should anyway be null terminated // TODO check overflow mp_obj_int_t *o = m_new_obj(mp_obj_int_t); diff --git a/py/objint_mpz.c b/py/objint_mpz.c index 2b27df4f63..2cdf225050 100644 --- a/py/objint_mpz.c +++ b/py/objint_mpz.c @@ -407,9 +407,9 @@ mp_obj_t mp_obj_new_int_from_float(mp_float_t val) { } #endif -mp_obj_t mp_obj_new_int_from_str_len(const char **str, mp_uint_t len, bool neg, mp_uint_t base) { +mp_obj_t mp_obj_new_int_from_str_len(const char **str, size_t len, bool neg, unsigned int base) { mp_obj_int_t *o = mp_obj_int_new_mpz(); - mp_uint_t n = mpz_set_from_str(&o->mpz, *str, len, neg, base); + size_t n = mpz_set_from_str(&o->mpz, *str, len, neg, base); *str += n; return MP_OBJ_FROM_PTR(o); }