]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR libstdc++/14600 (__gnu_cxx::stdio_sync_filebuf should expose internal FILE*)
authorRichard B. Kreckel <richard.kreckel@framatome-anp.com>
Sat, 29 May 2004 14:40:59 +0000 (14:40 +0000)
committerBenjamin Kosnik <bkoz@gcc.gnu.org>
Sat, 29 May 2004 14:40:59 +0000 (14:40 +0000)
2004-05-29  Richard B. Kreckel  <Richard.Kreckel@Framatome-ANP.com>
            Benjamin Kosnik  <bkoz@redhat.com>

PR libstdc++/14600
* include/ext/stdio_sync_filebuf.h (stdio_sync_filebuf::file): New.
* include/ext/stdio_filebuf.h (stdio_filebuf::file): New.
* config/io/basic_file_stdio.cc (__basic_file::file): New.
* config/io/basic_file_stdio.h: Define.

Co-Authored-By: Benjamin Kosnik <bkoz@redhat.com>
From-SVN: r82419

libstdc++-v3/ChangeLog
libstdc++-v3/config/io/basic_file_stdio.cc
libstdc++-v3/config/io/basic_file_stdio.h
libstdc++-v3/include/ext/stdio_filebuf.h
libstdc++-v3/include/ext/stdio_sync_filebuf.h

index a615e20cfb4d3308afbbffed4a778373458c0b7e..e60fd323ae0c32abd379a84638e49ae1bf3a2852 100644 (file)
@@ -1,3 +1,12 @@
+2004-05-29  Richard B. Kreckel  <Richard.Kreckel@Framatome-ANP.com>
+            Benjamin Kosnik  <bkoz@redhat.com>
+       
+       PR libstdc++/14600
+       * include/ext/stdio_sync_filebuf.h (stdio_sync_filebuf::file): New.
+       * include/ext/stdio_filebuf.h (stdio_filebuf::file): New.
+       * config/io/basic_file_stdio.cc (__basic_file::file): New.
+       * config/io/basic_file_stdio.h: Define.
+
 2004-05-27  Benjamin Kosnik  <bkoz@redhat.com>
 
        PR libstdc++/15675
index 224a2f6bd6a3c739b9dd996ce1e64dba0d555d24..a3ed8391bfffa194bd2aee22e00e2450850832be 100644 (file)
@@ -240,7 +240,11 @@ namespace std
   
   int 
   __basic_file<char>::fd() 
-  { return fileno(_M_cfile) ; }
+  { return fileno(_M_cfile); }
+  
+  __c_file*
+  __basic_file<char>::file() 
+  { return _M_cfile; }
   
   __basic_file<char>* 
   __basic_file<char>::close()
index 57ff4326e6b190498d5f9c153ca4186e26450dce..6aa031b507d57d514b40437c68612d3734d405b1 100644 (file)
@@ -81,6 +81,9 @@ namespace std
       int 
       fd();
 
+      __c_file*
+      file();
+
       ~__basic_file();
 
       streamsize 
index 04619897206594eef64bf1e153788b6e9fed3df5..cc229728fa8ab95e94ba7a35f719997471c56727 100644 (file)
@@ -1,6 +1,6 @@
 // File descriptor layer for filebuf -*- C++ -*-
 
-// Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+// Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -62,6 +62,11 @@ namespace __gnu_cxx
       typedef std::size_t                               size_t;
 
     public:
+      /**
+       * deferred initialization
+      */
+      stdio_filebuf() : std::basic_filebuf<_CharT, _Traits>() {}
+
       /**
        *  @param  fd  An open file descriptor.
        *  @param  mode  Same meaning as in a standard filebuf.
@@ -103,8 +108,17 @@ namespace __gnu_cxx
        *  descriptor, so be careful.
       */
       int
-      fd()
-      { return this->_M_file.fd(); }
+      fd() { return this->_M_file.fd(); }
+
+      /**
+       *  @return  The underlying FILE*.
+       *
+       *  This function can be used to access the underlying "C" file pointer.
+       *  Note that there is no way for the library to track what you do
+       *  with the file, so be careful.
+       */
+      std::__c_file*
+      file() { return this->_M_file.file(); }
     };
 
   template<typename _CharT, typename _Traits>
index cdf1e7c3665c0dd0f6b8c18209751772cc91df8d..367d310b4b0406bd6e9494694e0a95a7898b09e8 100644 (file)
@@ -71,6 +71,16 @@ namespace __gnu_cxx
       : _M_file(__f), _M_unget_buf(traits_type::eof())
       { }
 
+      /**
+       *  @return  The underlying FILE*.
+       *
+       *  This function can be used to access the underlying "C" file pointer.
+       *  Note that there is no way for the library to track what you do
+       *  with the file, so be careful.
+       */
+      std::__c_file* const
+      file() { return this->_M_file; }
+
     protected:
       int_type
       syncgetc();