From 9876b0b6156fb851583a5304429bfed46b2ed9ba Mon Sep 17 00:00:00 2001 From: guoshichao Date: Thu, 25 Apr 2024 19:10:14 +0800 Subject: [PATCH] wchar/fgetwc: fix the return value truncate error Signed-off-by: guoshichao --- libs/libc/stdio/lib_fgetwc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libs/libc/stdio/lib_fgetwc.c b/libs/libc/stdio/lib_fgetwc.c index 90b451a6c9..463669fde0 100644 --- a/libs/libc/stdio/lib_fgetwc.c +++ b/libs/libc/stdio/lib_fgetwc.c @@ -69,7 +69,8 @@ wint_t fgetwc_unlocked(FAR FILE *f) while (l == -2) { - b = c = getc_unlocked(f); + c = getc_unlocked(f); + b = (char)c; if (c < 0) { if (!mbsinit(&st))