X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fstdio%2Fvfprintf.c;h=b5001ff2bd05ab6599ca3763f0be27911f0022b9;hb=fe514951af4e67f05d17d796251af9a8229761eb;hp=f19058d3c0cb04a97ca81c0befec93c838cab172;hpb=e514228043c2618f925bcfe8db71b0ff4e2b2113;p=musl diff --git a/src/stdio/vfprintf.c b/src/stdio/vfprintf.c index f19058d3..b5001ff2 100644 --- a/src/stdio/vfprintf.c +++ b/src/stdio/vfprintf.c @@ -326,9 +326,10 @@ static int fmt_fp(FILE *f, long double y, int w, int p, int fl, int t) if (x || d+1!=z) { long double round = CONCAT(0x1p,LDBL_MANT_DIG); long double small; - if (x>4), pl=2; + if (arg.i && (fl & ALT_FORM)) prefix+=(t>>4), pl=2; if (0) { case 'o': a = fmt_o(arg.i, z); @@ -569,8 +570,11 @@ static int printf_core(FILE *f, const char *fmt, va_list *ap, union arg *nl_arg, case 'u': a = fmt_u(arg.i, z); } - if (!arg.i && !p) continue; if (p>=0) fl &= ~ZERO_PAD; + if (!arg.i && !p) { + a=z; + break; + } p = MAX(p, z-a + !arg.i); break; case 'c': @@ -580,7 +584,7 @@ static int printf_core(FILE *f, const char *fmt, va_list *ap, union arg *nl_arg, case 'm': if (1) a = strerror(errno); else case 's': - a = arg.p; + a = arg.p ? arg.p : "(null)"; z = memchr(a, 0, p); if (!z) z=a+p; else p=z-a;