]> gcc.gnu.org Git - gcc.git/commitdiff
C/C++ io merge/sync.
authorBenjamin Kosnik <bkoz@gcc.gnu.org>
Tue, 15 Aug 2000 07:33:00 +0000 (07:33 +0000)
committerBenjamin Kosnik <bkoz@gcc.gnu.org>
Tue, 15 Aug 2000 07:33:00 +0000 (07:33 +0000)
2000-08-14  Benjamin Kosnik  <bkoz@purist.soma.redhat.com>

C/C++ io merge/sync.
* libio/fileops.c
* libio/genops.c
* libio/iofclose.c
* libio/iofopen.c
* libio/iofwide.c
* libio/libio.h
* libio/libioP.h
* libio/stdio.c
* libio/wfileops.c
* libio/wgenops.c
* config/c_io_libio.cc (__basic_file): Add hacky casts to
((struct _IO_FILE_plus *) in ctors.
(__basic_file<wchar_t>): Adjust _wide_data->_codecvt to just _codecvt.
* libio/Makefile.am: Fix copyright. Remove cleanup.c.
* libio/cleanup.c: Remove.
* libio/filedoalloc.c (_IO_file_doallocate): Don't call
_IO_cleanup_registration_needed, even if not libc.

* testsuite/27_io/stringstream.cc (test02): Fix.

From-SVN: r35694

17 files changed:
libstdc++-v3/ChangeLog
libstdc++-v3/config/c_io_libio.cc
libstdc++-v3/configure
libstdc++-v3/libio/ChangeLog
libstdc++-v3/libio/Makefile.am
libstdc++-v3/libio/Makefile.in
libstdc++-v3/libio/filedoalloc.c
libstdc++-v3/libio/fileops.c
libstdc++-v3/libio/genops.c
libstdc++-v3/libio/iofclose.c
libstdc++-v3/libio/iofopen.c
libstdc++-v3/libio/iofwide.c
libstdc++-v3/libio/libio.h
libstdc++-v3/libio/libioP.h
libstdc++-v3/libio/stdio.c
libstdc++-v3/libio/wfileops.c
libstdc++-v3/libio/wgenops.c

index 48df831c929ef67ac7fc8453683f0fe44d7cdafc..53e69377cc9256b0c4d4ba2360a72911540e7b33 100644 (file)
@@ -1,5 +1,24 @@
 2000-08-14  Benjamin Kosnik  <bkoz@purist.soma.redhat.com>
 
+       C/C++ io merge/sync.
+       * libio/fileops.c
+       * libio/genops.c
+       * libio/iofclose.c
+       * libio/iofopen.c
+       * libio/iofwide.c
+       * libio/libio.h
+       * libio/libioP.h
+       * libio/stdio.c
+       * libio/wfileops.c
+       * libio/wgenops.c
+       * config/c_io_libio.cc (__basic_file): Add hacky casts to
+       ((struct _IO_FILE_plus *) in ctors.
+       (__basic_file<wchar_t>): Adjust _wide_data->_codecvt to just _codecvt.
+       * libio/Makefile.am: Fix copyright. Remove cleanup.c.
+       * libio/cleanup.c: Remove.
+       * libio/filedoalloc.c (_IO_file_doallocate): Don't call
+       _IO_cleanup_registration_needed, even if not libc.
+               
        * testsuite/27_io/stringstream.cc (test02): Fix.
 
 2000-08-14  Brent Verner <brent@rcfile.org>
index 6b3586262ac20c62076037569bdeb80fb0f6d8b5..6f001b2930084485b20f3a21bfdb07d7115eac19 100644 (file)
@@ -206,7 +206,7 @@ namespace std {
 #endif
     // Don't set the orientation of the stream when initializing.
     _IO_no_init(this, 0, 0, &_M_wfile, 0);
-    _IO_JUMPS(this) = &_IO_file_jumps;
+    _IO_JUMPS((_IO_FILE_plus *) this) = &_IO_file_jumps;
     _IO_file_init((_IO_FILE_plus*)this);
   }
 
@@ -268,7 +268,7 @@ namespace std {
 #endif
     // Don't set the orientation of the stream when initializing.
     _IO_no_init(this, 0, 0, &_M_wfile, &_IO_wfile_jumps);
-    _IO_JUMPS(this) = &_IO_wfile_jumps;
+    _IO_JUMPS((_IO_FILE_plus *) this) = &_IO_wfile_jumps;
     _IO_file_init((_IO_FILE_plus*)this);
 
     // In addition, need to allocate the buffer...
@@ -281,7 +281,7 @@ namespace std {
     _IO_wsetp(this, _wide_data->_IO_buf_base, _wide_data->_IO_buf_base);
     
     // Setup codecvt bits...
-    _wide_data->_codecvt = __c_libio_codecvt;
+    _codecvt = &__c_libio_codecvt;
     
     // Do the same for narrow bits...
     if (_IO_write_base == NULL)
index 90dbacc9463d5fc0f9901f306a34fb9e8d20ba2d..d1b4b7f6f4218c4f60a72887f0fd77b6f409e28d 100755 (executable)
@@ -1863,7 +1863,7 @@ irix5* | irix6*)
   ;;
 
 # This must be Linux ELF.
-linux*)
+linux-gnu*)
   case "$host_cpu" in
   alpha* | i*86 | powerpc* | sparc* | ia64* )
     lt_cv_deplibs_check_method=pass_all ;;
