lib/os/cbprintf: Use signed char for %hhd format

The cast to narrow for %hhd support must be 'signed char' instead of 'char'
to support targets where 'char' is unsigned, as on riscv.

Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
Keith Packard 2022-06-07 14:04:33 -07:00 committed by Carles Cufí
commit 11267a30a1

View file

@ -1514,7 +1514,7 @@ int z_cbvprintf_impl(cbprintf_cb out, void *ctx, const char *fp,
break;
}
if (length_mod == LENGTH_HH) {
value->sint = (char)value->sint;
value->sint = (signed char)value->sint;
} else if (length_mod == LENGTH_H) {
value->sint = (short)value->sint;
}