Skip to content

Commit

Permalink
lib/os/cbprintf: Use signed char for %hhd format
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
keith-packard authored and carlescufi committed Jun 9, 2022
1 parent e097d95 commit 11267a3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/os/cbprintf_complete.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 11267a3

Please sign in to comment.