@@ -18136,15 +18136,12 @@ else
 #include <sys/types.h>
 #include <fcntl.h>
 #include <sys/mman.h>
-#include <stdlib.h>
-#include <sys/stat.h>
-
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
 
 /* This mess was copied from the GNU getpagesize.h.  */
 #ifndef HAVE_GETPAGESIZE
+# ifdef HAVE_UNISTD_H
+#  include <unistd.h>
+# endif
 
 /* Assume that all systems that can run configure have sys/param.h.  */
 # ifndef HAVE_SYS_PARAM_H
@@ -18199,7 +18196,7 @@ main()
        /*
         * First, make a file with some known garbage in it.
         */
-       data = (char*)malloc(pagesize);
+       data = malloc(pagesize);
        if (!data)
                exit(1);
        for (i = 0; i < pagesize; ++i)
@@ -18220,7 +18217,7 @@ main()
        fd = open("conftestmmap", O_RDWR);
        if (fd < 0)
                exit(1);
-       data2 = (char*)malloc(2 * pagesize);
+       data2 = malloc(2 * pagesize);
        if (!data2)
                exit(1);
        data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1);
@@ -18238,7 +18235,7 @@ main()
         */
        for (i = 0; i < pagesize; ++i)
                *(data2 + i) = *(data2 + i) + 1;
-       data3 = (char*)malloc(pagesize);
+       data3 = malloc(pagesize);
        if (!data3)
                exit(1);
        if (read(fd, data3, pagesize) != pagesize)
@@ -18252,7 +18249,7 @@ main()
 }
 
 EOF
