diff options
author | Richard B. Kreckel <richard.kreckel@framatome-anp.com> | 2004-05-29 14:40:59 +0000 |
---|---|---|
committer | Benjamin Kosnik <bkoz@gcc.gnu.org> | 2004-05-29 14:40:59 +0000 |
commit | 803cb0b5c9ff81ba0b4ec018fff529a9b7cf43f2 (patch) | |
tree | b396c782c93385052fe88b5f37ebe56e4b012f64 /libstdc++-v3 | |
parent | e73c80ae862805f76cb4c45de0b1109f5d3e14d5 (diff) | |
download | gcc-803cb0b5c9ff81ba0b4ec018fff529a9b7cf43f2.zip gcc-803cb0b5c9ff81ba0b4ec018fff529a9b7cf43f2.tar.gz gcc-803cb0b5c9ff81ba0b4ec018fff529a9b7cf43f2.tar.bz2 |
re PR libstdc++/14600 (__gnu_cxx::stdio_sync_filebuf should expose internal FILE*)
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
Diffstat (limited to 'libstdc++-v3')
-rw-r--r-- | libstdc++-v3/ChangeLog | 9 | ||||
-rw-r--r-- | libstdc++-v3/config/io/basic_file_stdio.cc | 6 | ||||
-rw-r--r-- | libstdc++-v3/config/io/basic_file_stdio.h | 3 | ||||
-rw-r--r-- | libstdc++-v3/include/ext/stdio_filebuf.h | 20 | ||||
-rw-r--r-- | libstdc++-v3/include/ext/stdio_sync_filebuf.h | 10 |
5 files changed, 44 insertions, 4 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index a615e20..e60fd32 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -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 diff --git a/libstdc++-v3/config/io/basic_file_stdio.cc b/libstdc++-v3/config/io/basic_file_stdio.cc index 224a2f6..a3ed839 100644 --- a/libstdc++-v3/config/io/basic_file_stdio.cc +++ b/libstdc++-v3/config/io/basic_file_stdio.cc @@ -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() diff --git a/libstdc++-v3/config/io/basic_file_stdio.h b/libstdc++-v3/config/io/basic_file_stdio.h index 57ff432..6aa031b 100644 --- a/libstdc++-v3/config/io/basic_file_stdio.h +++ b/libstdc++-v3/config/io/basic_file_stdio.h @@ -81,6 +81,9 @@ namespace std int fd(); + __c_file* + file(); + ~__basic_file(); streamsize diff --git a/libstdc++-v3/include/ext/stdio_filebuf.h b/libstdc++-v3/include/ext/stdio_filebuf.h index 0461989..cc22972 100644 --- a/libstdc++-v3/include/ext/stdio_filebuf.h +++ b/libstdc++-v3/include/ext/stdio_filebuf.h @@ -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 @@ -63,6 +63,11 @@ namespace __gnu_cxx 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. * @param size Optimal or preferred size of internal buffer, in chars. @@ -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> diff --git a/libstdc++-v3/include/ext/stdio_sync_filebuf.h b/libstdc++-v3/include/ext/stdio_sync_filebuf.h index cdf1e7c..367d310 100644 --- a/libstdc++-v3/include/ext/stdio_sync_filebuf.h +++ b/libstdc++-v3/include/ext/stdio_sync_filebuf.h @@ -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(); |