diff options
Diffstat (limited to 'newlib/libc/stdio/vfscanf.c')
-rw-r--r-- | newlib/libc/stdio/vfscanf.c | 28 |
1 files changed, 5 insertions, 23 deletions
diff --git a/newlib/libc/stdio/vfscanf.c b/newlib/libc/stdio/vfscanf.c index 4788938c9..621ea23aa 100644 --- a/newlib/libc/stdio/vfscanf.c +++ b/newlib/libc/stdio/vfscanf.c @@ -37,8 +37,8 @@ ANSI_SYNOPSIS va_list <[list]>); int _vfscanf_r(struct _reent *<[reent]>, FILE *<[fp]>, const char *<[fmt]>, va_list <[list]>); - int _vsscanf_r(struct _reent *<[reent]>, const char *<[str]>, - const char *<[fmt]>, va_list <[list]>); + int _vsscanf_r(struct _reent *<[reent]>, const char *<[str]>, const char *<[fmt]>, + va_list <[list]>); TRAD_SYNOPSIS #include <stdio.h> @@ -1050,8 +1050,7 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap), case 'n': case 'N': if (nancount == 0 - && (flags & (SIGNOK | NDIGITS | DPTOK | EXPOK)) == - (SIGNOK | NDIGITS | DPTOK | EXPOK)) + && (flags & (SIGNOK | NDIGITS | DPTOK | EXPOK))) { flags &= ~(SIGNOK | DPTOK | EXPOK | NDIGITS); nancount = 1; @@ -1112,24 +1111,7 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap), } if (zeroes) flags &= ~NDIGITS; - /* We may have a 'N' or possibly even a 'Na' as the start of 'NaN', - only to run out of chars before it was complete (or having - encountered a non- matching char). So check here if we have an - outstanding nancount, and if so put back the chars we did - swallow and treat as a failed match. */ - if (nancount && nancount != 3) - { - /* Ok... what are we supposed to do in the event that the - __srefill call above was triggered in the middle of the partial - 'NaN' and so we can't put it all back? */ - while (nancount-- && (p > buf)) - { - ungetc (*(u_char *)--p, fp); - --nread; - } - goto match_failure; - } - /* + /* * If no digits, might be missing exponent digits * (just give back the exponent) or might be missing * regular digits, but had sign and/or decimal point. @@ -1141,7 +1123,7 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap), /* no digits at all */ while (p > buf) { - ungetc (*(u_char *)--p, fp); + ungetc (*(u_char *)-- p, fp); --nread; } goto match_failure; |