Update of /cvsroot/linux-vax/uClibc/libc/stdio
In directory sc8-pr-cvs1:/tmp/cvs-serv11242/libc/stdio
Modified Files:
printf.c
Log Message:
DA: merge up 0.9.23
Index: printf.c
===================================================================
RCS file: /cvsroot/linux-vax/uClibc/libc/stdio/printf.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- printf.c 27 Sep 2003 14:46:21 -0000 1.4
+++ printf.c 26 Nov 2003 11:36:35 -0000 1.5
@@ -75,6 +75,9 @@
*
* Sep 5, 2003
* Implement *s*scanf for the non-buffered stdio case with old_vfprintf.
+ *
+ * Sep 23, 2003
+ * vfprintf was not always checking for narrow stream orientation.
*/
/* TODO:
@@ -3204,6 +3207,18 @@
count = 0;
s = format;
+#if defined(L_vfprintf) && defined(__UCLIBC_HAS_WCHAR__)
+ /* Sigh... I forgot that by calling _stdio_fwrite, vfprintf doesn't
+ * always check the stream's orientation. This is just a temporary
+ * fix until I rewrite the stdio core work routines. */
+ if (stream->modeflags & __FLAG_WIDE) {
+ stream->modeflags |= __FLAG_ERROR;
+ count = -1;
+ goto DONE;
+ }
+ stream->modeflags |= __FLAG_NARROW;
+#endif
+
if (_PPFS_init(&ppfs, format) < 0) { /* Bad format string. */
OUTNSTR(stream, (const FMT_TYPE *) ppfs.fmtpos,
STRLEN((const FMT_TYPE *)(ppfs.fmtpos)));
@@ -3248,6 +3263,10 @@
va_end(ppfs.arg); /* Need to clean up after va_copy! */
}
+
+#if defined(L_vfprintf) && defined(__UCLIBC_HAS_WCHAR__)
+ DONE:
+#endif
__STDIO_THREADUNLOCK(stream);
|