X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fstdio%2Fvfwprintf.c;h=c6400591a01ac7d6e257721eb0ed19b4f3a5a556;hb=59549313d85fa9a0168ff8164cfe734255585f46;hp=62829806b10386a908296b3bef602bc49ac50f15;hpb=db4096c5f2ffb15e52015004ab5a900b820c6683;p=musl diff --git a/src/stdio/vfwprintf.c b/src/stdio/vfwprintf.c index 62829806..c6400591 100644 --- a/src/stdio/vfwprintf.c +++ b/src/stdio/vfwprintf.c @@ -1,4 +1,11 @@ #include "stdio_impl.h" +#include +#include +#include +#include +#include +#include +#include /* Convenient bit representation for modifier flags, which all fall * within 31 codepoints of the space character. */ @@ -160,7 +167,7 @@ static const char sizeprefix['y'-'a'] = { static int wprintf_core(FILE *f, const wchar_t *fmt, va_list *ap, union arg *nl_arg, int *nl_type) { - wchar_t *a, *z, *s=(wchar_t *)fmt, *s0; + wchar_t *a, *z, *s=(wchar_t *)fmt; unsigned l10n=0, litpct, fl; int w, p; union arg arg; @@ -235,7 +242,6 @@ static int wprintf_core(FILE *f, const wchar_t *fmt, va_list *ap, union arg *nl_ } else p = -1; /* Format specifier state machine */ - s0=s; st=0; do { if (OOB(*s)) return -1; @@ -247,7 +253,6 @@ static int wprintf_core(FILE *f, const wchar_t *fmt, va_list *ap, union arg *nl_ /* Check validity of argument type (nl/normal) */ if (st==NOARG) { if (argpos>=0) return -1; - else if (!f) continue; } else { if (argpos>=0) nl_type[argpos]=st, arg=nl_arg[argpos]; else if (f) pop_arg(&arg, st, ap); @@ -281,8 +286,7 @@ static int wprintf_core(FILE *f, const wchar_t *fmt, va_list *ap, union arg *nl_ case 'S': a = arg.p; z = wmemchr(a, 0, p); - if (!z) z=a+p; - else p=z-a; + if (z) p=z-a; if (wmode |= f->mode+1; ret = wprintf_core(f, fmt, &ap2, nl_arg, nl_type); FUNLOCK(f); va_end(ap2);