Update.
authorUlrich Drepper <drepper@redhat.com>
Mon, 16 Aug 1999 01:21:50 +0000 (01:21 +0000)
committerUlrich Drepper <drepper@redhat.com>
Mon, 16 Aug 1999 01:21:50 +0000 (01:21 +0000)
1999-08-10  H.J. Lu  <hjl@gnu.org>

* stdio-common/vfprintf.c (ORIENT): Check for the old stream.
(vfprintf): Likewise.
* stdio-common/vfscanf.c (ORIENT): Likewise.
* libio/genops.c (__underflow): Likewise.
(__uflow): Likewise.
* libio/iofputs.c (_IO_fputs): Likewise.
* libio/ioftell.c (_IO_ftell): Likewise.
* libio/iofwrite.c (_IO_fwrite): Likewise.
* libio/ioputs.c (_IO_puts): Likewise.
* libio/iosetbuffer.c (_IO_setbuffer): Likewise.
* libio/iosetvbuf.c (_IO_setvbuf): Likewise.

ChangeLog
libio/genops.c
libio/iofputs.c
libio/ioftell.c
libio/iofwrite.c
libio/ioputs.c
libio/iosetbuffer.c
libio/iosetvbuf.c
stdio-common/vfprintf.c
stdio-common/vfscanf.c

index 1890744..acbb1e1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+1999-08-10  H.J. Lu  <hjl@gnu.org>
+
+       * stdio-common/vfprintf.c (ORIENT): Check for the old stream.
+       (vfprintf): Likewise.
+       * stdio-common/vfscanf.c (ORIENT): Likewise.
+       * libio/genops.c (__underflow): Likewise.
+       (__uflow): Likewise.
+       * libio/iofputs.c (_IO_fputs): Likewise.
+       * libio/ioftell.c (_IO_ftell): Likewise.
+       * libio/iofwrite.c (_IO_fwrite): Likewise.
+       * libio/ioputs.c (_IO_puts): Likewise.
+       * libio/iosetbuffer.c (_IO_setbuffer): Likewise.
+       * libio/iosetvbuf.c (_IO_setvbuf): Likewise.
+
 1999-08-15  Ulrich Drepper  <drepper@cygnus.com>
 
        * iconv/gconv_builtin.h: Add ISO registry alias for UTF8.