-if { (eval echo configure:18256: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:18253: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_func_mmap_fixed_mapped=yes
 else
 
 if test $ac_cv_header_locale_h = yes; then
     echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6
-echo "configure:18319: checking for LC_MESSAGES" >&5
+echo "configure:18316: checking for LC_MESSAGES" >&5
 if eval "test \"`echo '$''{'ac_cv_val_LC_MESSAGES'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 18324 "configure"
+#line 18321 "configure"
 #include "confdefs.h"
 #include <locale.h>
 int main() {
 return LC_MESSAGES
 ; return 0; }
 EOF
-if { (eval echo configure:18331: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:18328: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_val_LC_MESSAGES=yes
 else
index 870bb78f051d48bc2f88b714dc1a65f2597ea5b7..4dc4b84622b35488ae3d9659b1599061294fb96b 100644 (file)
@@ -1,3 +1,11 @@
+2000-08-14  Benjamin Kosnik  <bkoz@gnu.org>
+
+       * *: Merge with mainline glibc sources.
+       * filedoalloc.c (_IO_file_doallocate): Don't call
+       _IO_cleanup_registration_needed, even if not libc.
+       * iofwide.c (_IO_fwide): Correct placement of defines.
+       * cleanup.c: Remove.
+       
 2000-08-04  benjamin kosnik  <bkoz@haight.constant.com>
 
        * genops.c (_IO_unbuffer_write): Don't call _IO_SETBUF if the
index 0493e93a3902316a8c421f0cf4213164d8b8d02c..44e56cc77f53d01cd5ad90c98efe40664d812b19 100644 (file)
@@ -1,6 +1,6 @@
 ## Makefile for the libio subdirectory of the GNU C++ Standard library.
 ##
-## Copyright (C) 1999, 2000 Cygnus Solutions
+## Copyright (C) 1999, 2000 Free Software Foundation, Inc.
 ##
 ## This file is part of the libstdc++ version 3 distribution.
 ## Process this file with automake to produce Makefile.in.
@@ -64,14 +64,14 @@ LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) \
 
 LINK = $(LIBTOOL) --mode=link "$(CCLD)" $(CFLAGS) $(AM_CFLAGS) $(LDFLAGS) -o $@
 
-#includes = 
 
 libio_headers = \
         libio.h libioP.h iolibio.h
 
 if GLIBCPP_NEED_LIBIO
 LIBIO_SRCS = \
-       filedoalloc.c genops.c fileops.c stdfiles.c cleanup.c c_codecvt.c
+       filedoalloc.c genops.c fileops.c stdfiles.c c_codecvt.c
+#      filedoalloc.c genops.c fileops.c stdfiles.c cleanup.c c_codecvt.c
 else
 LIBIO_SRCS =
 endif
index 83409fca69cef2c1e0276c9db760d3d058bfc447..85f6e1acf53f4e7d6368581b9bda7dc4387a7e2b 100644 (file)
@@ -142,11 +142,10 @@ LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES)   $(AM_CPPFLAGS)
 
 LINK = $(LIBTOOL) --mode=link "$(CCLD)" $(CFLAGS) $(AM_CFLAGS) $(LDFLAGS) -o $@
 
-#includes = 
-
 libio_headers =          libio.h libioP.h iolibio.h
 
-@GLIBCPP_NEED_LIBIO_TRUE@LIBIO_SRCS =  filedoalloc.c genops.c fileops.c stdfiles.c cleanup.c c_codecvt.c
+#      filedoalloc.c genops.c fileops.c stdfiles.c cleanup.c c_codecvt.c
+@GLIBCPP_NEED_LIBIO_TRUE@LIBIO_SRCS =  filedoalloc.c genops.c fileops.c stdfiles.c c_codecvt.c
 @GLIBCPP_NEED_LIBIO_FALSE@LIBIO_SRCS = 
 @GLIBCPP_NEED_WLIBIO_TRUE@LIBIO_WSRCS =        wfiledoalloc.c wfileops.c wgenops.c
 @GLIBCPP_NEED_WLIBIO_FALSE@LIBIO_WSRCS = 
@@ -174,7 +173,6 @@ libio_la_LDFLAGS =
 @GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_TRUE@genops.lo \
 @GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_TRUE@fileops.lo \
 @GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_TRUE@stdfiles.lo \
-@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_TRUE@cleanup.lo \
 @GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_TRUE@c_codecvt.lo \
 @GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_TRUE@wfiledoalloc.lo \
 @GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_TRUE@wfileops.lo \
@@ -193,7 +191,6 @@ libio_la_LDFLAGS =
 @GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_FALSE@genops.lo \
 @GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_FALSE@fileops.lo \
 @GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_FALSE@stdfiles.lo \
-@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_FALSE@cleanup.lo \
 @GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_FALSE@c_codecvt.lo
 @GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_FALSE@@GLIBCPP_NEED_XTRA_LIBIO_TRUE@libio_la_OBJECTS =  \
 @GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_FALSE@@GLIBCPP_NEED_XTRA_LIBIO_TRUE@iofwide.lo \
@@ -205,7 +202,6 @@ libio_la_LDFLAGS =
 @GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_TRUE@genops.lo \
 @GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_TRUE@fileops.lo \
 @GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_TRUE@stdfiles.lo \
-@GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_TRUE@cleanup.lo \
 @GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_TRUE@c_codecvt.lo \
 @GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_TRUE@iofwide.lo \
 @GLIBCPP_NEED_WLIBIO_FALSE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_TRUE@iofclose.lo \
@@ -224,7 +220,6 @@ libio_la_LDFLAGS =
 @GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_FALSE@genops.lo \
 @GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_FALSE@fileops.lo \
 @GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_FALSE@stdfiles.lo \
-@GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_FALSE@cleanup.lo \
 @GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_FALSE@c_codecvt.lo \
 @GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_FALSE@wfiledoalloc.lo \
 @GLIBCPP_NEED_WLIBIO_TRUE@@GLIBCPP_NEED_LIBIO_TRUE@@GLIBCPP_NEED_XTRA_LIBIO_FALSE@wfileops.lo \
index 6abab602d167bdd1d83fa2938c45cff2128143ec..12c1135bcbe075f79455642f38ccbc41f8d1c03c 100644 (file)
@@ -75,15 +75,6 @@ _IO_file_doallocate (fp)
   char *p;
   struct _G_stat64 st;
 
-#ifndef _LIBC
-  /* If _IO_cleanup_registration_needed is non-zero, we should call the
-     function it points to.  This is to make sure _IO_cleanup gets called
-     on exit.  We call it from _IO_file_doallocate, since that is likely
-     to get called by any program that does buffered I/O. */
-  if (_IO_cleanup_registration_needed)
-    (*_IO_cleanup_registration_needed) ();
-#endif
-
   if (fp->_fileno < 0 || _IO_SYSSTAT (fp, &st) < 0)
     {
       couldbetty = 0;
index f3baa04519ee24fbd69f176e0a014a04ca979f2a..a830b5cd4395a02470067011cf079e10dcdbae98 100644 (file)
@@ -305,7 +305,7 @@ _IO_new_file_fopen (fp, filename, mode, is32not64)
            return NULL;
          }
 
-       cc = &fp->_wide_data->_codecvt;
+       cc = fp->_codecvt = &fp->_wide_data->_codecvt;
 
        /* The functions are always the same.  */
        *cc = __libio_codecvt;
index 5d8f520e0009d7cf82fb2697e33f1a970e5148d1..b1ae5afc506fd350fc344b64ccbca13d8f2bb139 100644 (file)
@@ -758,8 +758,9 @@ _IO_flush_all ()
 #if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
         || (fp->_vtable_offset == 0
             && fp->_mode > 0 && (fp->_wide_data->_IO_write_ptr
-                                 > fp->_wide_data->_IO_write_base)))
+                                 > fp->_wide_data->_IO_write_base))
 #endif
