Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/newlib
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2007-04-24 23:55:28 +0400
committerEric Blake <eblake@redhat.com>2007-04-24 23:55:28 +0400
commit27e5e9ab052d525303f491b39d08eb1be060caae (patch)
treec152afb85a87f7ce5d8a30d520f8949c4b6d46a2 /newlib
parent68f2517f722ea38e90b9e0d3f22182e03a4354df (diff)
* libc/stdio/vfprintf.c (_VFPRINTF_R): Avoid multibyte when not
_MB_CAPABLE.
Diffstat (limited to 'newlib')
-rw-r--r--newlib/ChangeLog3
-rw-r--r--newlib/libc/stdio/vfprintf.c33
2 files changed, 22 insertions, 14 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog
index 00f01bda2..f569f8841 100644
--- a/newlib/ChangeLog
+++ b/newlib/ChangeLog
@@ -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.
diff --git a/newlib/libc/stdio/vfprintf.c b/newlib/libc/stdio/vfprintf.c
index 0f9f78bfe..eec0b5378 100644
--- a/newlib/libc/stdio/vfprintf.c
+++ b/newlib/libc/stdio/vfprintf.c
@@ -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,18 +821,21 @@ reswitch: switch (ch) {
case 'c':
case 'C':
cp = buf;
+#ifdef _MB_CAPABLE
if (ch == 'C' || (flags & LONGINT)) {
mbstate_t ps;
memset ((_PTR)&ps, '\0', sizeof (mbstate_t));
- if ((size = (int)_wcrtomb_r (data, cp,
- (wchar_t)GET_ARG (N, ap, wint_t),
- &ps)) == -1) {
+ if ((size = (int)_wcrtomb_r (data, cp,
+ (wchar_t)GET_ARG (N, ap, wint_t),
+ &ps)) == -1) {
fp->_flags |= __SERR;
goto error;
}
}
- else {
+ else
+#endif /* _MB_CAPABLE */
+ {
*cp = GET_ARG (N, ap, int);
size = 1;
}
@@ -1010,18 +1013,19 @@ reswitch: switch (ch) {
cp = "(null)";
size = 6;
}
+#ifdef _MB_CAPABLE
else if (ch == 'S' || (flags & LONGINT)) {
mbstate_t ps;
_CONST wchar_t *wcp;
-
+
wcp = (_CONST wchar_t *)cp;
size = m = 0;
memset ((_PTR)&ps, '\0', sizeof (mbstate_t));
-
+
/* Count number of bytes needed for multibyte
string that will be produced from widechar
string. */
- if (prec >= 0) {
+ if (prec >= 0) {
while (1) {
if (wcp[m] == L'\0')
break;
@@ -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