diff options
| author | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-07-04 16:15:15 +0000 |
|---|---|---|
| committer | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-07-04 16:15:15 +0000 |
| commit | 2679b07a8a47683a822b82e22ab97203fc3cf792 (patch) | |
| tree | 48dabf186899bdf1870541b589413402ac17b03f /libstdc++-v3/include/std/std_fstream.h | |
| parent | dc1b4094feb3d902cb9dbcb2671d850322ae30b1 (diff) | |
| download | ppe42-gcc-2679b07a8a47683a822b82e22ab97203fc3cf792.tar.gz ppe42-gcc-2679b07a8a47683a822b82e22ab97203fc3cf792.zip | |
2003-07-04 Paolo Carlini <pcarlini@unitus.it>
PR libstdc++/11378
* include/std/std_fstream.h (xsputn): In the unbuffered case,
provided always_noconv(), issue directly _M_file.xsputn.
* testsuite/performance/filebuf_unbuf_sputn.cc: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@68921 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/std/std_fstream.h')
| -rw-r--r-- | libstdc++-v3/include/std/std_fstream.h | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/libstdc++-v3/include/std/std_fstream.h b/libstdc++-v3/include/std/std_fstream.h index b97c9443de9..766023573ab 100644 --- a/libstdc++-v3/include/std/std_fstream.h +++ b/libstdc++-v3/include/std/std_fstream.h @@ -397,9 +397,21 @@ namespace std virtual streamsize xsputn(const char_type* __s, streamsize __n) { - _M_destroy_pback(); - return __streambuf_type::xsputn(__s, __n); - } + streamsize __ret = 0; + + const bool __testout = this->_M_mode & ios_base::out; + if (__testout && !_M_reading && this->_M_buf_size == 1 + && __check_facet(_M_codecvt).always_noconv()) + { + __ret = _M_file.xsputn(reinterpret_cast<const char*>(__s), __n); + if (__ret == __n) + _M_writing = true; + } + else + __ret = __streambuf_type::xsputn(__s, __n); + + return __ret; + } /** * @if maint |

