* libc/stdio/vfprintf.c (_VFPRINTF_R): Avoid multibyte when not

_MB_CAPABLE.
This commit is contained in:
Eric Blake 2007-04-24 19:55:28 +00:00
parent 68f2517f72
commit 27e5e9ab05
2 changed files with 22 additions and 14 deletions

View File

@ -1,5 +1,8 @@
2007-04-24 Eric Blake <ebb9@byu.net>
* libc/stdio/vfprintf.c (_VFPRINTF_R): Avoid multibyte when not
_MB_CAPABLE.
* libc/include/limits.h (NL_ARGMAX): Define a default value.
* libc/stdio/vfprintf.c (MAX_POS_ARGS): Define in terms of
NL_ARGMAX, if present.

View File

@ -161,14 +161,14 @@ static char *rcsid = "$Id$";
#include <newlib.h>
#ifdef INTEGER_ONLY
#define VFPRINTF vfiprintf
#define _VFPRINTF_R _vfiprintf_r
# define VFPRINTF vfiprintf
# define _VFPRINTF_R _vfiprintf_r
#else
#define VFPRINTF vfprintf
#define _VFPRINTF_R _vfprintf_r
#ifndef NO_FLOATING_POINT
#define FLOATING_POINT
#endif
# define VFPRINTF vfprintf
# define _VFPRINTF_R _vfprintf_r
# ifndef NO_FLOATING_POINT
# define FLOATING_POINT
# endif
#endif
#define _NO_POS_ARGS
@ -821,6 +821,7 @@ reswitch: switch (ch) {
case 'c':
case 'C':
cp = buf;
#ifdef _MB_CAPABLE
if (ch == 'C' || (flags & LONGINT)) {
mbstate_t ps;
@ -832,7 +833,9 @@ reswitch: switch (ch) {
goto error;
}
}
else {
else
#endif /* _MB_CAPABLE */
{
*cp = GET_ARG (N, ap, int);
size = 1;
}
@ -1010,6 +1013,7 @@ reswitch: switch (ch) {
cp = "(null)";
size = 6;
}
#ifdef _MB_CAPABLE
else if (ch == 'S' || (flags & LONGINT)) {
mbstate_t ps;
_CONST wchar_t *wcp;
@ -1066,6 +1070,7 @@ reswitch: switch (ch) {
cp = malloc_buf;
cp[size] = '\0';
}
#endif /* _MB_CAPABLE */
else if (prec >= 0) {
/*
* can't use strlen; can only look for the