py/mpprint: Prevent case fall-through when assert is disabled.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George 2020-11-28 17:31:13 +11:00
parent 6a3d70db96
commit be24e6a53f

View File

@ -557,12 +557,10 @@ int mp_vprintf(const mp_print_t *print, const char *fmt, va_list args) {
case 'l': { case 'l': {
unsigned long long int arg_value = va_arg(args, unsigned long long int); unsigned long long int arg_value = va_arg(args, unsigned long long int);
++fmt; ++fmt;
if (*fmt == 'u' || *fmt == 'd') { assert(*fmt == 'u' || *fmt == 'd' || !"unsupported fmt char");
chrs += mp_print_int(print, arg_value, *fmt == 'd', 10, 'a', flags, fill, width); chrs += mp_print_int(print, arg_value, *fmt == 'd', 10, 'a', flags, fill, width);
break; break;
} }
assert(!"unsupported fmt char");
}
#endif #endif
default: default:
// if it's not %% then it's an unsupported format character // if it's not %% then it's an unsupported format character