about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2023-03-20 13:48:50 -0400
committerRich Felker <dalias@aerifal.cx>2023-03-20 13:48:50 -0400
commitd055e6a45a17673b8dd3ec16e786bb2fe1700dd5 (patch)
tree1452f24f43ecddfa709af92097bab3cadca7086f /src
parentb6811019e62a7561a4922f90e54b30ac306efe0b (diff)
downloadmusl-d055e6a45a17673b8dd3ec16e786bb2fe1700dd5.tar.gz
musl-d055e6a45a17673b8dd3ec16e786bb2fe1700dd5.tar.xz
musl-d055e6a45a17673b8dd3ec16e786bb2fe1700dd5.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/stdio/vfwprintf.c7
1 files changed, 2 insertions, 5 deletions
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);