2008-10-15 Jeff Johnston <jjohnstn@redhat.com>
* libc/stdio/vfscanf.c (__ssvfiscanf_r): Do not support %lc, %C, %ls or %S conversions when the EL/IX level is 1.
This commit is contained in:
parent
206473437f
commit
236e5c4017
|
@ -1,3 +1,8 @@
|
||||||
|
2008-10-15 Jeff Johnston <jjohnstn@redhat.com>
|
||||||
|
|
||||||
|
* libc/stdio/vfscanf.c (__ssvfiscanf_r): Do not support %lc, %C, %ls or
|
||||||
|
%S conversions when the EL/IX level is 1.
|
||||||
|
|
||||||
2008-10-06 Eric Blake <ebb9@byu.net>
|
2008-10-06 Eric Blake <ebb9@byu.net>
|
||||||
|
|
||||||
* libc/stdlib/ldtoa.c (etoasc): Fix rounding to even when fraction
|
* libc/stdlib/ldtoa.c (etoasc): Fix rounding to even when fraction
|
||||||
|
|
|
@ -33,9 +33,9 @@ ANSI_SYNOPSIS
|
||||||
int vfscanf(FILE *<[fp]>, const char *<[fmt]>, va_list <[list]>);
|
int vfscanf(FILE *<[fp]>, const char *<[fmt]>, va_list <[list]>);
|
||||||
int vsscanf(const char *<[str]>, const char *<[fmt]>, va_list <[list]>);
|
int vsscanf(const char *<[str]>, const char *<[fmt]>, va_list <[list]>);
|
||||||
|
|
||||||
int _vscanf_r(struct _reent *<[reent]>, const char *<[fmt]>,
|
int _vscanf_r(struct _reent *<[reent]>, const char *<[fmt]>,
|
||||||
va_list <[list]>);
|
va_list <[list]>);
|
||||||
int _vfscanf_r(struct _reent *<[reent]>, FILE *<[fp]>, const char *<[fmt]>,
|
int _vfscanf_r(struct _reent *<[reent]>, FILE *<[fp]>, const char *<[fmt]>,
|
||||||
va_list <[list]>);
|
va_list <[list]>);
|
||||||
int _vsscanf_r(struct _reent *<[reent]>, const char *<[str]>,
|
int _vsscanf_r(struct _reent *<[reent]>, const char *<[str]>,
|
||||||
const char *<[fmt]>, va_list <[list]>);
|
const char *<[fmt]>, va_list <[list]>);
|
||||||
|
@ -51,7 +51,7 @@ TRAD_SYNOPSIS
|
||||||
FILE *<[fp]>;
|
FILE *<[fp]>;
|
||||||
char *<[fmt]>;
|
char *<[fmt]>;
|
||||||
va_list <[list]>;
|
va_list <[list]>;
|
||||||
|
|
||||||
int vsscanf( <[str]>, <[fmt]>, <[list]>)
|
int vsscanf( <[str]>, <[fmt]>, <[list]>)
|
||||||
char *<[str]>;
|
char *<[str]>;
|
||||||
char *<[fmt]>;
|
char *<[fmt]>;
|
||||||
|
@ -67,7 +67,7 @@ TRAD_SYNOPSIS
|
||||||
FILE *<[fp]>;
|
FILE *<[fp]>;
|
||||||
char *<[fmt]>;
|
char *<[fmt]>;
|
||||||
va_list <[list]>;
|
va_list <[list]>;
|
||||||
|
|
||||||
int _vsscanf_r( <[reent]>, <[str]>, <[fmt]>, <[list]>)
|
int _vsscanf_r( <[reent]>, <[str]>, <[fmt]>, <[list]>)
|
||||||
struct _reent *<[reent]>;
|
struct _reent *<[reent]>;
|
||||||
char *<[str]>;
|
char *<[str]>;
|
||||||
|
@ -76,18 +76,18 @@ TRAD_SYNOPSIS
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
<<vscanf>>, <<vfscanf>>, and <<vsscanf>> are (respectively) variants
|
<<vscanf>>, <<vfscanf>>, and <<vsscanf>> are (respectively) variants
|
||||||
of <<scanf>>, <<fscanf>>, and <<sscanf>>. They differ only in
|
of <<scanf>>, <<fscanf>>, and <<sscanf>>. They differ only in
|
||||||
allowing their caller to pass the variable argument list as a
|
allowing their caller to pass the variable argument list as a
|
||||||
<<va_list>> object (initialized by <<va_start>>) rather than
|
<<va_list>> object (initialized by <<va_start>>) rather than
|
||||||
directly accepting a variable number of arguments.
|
directly accepting a variable number of arguments.
|
||||||
|
|
||||||
RETURNS
|
RETURNS
|
||||||
The return values are consistent with the corresponding functions:
|
The return values are consistent with the corresponding functions:
|
||||||
<<vscanf>> returns the number of input fields successfully scanned,
|
<<vscanf>> returns the number of input fields successfully scanned,
|
||||||
converted, and stored; the return value does not include scanned
|
converted, and stored; the return value does not include scanned
|
||||||
fields which were not stored.
|
fields which were not stored.
|
||||||
|
|
||||||
If <<vscanf>> attempts to read at end-of-file, the return value
|
If <<vscanf>> attempts to read at end-of-file, the return value
|
||||||
is <<EOF>>.
|
is <<EOF>>.
|
||||||
|
|
||||||
If no fields were stored, the return value is <<0>>.
|
If no fields were stored, the return value is <<0>>.
|
||||||
|
@ -257,9 +257,9 @@ typedef unsigned long long u_long_long;
|
||||||
#ifndef _REENT_ONLY
|
#ifndef _REENT_ONLY
|
||||||
|
|
||||||
int
|
int
|
||||||
_DEFUN(VFSCANF, (fp, fmt, ap),
|
_DEFUN(VFSCANF, (fp, fmt, ap),
|
||||||
register FILE *fp _AND
|
register FILE *fp _AND
|
||||||
_CONST char *fmt _AND
|
_CONST char *fmt _AND
|
||||||
va_list ap)
|
va_list ap)
|
||||||
{
|
{
|
||||||
CHECK_INIT(_REENT, fp);
|
CHECK_INIT(_REENT, fp);
|
||||||
|
@ -279,9 +279,9 @@ _DEFUN(__SVFSCANF, (fp, fmt0, ap),
|
||||||
|
|
||||||
int
|
int
|
||||||
_DEFUN(_VFSCANF_R, (data, fp, fmt, ap),
|
_DEFUN(_VFSCANF_R, (data, fp, fmt, ap),
|
||||||
struct _reent *data _AND
|
struct _reent *data _AND
|
||||||
register FILE *fp _AND
|
register FILE *fp _AND
|
||||||
_CONST char *fmt _AND
|
_CONST char *fmt _AND
|
||||||
va_list ap)
|
va_list ap)
|
||||||
{
|
{
|
||||||
CHECK_INIT(data, fp);
|
CHECK_INIT(data, fp);
|
||||||
|
@ -376,8 +376,8 @@ _DEFUN(__ssrefill_r, (ptr, fp),
|
||||||
fp->_flags &= ~__SMOD; /* buffer contents are again pristine */
|
fp->_flags &= ~__SMOD; /* buffer contents are again pristine */
|
||||||
fp->_flags |= __SEOF;
|
fp->_flags |= __SEOF;
|
||||||
return EOF;
|
return EOF;
|
||||||
}
|
}
|
||||||
|
|
||||||
static size_t
|
static size_t
|
||||||
_DEFUN(_sfread_r, (ptr, buf, size, count, fp),
|
_DEFUN(_sfread_r, (ptr, buf, size, count, fp),
|
||||||
struct _reent * ptr _AND
|
struct _reent * ptr _AND
|
||||||
|
@ -486,7 +486,7 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap),
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
_flockfile (fp);
|
_flockfile (fp);
|
||||||
|
|
||||||
nassigned = 0;
|
nassigned = 0;
|
||||||
nread = 0;
|
nread = 0;
|
||||||
for (;;)
|
for (;;)
|
||||||
|
@ -822,14 +822,15 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap),
|
||||||
/* scan arbitrary characters (sets NOSKIP) */
|
/* scan arbitrary characters (sets NOSKIP) */
|
||||||
if (width == 0)
|
if (width == 0)
|
||||||
width = 1;
|
width = 1;
|
||||||
if (flags & LONG)
|
#if !defined(_ELIX_LEVEL) || _ELIX_LEVEL >= 2
|
||||||
|
if (flags & LONG)
|
||||||
{
|
{
|
||||||
if ((flags & SUPPRESS) == 0)
|
if ((flags & SUPPRESS) == 0)
|
||||||
wcp = GET_ARG (N, ap, wchar_t *);
|
wcp = GET_ARG (N, ap, wchar_t *);
|
||||||
else
|
else
|
||||||
wcp = NULL;
|
wcp = NULL;
|
||||||
n = 0;
|
n = 0;
|
||||||
while (width != 0)
|
while (width != 0)
|
||||||
{
|
{
|
||||||
if (n == MB_CUR_MAX)
|
if (n == MB_CUR_MAX)
|
||||||
goto input_failure;
|
goto input_failure;
|
||||||
|
@ -837,7 +838,7 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap),
|
||||||
fp->_r -= 1;
|
fp->_r -= 1;
|
||||||
fp->_p += 1;
|
fp->_p += 1;
|
||||||
memset ((_PTR)&state, '\0', sizeof (mbstate_t));
|
memset ((_PTR)&state, '\0', sizeof (mbstate_t));
|
||||||
if ((mbslen = _mbrtowc_r (rptr, wcp, buf, n, &state))
|
if ((mbslen = _mbrtowc_r (rptr, wcp, buf, n, &state))
|
||||||
== (size_t)-1)
|
== (size_t)-1)
|
||||||
goto input_failure; /* Invalid sequence */
|
goto input_failure; /* Invalid sequence */
|
||||||
if (mbslen == 0 && !(flags & SUPPRESS))
|
if (mbslen == 0 && !(flags & SUPPRESS))
|
||||||
|
@ -850,17 +851,19 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap),
|
||||||
wcp += 1;
|
wcp += 1;
|
||||||
n = 0;
|
n = 0;
|
||||||
}
|
}
|
||||||
if (BufferEmpty)
|
if (BufferEmpty)
|
||||||
{
|
{
|
||||||
if (n != 0)
|
if (n != 0)
|
||||||
goto input_failure;
|
goto input_failure;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!(flags & SUPPRESS))
|
if (!(flags & SUPPRESS))
|
||||||
nassigned++;
|
nassigned++;
|
||||||
}
|
}
|
||||||
else if (flags & SUPPRESS)
|
else
|
||||||
|
#endif
|
||||||
|
if (flags & SUPPRESS)
|
||||||
{
|
{
|
||||||
size_t sum = 0;
|
size_t sum = 0;
|
||||||
for (;;)
|
for (;;)
|
||||||
|
@ -950,7 +953,8 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap),
|
||||||
/* like CCL, but zero-length string OK, & no NOSKIP */
|
/* like CCL, but zero-length string OK, & no NOSKIP */
|
||||||
if (width == 0)
|
if (width == 0)
|
||||||
width = (size_t)~0;
|
width = (size_t)~0;
|
||||||
if (flags & LONG)
|
#if !defined(_ELIX_LEVEL) || _ELIX_LEVEL >= 2
|
||||||
|
if (flags & LONG)
|
||||||
{
|
{
|
||||||
/* Process %S and %ls placeholders */
|
/* Process %S and %ls placeholders */
|
||||||
if ((flags & SUPPRESS) == 0)
|
if ((flags & SUPPRESS) == 0)
|
||||||
|
@ -958,7 +962,7 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap),
|
||||||
else
|
else
|
||||||
wcp = &wc;
|
wcp = &wc;
|
||||||
n = 0;
|
n = 0;
|
||||||
while (!isspace (*fp->_p) && width != 0)
|
while (!isspace (*fp->_p) && width != 0)
|
||||||
{
|
{
|
||||||
if (n == MB_CUR_MAX)
|
if (n == MB_CUR_MAX)
|
||||||
goto input_failure;
|
goto input_failure;
|
||||||
|
@ -966,7 +970,7 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap),
|
||||||
fp->_r -= 1;
|
fp->_r -= 1;
|
||||||
fp->_p += 1;
|
fp->_p += 1;
|
||||||
memset ((_PTR)&state, '\0', sizeof (mbstate_t));
|
memset ((_PTR)&state, '\0', sizeof (mbstate_t));
|
||||||
if ((mbslen = _mbrtowc_r (rptr, wcp, buf, n, &state))
|
if ((mbslen = _mbrtowc_r (rptr, wcp, buf, n, &state))
|
||||||
== (size_t)-1)
|
== (size_t)-1)
|
||||||
goto input_failure;
|
goto input_failure;
|
||||||
if (mbslen == 0)
|
if (mbslen == 0)
|
||||||
|
@ -985,20 +989,22 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap),
|
||||||
wcp += 1;
|
wcp += 1;
|
||||||
n = 0;
|
n = 0;
|
||||||
}
|
}
|
||||||
if (BufferEmpty)
|
if (BufferEmpty)
|
||||||
{
|
{
|
||||||
if (n != 0)
|
if (n != 0)
|
||||||
goto input_failure;
|
goto input_failure;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!(flags & SUPPRESS))
|
if (!(flags & SUPPRESS))
|
||||||
{
|
{
|
||||||
*wcp = L'\0';
|
*wcp = L'\0';
|
||||||
nassigned++;
|
nassigned++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (flags & SUPPRESS)
|
else
|
||||||
|
#endif
|
||||||
|
if (flags & SUPPRESS)
|
||||||
{
|
{
|
||||||
n = 0;
|
n = 0;
|
||||||
while (!isspace (*fp->_p))
|
while (!isspace (*fp->_p))
|
||||||
|
@ -1524,7 +1530,7 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap),
|
||||||
sprintf (exp_start, "e%ld", new_exp);
|
sprintf (exp_start, "e%ld", new_exp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Current _strtold routine is markedly slower than
|
/* Current _strtold routine is markedly slower than
|
||||||
_strtod_r. Only use it if we have a long double
|
_strtod_r. Only use it if we have a long double
|
||||||
result. */
|
result. */
|
||||||
#ifndef _NO_LONGDBL /* !_NO_LONGDBL */
|
#ifndef _NO_LONGDBL /* !_NO_LONGDBL */
|
||||||
|
|
Loading…
Reference in New Issue