2005-04-05 Dave Korn <dave.korn@artimi.com>
* libc/stdio/vfscanf.c (__svfscanf_r): If an error occurs processing something that looks like a "NaN", put back the characters processed.
This commit is contained in:
parent
42aa06a575
commit
85da703991
@ -1,3 +1,8 @@
|
|||||||
|
2005-04-05 Dave Korn <dave.korn@artimi.com>
|
||||||
|
|
||||||
|
* libc/stdio/vfscanf.c (__svfscanf_r): If an error occurs processing
|
||||||
|
something that looks like a "NaN", put back the characters processed.
|
||||||
|
|
||||||
2005-04-01 Corinna Vinschen <corinna@vinschen.de>
|
2005-04-01 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* libc/stdlib/strtod.c (_strtod_r): Never change s00.
|
* libc/stdlib/strtod.c (_strtod_r): Never change s00.
|
||||||
|
@ -1111,6 +1111,23 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap),
|
|||||||
}
|
}
|
||||||
if (zeroes)
|
if (zeroes)
|
||||||
flags &= ~NDIGITS;
|
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
|
* If no digits, might be missing exponent digits
|
||||||
* (just give back the exponent) or might be missing
|
* (just give back the exponent) or might be missing
|
||||||
@ -1123,7 +1140,7 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap),
|
|||||||
/* no digits at all */
|
/* no digits at all */
|
||||||
while (p > buf)
|
while (p > buf)
|
||||||
{
|
{
|
||||||
ungetc (*(u_char *)-- p, fp);
|
ungetc (*(u_char *)--p, fp);
|
||||||
--nread;
|
--nread;
|
||||||
}
|
}
|
||||||
goto match_failure;
|
goto match_failure;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user