aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan C. Myers <ncm-nospam@cantrip.org>2003-06-18 17:17:52 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2003-06-18 17:17:52 +0000
commitc1b74c211a117a9f6e05f6d2e47dd633cc5f40e2 (patch)
tree726fb6b7c21c185101948ea48de0e6660d0fb9b7
parent5a9335ef017c45e09d9493b982a25a8e58b51d40 (diff)
downloadgcc-c1b74c211a117a9f6e05f6d2e47dd633cc5f40e2.zip
gcc-c1b74c211a117a9f6e05f6d2e47dd633cc5f40e2.tar.gz
gcc-c1b74c211a117a9f6e05f6d2e47dd633cc5f40e2.tar.bz2
fstream.tcc (setbuf): Allow (__s...
2003-06-18 Nathan C. Myers <ncm-nospam@cantrip.org> Paolo Carlini <pcarlini@unitus.it> * include/bits/fstream.tcc (setbuf): Allow (__s, 1) too, simply equivalent to the unbuffered case (0, 0) as far as _M_buf_size is concerned. Co-Authored-By: Paolo Carlini <pcarlini@unitus.it> From-SVN: r68160
-rw-r--r--libstdc++-v3/ChangeLog7
-rw-r--r--libstdc++-v3/include/bits/fstream.tcc15
2 files changed, 15 insertions, 7 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index a6e67e7d..a77f7ec 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,10 @@
+2003-06-18 Nathan C. Myers <ncm-nospam@cantrip.org>
+ Paolo Carlini <pcarlini@unitus.it>
+
+ * include/bits/fstream.tcc (setbuf): Allow (__s, 1) too,
+ simply equivalent to the unbuffered case (0, 0) as far as
+ _M_buf_size is concerned.
+
2003-06-18 Andreas Jaeger <aj@suse.de>
* testsuite/Makefile.am (new-abi-baseline): Create baseline
diff --git a/libstdc++-v3/include/bits/fstream.tcc b/libstdc++-v3/include/bits/fstream.tcc
index 908cc75..c0ef882 100644
--- a/libstdc++-v3/include/bits/fstream.tcc
+++ b/libstdc++-v3/include/bits/fstream.tcc
@@ -429,15 +429,16 @@ namespace std
{
if (!this->is_open() && __s == 0 && __n == 0)
this->_M_buf_size = 1;
- else if (__s && __n > 1)
+ else if (__s && __n >= 1)
{
// This is implementation-defined behavior, and assumes that
- // an external char_type array of length (__s + __n) exists
- // and has been pre-allocated. If this is not the case,
- // things will quickly blow up. The length argument __n must
- // be greater than 1 because __n - 1 positions will be used
- // for the get and put areas, and 1 position is needed to
- // host the overflow char of a full put area.
+ // an external char_type array of length __n exists and has
+ // been pre-allocated. If this is not the case, things will
+ // quickly blow up. When __n > 1, __n - 1 positions will be
+ // used for the get area, __n - 1 for the put area and 1
+ // position to host the overflow char of a full put area.
+ // When __n == 1, 1 position will be used for the get area
+ // and 0 for the put area, as in the unbuffered case above.
// Step 1: Destroy the current internal array.
_M_destroy_internal_buffer();