1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00
2001-08-06  Jakub Jelinek  <jakub@redhat.com>

	* stdlib/strtod.c (STRTOF): Skip whole infinity, not just inf.
	* stdio-common/vfscanf.c (__vfscanf): +- can be followed by i in +-Inf.

	* stdlib/tst-strtod.c (tests): Add Inf tests.
	* stdio-common/tstscanf.c (main): Add tests for +- before Inf.

	* locale/weightwc.h (findidx): Change type of i to int32_t.
This commit is contained in:
Ulrich Drepper
2001-08-07 04:37:18 +00:00
parent 70808a9bc6
commit a529b41620
6 changed files with 41 additions and 8 deletions

View File

@ -573,15 +573,14 @@ INTERNAL (STRTOF) (nptr, endptr, group LOCALE_PARAM)
#endif
else if (c < L_('0') || c > L_('9'))
{
int matched = 0;
/* Check for `INF' or `INFINITY'. */
if (TOLOWER (c) == L_('i')
&& ((STRNCASECMP (cp, L_("inf"), 3) == 0 && (matched = 3))
|| (STRNCASECMP (cp, L_("infinity"), 8) == 0 && (matched = 8))))
if (TOLOWER (c) == L_('i') && STRNCASECMP (cp, L_("inf"), 3) == 0)
{
/* Return +/- infinity. */
if (endptr != NULL)
*endptr = (STRING_TYPE *) (cp + matched);
*endptr = (STRING_TYPE *)
(cp + (STRNCASECMP (cp + 3, L_("inity"), 5) == 0
? 8 : 3));
return negative ? -FLOAT_HUGE_VAL : FLOAT_HUGE_VAL;
}