+        )
        && _IO_OVERFLOW (fp, EOF) == EOF)
       result = EOF;
   return result;
@@ -983,9 +984,11 @@ _IO_default_pbackfail (fp, c)
          new_buf = (char *) malloc (new_size);
          if (new_buf == NULL)
            return EOF;
-         memcpy (new_buf + old_size, fp->_IO_read_base, old_size);
+         memcpy (new_buf + (new_size - old_size), fp->_IO_read_base,
+                 old_size);
          free (fp->_IO_read_base);
-         _IO_setg (fp, new_buf, new_buf + old_size, new_buf + new_size);
+         _IO_setg (fp, new_buf, new_buf + (new_size - old_size),
+                   new_buf + new_size);
          fp->_IO_backup_base = fp->_IO_read_ptr;
        }
 
index 3d5724a4a3fdea3357a7b158fb7364fcc31157c4..43a3f5833fc5a916d6d7205840ca9fb29fc6f538 100644 (file)
@@ -32,6 +32,7 @@
 # include <shlib-compat.h>
 #else
 # define SHLIB_COMPAT(a, b, c) 0
+# define _IO_new_fclose fclose
 #endif
 
 int
@@ -63,7 +64,7 @@ _IO_new_fclose (fp)
 #if _LIBC
       /* This stream has a wide orientation.  This means we have to free
         the conversion functions.  */
