From 2a1cca20b1e1a93c86c8c3a3254ab7150c85ac08 Mon Sep 17 00:00:00 2001 From: Damien George Date: Mon, 14 Mar 2016 22:40:39 +0000 Subject: py: Fix passing of some wide int types to printf varg format list. Passing an mp_uint_t to a %d printf format is incorrect for builds where mp_uint_t is larger than word size (eg a nanboxing build). This patch adds some simple casting to int in these cases. --- py/modbuiltins.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'py/modbuiltins.c') diff --git a/py/modbuiltins.c b/py/modbuiltins.c index 05bdbfecac..859cb11116 100644 --- a/py/modbuiltins.c +++ b/py/modbuiltins.c @@ -370,7 +370,7 @@ STATIC mp_obj_t mp_builtin_ord(mp_obj_t o_in) { "ord expects a character")); } else { nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_TypeError, - "ord() expected a character, but string of length %d found", len)); + "ord() expected a character, but string of length %d found", (int)len)); } } MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_ord_obj, mp_builtin_ord); -- cgit v1.2.3