Commit d0d1113
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>1 parent 519cba4 commit d0d1113
2 files changed
+2
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1202 | 1202 | | |
1203 | 1203 | | |
1204 | 1204 | | |
1205 | | - | |
| 1205 | + | |
1206 | 1206 | | |
1207 | 1207 | | |
1208 | 1208 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
101 | | - | |
| 101 | + | |
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
| |||
0 commit comments