projects
/
musl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix %ls breakage in last printf fix
[musl]
/
src
/
stdio
/
vfprintf.c
diff --git
a/src/stdio/vfprintf.c
b/src/stdio/vfprintf.c
index
b5001ff
..
481436d
100644
(file)
--- a/
src/stdio/vfprintf.c
+++ b/
src/stdio/vfprintf.c
@@
-73,6
+73,8
@@
static const unsigned char states[]['z'-'A'+1] = {
}, { /* 1: l-prefixed */
S('d') = LONG, S('i') = LONG,
S('o') = ULONG, S('u') = ULONG, S('x') = ULONG, S('X') = ULONG,
}, { /* 1: l-prefixed */
S('d') = LONG, S('i') = LONG,
S('o') = ULONG, S('u') = ULONG, S('x') = ULONG, S('X') = ULONG,
+ S('e') = DBL, S('f') = DBL, S('g') = DBL, S('a') = DBL,
+ S('E') = DBL, S('F') = DBL, S('G') = DBL, S('A') = DBL,
S('c') = INT, S('s') = PTR, S('n') = PTR,
S('l') = LLPRE,
}, { /* 2: ll-prefixed */
S('c') = INT, S('s') = PTR, S('n') = PTR,
S('l') = LLPRE,
}, { /* 2: ll-prefixed */
@@
-597,12
+599,12
@@
static int printf_core(FILE *f, const char *fmt, va_list *ap, union arg *nl_arg,
p = -1;
case 'S':
ws = arg.p;
p = -1;
case 'S':
ws = arg.p;
- for (i=
0;
*ws && (l=wctomb(mb, *ws++))>=0 && l<=0U+p-i; i+=l);
+ for (i=
l=0; i<0U+p &&
*ws && (l=wctomb(mb, *ws++))>=0 && l<=0U+p-i; i+=l);
if (l<0) return -1;
p = i;
pad(f, ' ', w, p, fl);
ws = arg.p;
if (l<0) return -1;
p = i;
pad(f, ' ', w, p, fl);
ws = arg.p;
- for (i=0; *ws && i+(l=wctomb(mb, *ws++))<=p; i+=l)
+ for (i=0;
i<0U+p &&
*ws && i+(l=wctomb(mb, *ws++))<=p; i+=l)
out(f, mb, l);
pad(f, ' ', w, p, fl^LEFT_ADJ);
l = w>p ? w : p;
out(f, mb, l);
pad(f, ' ', w, p, fl^LEFT_ADJ);
l = w>p ? w : p;
@@
-650,8
+652,9
@@
int vfprintf(FILE *f, const char *fmt, va_list ap)
FLOCK(f);
if (!f->buf_size) {
saved_buf = f->buf;
FLOCK(f);
if (!f->buf_size) {
saved_buf = f->buf;
- f->buf = internal_buf;
+ f->
wpos = f->wbase = f->
buf = internal_buf;
f->buf_size = sizeof internal_buf;
f->buf_size = sizeof internal_buf;
+ f->wend = internal_buf + sizeof internal_buf;
}
ret = printf_core(f, fmt, &ap2, nl_arg, nl_type);
if (saved_buf) {
}
ret = printf_core(f, fmt, &ap2, nl_arg, nl_type);
if (saved_buf) {