X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fstdio%2Fvfwscanf.c;h=82f4860441e5b41e52d2e27ddefb2fa1b50ecafb;hb=2404d9d643763e6eceafa9a1918925d80a84ad44;hp=1ebc5cef51882c822e29b2642dc42de705a3a342;hpb=733d1ea759119bcd0554f25034d1b4113b910900;p=musl diff --git a/src/stdio/vfwscanf.c b/src/stdio/vfwscanf.c index 1ebc5cef..82f48604 100644 --- a/src/stdio/vfwscanf.c +++ b/src/stdio/vfwscanf.c @@ -11,7 +11,6 @@ #include "shgetc.h" #include "intscan.h" #include "floatscan.h" -#include "libc.h" #define SIZE_hh -2 #define SIZE_h -1 @@ -77,7 +76,7 @@ static int in_set(const wchar_t *set, int c) #if 1 #undef getwc #define getwc(f) \ - ((f)->rpos < (f)->rend && *(f)->rpos < 128 ? *(f)->rpos++ : (getwc)(f)) + ((f)->rpos != (f)->rend && *(f)->rpos < 128 ? *(f)->rpos++ : (getwc)(f)) #undef ungetwc #define ungetwc(c,f) \ @@ -117,8 +116,12 @@ int vfwscanf(FILE *restrict f, const wchar_t *restrict fmt, va_list ap) continue; } if (*p != '%' || p[1] == '%') { - p += *p=='%'; - c = getwc(f); + if (*p == '%') { + p++; + while (iswspace((c=getwc(f)))) pos++; + } else { + c = getwc(f); + } if (c!=*p) { ungetwc(c, f); if (c<0) goto input_fail;