From d055e6a45a17673b8dd3ec16e786bb2fe1700dd5 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Mon, 20 Mar 2023 13:48:50 -0400 Subject: fix wide printf forms ignoring width for %lc format specifier since the code path for %c was already doing it right, and the logic is identical, condense them into a single case. --- src/stdio/vfwprintf.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/stdio') diff --git a/src/stdio/vfwprintf.c b/src/stdio/vfwprintf.c index 85b036c3..e69a2d5e 100644 --- a/src/stdio/vfwprintf.c +++ b/src/stdio/vfwprintf.c @@ -258,16 +258,13 @@ static int wprintf_core(FILE *f, const wchar_t *fmt, va_list *ap, union arg *nl_ } continue; case 'c': + case 'C': if (w<1) w=1; if (w>1 && !(fl&LEFT_ADJ)) fprintf(f, "%*s", w-1, ""); - fputwc(btowc(arg.i), f); + fputwc(t=='C' ? arg.i : btowc(arg.i), f); if (w>1 && (fl&LEFT_ADJ)) fprintf(f, "%*s", w-1, ""); l = w; continue; - case 'C': - fputwc(arg.i, f); - l = 1; - continue; case 'S': a = arg.p; z = a + wcsnlen(a, p<0 ? INT_MAX : p); -- cgit v1.2.1