Skip to content

Commit 90e8f01

Browse files
committed
lib: os: cbprintf: Use wint_t for packaging %lc
Using wint_t instead of unsigned long to package %lc. Signed-off-by: Krzysztof Chruscinski <[email protected]>
1 parent 0c85482 commit 90e8f01

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

lib/os/cbprintf_complete.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1768,7 +1768,12 @@ static void pack_conversion(struct package_state *pst)
17681768
PACK_CAST_VALUE(pst, value->uint, unsigned short, int);
17691769
break;
17701770
case LENGTH_L:
1771-
PACK_CAST_VALUE(pst, value->uint, unsigned long);
1771+
if (conv->specifier == 'c' ) {
1772+
PACK_CAST_VALUE(pst, value->uint, wint_t);
1773+
} else {
1774+
PACK_CAST_VALUE(pst, value->uint,
1775+
unsigned long);
1776+
}
17721777
break;
17731778
case LENGTH_LL:
17741779
PACK_CAST_VALUE(pst, value->uint, unsigned long long);
@@ -1878,7 +1883,11 @@ static void pull_pkg_args(struct cbprintf_state *state)
18781883
UNPACK_CAST_UINT_VALUE(state, unsigned short, int);
18791884
break;
18801885
case LENGTH_L:
1881-
UNPACK_CAST_UINT_VALUE(state, unsigned long);
1886+
if (conv->specifier == 'c') {
1887+
UNPACK_CAST_UINT_VALUE(state, wint_t);
1888+
} else {
1889+
UNPACK_CAST_UINT_VALUE(state, unsigned long);
1890+
}
18821891
break;
18831892
case LENGTH_LL:
18841893
UNPACK_CAST_UINT_VALUE(state, unsigned long long);

0 commit comments

Comments
 (0)