summaryrefslogtreecommitdiff
path: root/examples/usercmodule/cexample/examplemodule.c
diff options
context:
space:
mode:
authorJeff Epler <jepler@gmail.com>2025-06-21 15:40:38 +0200
committerDamien George <damien@micropython.org>2025-07-25 10:56:57 +1000
commitd0d111356f36373bdda387626162f60b38f2177a (patch)
tree54dc6dd3c76b64a24aaeeb4e5fcf8ae187c68210 /examples/usercmodule/cexample/examplemodule.c
parent519cba4d050e0c0bf69039908ef255b421d8ce57 (diff)
py: Fix mp_printf integer size mismatches.
The type of the argument must match the format string. Add casts to ensure that they do. It's possible that casting from `size_t` to `unsigned` loses the correct values by masking off upper bits, but it seems likely that the quantities involved in practice are small enough that the `%u` formatter (32 bits on most platforms, 16 on pic16bit) will in fact hold the correct value. The alternative, casting to a wider type, adds code size. These locations were found using an experimental gcc plugin for `mp_printf` error checking, cross-building for x64 windows on Linux. In one case there was already a cast, but it was written incorrectly and did not have the intended effect. Signed-off-by: Jeff Epler <jepler@gmail.com>
Diffstat (limited to 'examples/usercmodule/cexample/examplemodule.c')
0 files changed, 0 insertions, 0 deletions