index 07dc4e8..a8fce5f 100644 (file)
@@ -282,7 +282,7 @@ int
 __underflow (fp)
      _IO_FILE *fp;
 {
-  if (_IO_fwide (fp, -1) != -1)
+  if (fp->_vtable_offset == 0 && _IO_fwide (fp, -1) != -1)
     return EOF;
 
   if (_IO_in_put_mode (fp))
@@ -310,7 +310,7 @@ int
 __uflow (fp)
      _IO_FILE *fp;
 {
-  if (_IO_fwide (fp, -1) != -1)
+  if (fp->_vtable_offset == 0 && _IO_fwide (fp, -1) != -1)
     return EOF;
 
   if (_IO_in_put_mode (fp))
index 32acf98..5b0553f 100644 (file)
@@ -36,7 +36,7 @@ _IO_fputs (str, fp)
   CHECK_FILE (fp, EOF);
   _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
   _IO_flockfile (fp);
-  if (_IO_fwide (fp, -1) == -1
+  if ((fp->_vtable_offset != 0 || _IO_fwide (fp, -1) == -1)
       && _IO_sputn (fp, str, len) == len)
     result = 1;
   _IO_funlockfile (fp);
index 1f25b66..38cb2f3 100644 (file)
@@ -38,7 +38,7 @@ _IO_ftell (fp)
   pos = _IO_seekoff (fp, 0, _IO_seek_cur, 0);
   if (_IO_in_backup (fp))
     {
-      if (fp->_mode < 0)
+      if (fp->_vtable_offset != 0 || fp->_mode < 0)
        pos -= fp->_IO_save_end - fp->_IO_save_base;
       else
        /* XXX For now.  */
index 9be18bd..411eeb2 100644 (file)
@@ -41,7 +41,7 @@ _IO_fwrite (buf, size, count, fp)
     return count;
   _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
   _IO_flockfile (fp);
-  if (_IO_fwide (fp, -1) == -1)
+  if (fp->_vtable_offset != 0 || _IO_fwide (fp, -1) == -1)
     written = _IO_sputn (fp, (const char *) buf, request);
   _IO_funlockfile (fp);
   _IO_cleanup_region_end (0);
index 954b0f2..86ae790 100644 (file)
@@ -36,7 +36,7 @@ _IO_puts (str)
                            _IO_stdout);
   _IO_flockfile (_IO_stdout);
 
-  if (_IO_fwide (_IO_stdout, -1) == -1
+  if (_IO_stdout->_vtable_offset != 0 || _IO_fwide (_IO_stdout, -1) == -1)
       && _IO_sputn (_IO_stdout, str, len) == len
       && _IO_putc_unlocked ('\n', _IO_stdout) != EOF)
     result = len + 1;
index d119cd0..5acbf5e 100644 (file)
@@ -38,7 +38,7 @@ _IO_setbuffer (fp, buf, size)
   if (!buf)
     size = 0;
   (void) _IO_SETBUF (fp, buf, size);
-  if (fp->_mode == 0)
+  if (fp->_vtable_offset == 0 && fp->_mode == 0)
     /* We also have to set the buffer using the wide char function.  */
     (*fp->_wide_data->_wide_vtable->__setbuf) (fp, buf, size);
   _IO_funlockfile (fp);
index 5dc5eed..f63a3c2 100644 (file)
@@ -90,7 +90,7 @@ _IO_setvbuf (fp, buf, mode, size)
       goto unlock_return;
     }
   result = _IO_SETBUF (fp, buf, size) == NULL ? EOF : 0;
-  if (result == 0 && fp->_mode == 0)
+  if (result == 0 && fp->_vtable_offset == 0 && fp->_mode == 0)
     /* We also have to set the buffer using the wide char function.  */
     result = ((*fp->_wide_data->_wide_vtable->__setbuf) (fp, buf, size) == NULL
              ? EOF : 0);
index a3aa252..d140426 100644 (file)
@@ -76,7 +76,8 @@
   if (width > 0)                                                             \
     done += _IO_padn (s, (Padchar), width)
 #  define PUTC(C, F)   _IO_putc_unlocked (C, F)
-#  define ORIENT       if (_IO_fwide (s, -1) != -1) return -1
+#  define ORIENT       if (s->_vtable_offset == 0 && _IO_fwide (s, -1) != -1)\
+                         return -1
 # else
 # include "_itowa.h"
 
@@ -1145,7 +1146,11 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
   ARGCHECK (s, format);
 
   /* Check for correct orientation.  */
-  if (_IO_fwide (s, sizeof (CHAR_T) == 1 ? -1 : 1)
+  if (
+#ifdef USE_IN_LIBIO
+      s->_vtable_offset == 0 &&
+#endif
+      _IO_fwide (s, sizeof (CHAR_T) == 1 ? -1 : 1)
       != (sizeof (CHAR_T) == 1 ? -1 : 1))
     /* The stream is already oriented otherwise.  */
     return EOF;
index 846542f..e7dc805 100644 (file)
@@ -84,7 +84,8 @@
 #  define ISDIGIT(Ch)    iswdigit (Ch)
 #  define ISXDIGIT(Ch)   iswxdigit (Ch)
 #  define TOLOWER(Ch)    towlower (Ch)
-#  define ORIENT         if (_IO_fwide (s, 1) != 1) return EOF
+#  define ORIENT         if (s->_vtable_offset == 0 && _IO_fwide (s, 1) != 1)\
+                           return EOF
 #  define __strtoll_internal   __wcstoll_internal
 #  define __strtoull_internal  __wcstoull_internal
 #  define __strtol_internal    __wcstol_internal