-      struct _IO_codecvt *cc = &fp->_wide_data->_codecvt;
+      struct _IO_codecvt *cc = fp->_codecvt;
 
       if (cc->__cd_in.__cd.__steps->__shlib_handle != NULL)
        {
@@ -93,6 +94,4 @@ _IO_new_fclose (fp)
 versioned_symbol (libc, _IO_new_fclose, _IO_fclose, GLIBC_2_1);
 strong_alias (_IO_new_fclose, __new_fclose)
 versioned_symbol (libc, __new_fclose, fclose, GLIBC_2_1);
-#else
-int fclose (_IO_FILE *) __attribute__ ((alias("_IO_new_fclose")));
 #endif
index eb54e6de7fbaf4626118e336a727a77af4cafc02..f34fd1e51524ce2c17dc905afadedf43b49539cf 100644 (file)
@@ -29,6 +29,8 @@
 #endif
 #ifdef _LIBC
 # include <shlib-compat.h>
+#else
+# define _IO_new_fopen fopen
 #endif
 
 _IO_FILE *
@@ -71,7 +73,4 @@ _IO_new_fopen (filename, mode)
 strong_alias (_IO_new_fopen, __new_fopen)
 versioned_symbol (libc, _IO_new_fopen, _IO_fopen, GLIBC_2_1);
 versioned_symbol (libc, __new_fopen, fopen, GLIBC_2_1);
-#else
-int fopen (const char *,const char *)
-     __attribute__ ((alias("_IO_new_fopen")));
 #endif
index 77b45918e98fef9a90b58585c92e97633234b5bc..886f36f2aa74b5f7244c41e5d40670fcb6581030 100644 (file)
@@ -38,6 +38,7 @@
 # include <iconv/gconv_int.h>
 #endif
 
+
 /* Prototypes of libio's codecvt functions.  */
 static enum __codecvt_result do_out (struct _IO_codecvt *codecvt,
                                     __mbstate_t *statep,
@@ -76,14 +77,14 @@ struct _IO_codecvt __libio_codecvt =
 };
 
 
-/* static struct __gconv_trans_data libio_translit =*/
 #ifdef _LIBC
-struct __gconv_trans_data libio_translit =
+static struct __gconv_trans_data libio_translit =
 {
   .__trans_fct = __gconv_transliterate
 };
 #endif
 
+
 /* Return orientation of stream.  If mode is nonzero try to change
    the orientation first.  */
 #undef _IO_fwide
@@ -103,15 +104,12 @@ _IO_fwide (fp, mode)
   /* Set the orientation appropriately.  */
   if (mode > 0)
     {
-      struct _IO_codecvt *cc = &fp->_wide_data->_codecvt;
+      struct _IO_codecvt *cc = fp->_codecvt;
 
       fp->_wide_data->_IO_read_ptr = fp->_wide_data->_IO_read_end;
       fp->_wide_data->_IO_write_ptr = fp->_wide_data->_IO_write_base;
 
 #ifdef _LIBC
-      /* The functions are always the same.  */
-      *cc = __libio_codecvt;
-
       /* Get the character conversion functions based on the currently
         selected locale for LC_CTYPE.  */
       {
@@ -123,6 +121,9 @@ _IO_fwide (fp, mode)
 
        __wcsmbs_clone_conv (&fcts);
 
+       /* The functions are always the same.  */
+       *cc = __libio_codecvt;
+
        cc->__cd_in.__cd.__nsteps = 1; /* Only one step allowed.  */
        cc->__cd_in.__cd.__steps = fcts.towc;
 
@@ -142,18 +143,13 @@ _IO_fwide (fp, mode)
        cc->__cd_out.__cd.__data[0].__flags = __GCONV_IS_LAST;
        cc->__cd_out.__cd.__data[0].__statep = &fp->_wide_data->_IO_state;
 
-       /* XXX For now no transliteration.  */
-#ifdef _LIBC
+       /* And now the transliteration.  */
        cc->__cd_out.__cd.__data[0].__trans = &libio_translit;
-#else
-       cc->__cd_out.__cd.__data[0].__trans = NULL;
-#endif
       }
 #else
 # ifdef _GLIBCPP_USE_WCHAR_T
       {
        /* Determine internal and external character sets.
-
           XXX For now we make our life easy: we assume a fixed internal
           encoding (as most sane systems have; hi HP/UX!).  If somebody
           cares about systems which changing internal charsets they
@@ -195,6 +191,7 @@ _IO_fwide (fp, mode)
 weak_alias (_IO_fwide, fwide)
 #endif
 
+
 static enum __codecvt_result
 do_out (struct _IO_codecvt *codecvt, __mbstate_t *statep,
        const wchar_t *from_start, const wchar_t *from_end,
@@ -239,7 +236,6 @@ do_out (struct _IO_codecvt *codecvt, __mbstate_t *statep,
     }
 #else
 # ifdef _GLIBCPP_USE_WCHAR_T
-
   size_t res;
   const char *from_start_copy = (const char *) from_start;
   size_t from_len = from_end - from_start;
@@ -309,7 +305,7 @@ do_unshift (struct _IO_codecvt *codecvt, __mbstate_t *statep,
   size_t to_len = to_end - to_start;
 
   res = iconv (codecvt->__cd_out, NULL, NULL, &to_start_copy, &to_len);
-  
+
   if (res == 0)
     result = __codecvt_ok;
   else if (to_len < codecvt->__codecvt_do_max_length (codecvt))
@@ -376,7 +372,7 @@ do_in (struct _IO_codecvt *codecvt, __mbstate_t *statep,
 
   res = iconv (codecvt->__cd_in, &from_start_copy, &from_len,
               &to_start_copy, &to_len);
-  
+
   if (res == 0)
     result = __codecvt_ok;
   else if (to_len == 0)
@@ -455,7 +451,7 @@ do_length (struct _IO_codecvt *codecvt, __mbstate_t *statep,
 
   res = iconv (codecvt->__cd_in, &from_start_copy, &from_len,
               &to_start, &max);
-  
+
   result = from_start_copy - (char *) from_start;
 # else
   /* Decide what to do.  */
@@ -476,10 +472,3 @@ do_max_length (struct _IO_codecvt *codecvt)
   return MB_CUR_MAX;
 #endif
 }
-
-
-
-
-
-
-
index 7b3b2e1d6111a31c5015b37ce2ec26ff79ebef20..d26a5e597988fd76c3160d8a0c3c535777e72349 100644 (file)
@@ -227,7 +227,6 @@ struct _IO_codecvt
   _IO_iconv_t __cd_in;
   _IO_iconv_t __cd_out;
 };
-#endif
 
 /* Extra data for wide character streams.  */
 struct _IO_wide_data
@@ -249,8 +248,8 @@ struct _IO_wide_data
 #if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
   __mbstate_t _IO_state;
   __mbstate_t _IO_last_state;
-  struct _IO_codecvt _codecvt;
 #endif
+  struct _IO_codecvt _codecvt;
 
   wchar_t _shortbuf[1];
 
@@ -258,6 +257,7 @@ struct _IO_wide_data
   struct _IO_jump_t *_wide_vtable;
 #endif
 };
