mirror of
git://sourceware.org/git/glibc.git
synced 2024-11-27 03:41:23 +08:00
Update.
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:
parent
70808a9bc6
commit
a529b41620
10
ChangeLog
10
ChangeLog
@ -1,5 +1,15 @@
|
|||||||
|
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.
|
||||||
|
|
||||||
2001-08-06 Ulrich Drepper <drepper@redhat.com>
|
2001-08-06 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
* locale/weightwc.h (findidx): Change type of i to int32_t.
|
||||||
|
|
||||||
* wcsmbs/wcsmbs-tst1.c (main): Avoid warning. Pretty printing.
|
* wcsmbs/wcsmbs-tst1.c (main): Avoid warning. Pretty printing.
|
||||||
|
|
||||||
2001-08-05 Roland McGrath <roland@frob.com>
|
2001-08-05 Roland McGrath <roland@frob.com>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
|
/* Copyright (C) 1996-2000, 2001 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Written by Ulrich Drepper, <drepper@cygnus.com>.
|
Written by Ulrich Drepper, <drepper@cygnus.com>.
|
||||||
|
|
||||||
@ -21,7 +21,7 @@
|
|||||||
static inline int32_t
|
static inline int32_t
|
||||||
findidx (const wint_t **cpp)
|
findidx (const wint_t **cpp)
|
||||||
{
|
{
|
||||||
int_fast32_t i;
|
int32_t i;
|
||||||
const wint_t *cp;
|
const wint_t *cp;
|
||||||
wint_t ch;
|
wint_t ch;
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#else
|
#else
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#endif
|
#endif
|
||||||
|
#include <math.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -331,6 +332,25 @@ main (int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fputs ("Test 13:\n", stdout);
|
||||||
|
{
|
||||||
|
float value;
|
||||||
|
int res;
|
||||||
|
|
||||||
|
res = sscanf ("-InF", "%f", &value);
|
||||||
|
if (res != 1 || isinf (value) != -1)
|
||||||
|
{
|
||||||
|
fputs ("test failed!\n", stdout);
|
||||||
|
result = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
res = sscanf ("+InfiNiTY", "%f", &value);
|
||||||
|
if (res != 1 || isinf (value) != 1)
|
||||||
|
{
|
||||||
|
fputs ("test failed!\n", stdout);
|
||||||
|
result = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -1604,7 +1604,7 @@ __vfscanf (FILE *s, const char *format, va_list argptr)
|
|||||||
if (width == 0 || inchar () == EOF)
|
if (width == 0 || inchar () == EOF)
|
||||||
/* EOF is only an input error before we read any chars. */
|
/* EOF is only an input error before we read any chars. */
|
||||||
conv_error ();
|
conv_error ();
|
||||||
if (! ISDIGIT (c))
|
if (! ISDIGIT (c) && TOLOWER (c) != L_('i'))
|
||||||
{
|
{
|
||||||
#ifdef COMPILE_WSCANF
|
#ifdef COMPILE_WSCANF
|
||||||
if (c != decimal)
|
if (c != decimal)
|
||||||
|
@ -573,15 +573,14 @@ INTERNAL (STRTOF) (nptr, endptr, group LOCALE_PARAM)
|
|||||||
#endif
|
#endif
|
||||||
else if (c < L_('0') || c > L_('9'))
|
else if (c < L_('0') || c > L_('9'))
|
||||||
{
|
{
|
||||||
int matched = 0;
|
|
||||||
/* Check for `INF' or `INFINITY'. */
|
/* Check for `INF' or `INFINITY'. */
|
||||||
if (TOLOWER (c) == L_('i')
|
if (TOLOWER (c) == L_('i') && STRNCASECMP (cp, L_("inf"), 3) == 0)
|
||||||
&& ((STRNCASECMP (cp, L_("inf"), 3) == 0 && (matched = 3))
|
|
||||||
|| (STRNCASECMP (cp, L_("infinity"), 8) == 0 && (matched = 8))))
|
|
||||||
{
|
{
|
||||||
/* Return +/- infinity. */
|
/* Return +/- infinity. */
|
||||||
if (endptr != NULL)
|
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;
|
return negative ? -FLOAT_HUGE_VAL : FLOAT_HUGE_VAL;
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
struct ltest
|
struct ltest
|
||||||
{
|
{
|
||||||
@ -64,6 +65,9 @@ static const struct ltest tests[] =
|
|||||||
{ "0x0.8p-1022",
|
{ "0x0.8p-1022",
|
||||||
1.11253692925360069154511635866620203210960799023116591527666e-308,
|
1.11253692925360069154511635866620203210960799023116591527666e-308,
|
||||||
'\0', 0 },
|
'\0', 0 },
|
||||||
|
{ "Inf", HUGE_VAL, '\0', 0 },
|
||||||
|
{ "-Inf", -HUGE_VAL, '\0', 0 },
|
||||||
|
{ "+InFiNiTy", HUGE_VAL, '\0', 0 },
|
||||||
{ NULL, 0, '\0', 0 }
|
{ NULL, 0, '\0', 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user