+#endif
 
 struct _IO_FILE {
   int _flags;          /* High-order word is _IO_MAGIC; rest is flags. */
@@ -496,5 +496,3 @@ extern void _IO_free_wbackup_area (_IO_FILE *) __THROW;
 #endif
 
 #endif /* _IO_STDIO_H */
-
-
index b2a4ecf0634cce9e5046d1cfa0e93b20c0b64802..4bbee9cba0a31407056777f00e0010046b38aea0 100644 (file)
@@ -69,13 +69,13 @@ extern "C" {
 # define _IO_JUMPS_OFFSET 1
 #endif
 
-#define _IO_JUMPS(THIS) ((struct _IO_FILE_plus *) (THIS))->vtable
+#define _IO_JUMPS(THIS) (THIS)->vtable
 #define _IO_WIDE_JUMPS(THIS) ((struct _IO_FILE *) (THIS))->_wide_data->_wide_vtable
 #define _IO_CHECK_WIDE(THIS) (((struct _IO_FILE *) (THIS))->_wide_data != NULL)
 
 #if _IO_JUMPS_OFFSET
 # define _IO_JUMPS_FUNC(THIS) \
- (*(struct _IO_jump_t **) ((char *) &_IO_JUMPS ((struct _IO_FILE_plus *) (THIS)) \
+ (*(struct _IO_jump_t **) ((void *) &_IO_JUMPS ((struct _IO_FILE_plus *) (THIS)) \
                           + (THIS)->_vtable_offset))
 #else
 # define _IO_JUMPS_FUNC(THIS) _IO_JUMPS ((struct _IO_FILE_plus *) (THIS))
@@ -714,19 +714,19 @@ extern int _IO_vscanf __P ((const char *, _IO_va_list));
 # ifdef _IO_USE_OLD_IO_FILE
 #  define FILEBUF_LITERAL(CHAIN, FLAGS, FD, WDP) \
        { _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \
-         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  (_IO_FILE *) CHAIN, FD, \
+        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (_IO_FILE *) CHAIN, FD, \
         0, _IO_pos_BAD, 0, 0, { 0 }, &_IO_stdfile_##FD##_lock }
 # else
 #  if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
 #   define FILEBUF_LITERAL(CHAIN, FLAGS, FD, WDP) \
        { _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \
-         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  (_IO_FILE *) CHAIN, FD, \
+        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (_IO_FILE *) CHAIN, FD, \
         0, _IO_pos_BAD, 0, 0, { 0 }, &_IO_stdfile_##FD##_lock, _IO_pos_BAD,\
         NULL, WDP, 0 }
 #  else
 #   define FILEBUF_LITERAL(CHAIN, FLAGS, FD, WDP) \
        { _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \
-         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  (_IO_FILE *) CHAIN, FD, \
+        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (_IO_FILE *) CHAIN, FD, \
         0, _IO_pos_BAD, 0, 0, { 0 }, &_IO_stdfile_##FD##_lock, _IO_pos_BAD,\
         0 }
 #  endif
@@ -741,13 +741,13 @@ extern int _IO_vscanf __P ((const char *, _IO_va_list));
 #  if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
 #   define FILEBUF_LITERAL(CHAIN, FLAGS, FD, WDP) \
        { _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \
-         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (_IO_FILE *) CHAIN, FD, \
+        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (_IO_FILE *) CHAIN, FD, \
         0, _IO_pos_BAD, 0, 0, { 0 }, 0, _IO_pos_BAD, \
         NULL, WDP, 0 }
 #  else
 #   define FILEBUF_LITERAL(CHAIN, FLAGS, FD, WDP) \
        { _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \
-         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (_IO_FILE *) CHAIN, FD, \
+        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (_IO_FILE *) CHAIN, FD, \
         0, _IO_pos_BAD, 0, 0, { 0 }, 0, _IO_pos_BAD, \
         0 }
 #  endif
index 95829d6fe28f31f9b89a3e8c29ab3e2920f03d9f..3b897ced1767d5f41b7da16530f6926fa0c29de7 100644 (file)
    General Public License.  */
 
 #include "libioP.h"
+#include "stdio.h"
 
 #undef stdin
 #undef stdout
 #undef stderr
-_IO_FILE *stdin = (_IO_FILE *) &_IO_2_1_stdin_;
-_IO_FILE *stdout = (_IO_FILE *) &_IO_2_1_stdout_;
-_IO_FILE *stderr = (_IO_FILE *) &_IO_2_1_stderr_;
+_IO_FILE *stdin = (FILE *) &_IO_2_1_stdin_;
+_IO_FILE *stdout = (FILE *) &_IO_2_1_stdout_;
+_IO_FILE *stderr = (FILE *) &_IO_2_1_stderr_;
 
 #undef _IO_stdin
 #undef _IO_stdout
index e30bbe1f5455c5b4582ca8732e3643b834f88660..f12cb22a7dfecf2229d96d435b17486659a817a5 100644 (file)
@@ -76,7 +76,7 @@ _IO_wdo_write (fp, data, to_do)
      const wchar_t *data;
      _IO_size_t to_do;
 {
-  struct _IO_codecvt *cc = &fp->_wide_data->_codecvt;
+  struct _IO_codecvt *cc = fp->_codecvt;
 
   if (to_do > 0)
     {
@@ -150,7 +150,7 @@ _IO_wfile_underflow (fp)
   if (fp->_wide_data->_IO_read_ptr < fp->_wide_data->_IO_read_end)
     return *fp->_wide_data->_IO_read_ptr;
 
-  cd = &fp->_wide_data->_codecvt;
+  cd = fp->_codecvt;
 
   /* Maybe there is something left in the external buffer.  */
   if (fp->_IO_read_ptr < fp->_IO_read_end)
@@ -379,7 +379,7 @@ _IO_wfile_sync (fp)
     {
       /* We have to find out how many bytes we have to go back in the
         external buffer.  */
-      struct _IO_codecvt *cv = &fp->_wide_data->_codecvt;
+      struct _IO_codecvt *cv = fp->_codecvt;
       _IO_off64_t new_pos;
 
       int clen = (*cv->__codecvt_do_encoding) (cv);
@@ -483,7 +483,7 @@ _IO_wfile_seekoff (fp, offset, dir, mode)
       /* Adjust for read-ahead (bytes is buffer).  To do this we must
          find out which position in the external buffer corresponds to
          the current position in the internal buffer.  */
-      cv = &fp->_wide_data->_codecvt;
+      cv = fp->_codecvt;
       clen = (*cv->__codecvt_do_encoding) (cv);
 
       if (clen > 0)
index 7440e690b6a91ab2574634e228c6b7d0aea1b3fd..fa0aab36af050bb7ba58724200e94450d9d9a62f 100644 (file)
@@ -39,6 +39,7 @@
 # define __wmemcpy(dst, src, n) wmemcpy (dst, src, n)
 #endif
 
+
 static int save_for_wbackup __P ((_IO_FILE *fp, wchar_t *end_p))
 #ifdef _LIBC
      internal_function
This page took 0.1873 seconds and 5 git commands to generate.