aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Kosnik <bkoz@cygnus.com>2000-05-08 17:23:37 +0000
committerBenjamin Kosnik <bkoz@gcc.gnu.org>2000-05-08 17:23:37 +0000
commitd207c3f7ffa7bdece0ba89c054c969359379342b (patch)
treed0e99546b6d3242ff5c9694fee016dca82f57482
parentc0916fa0b554070641233dfe8f91978d16c15f5c (diff)
downloadgcc-d207c3f7ffa7bdece0ba89c054c969359379342b.zip
gcc-d207c3f7ffa7bdece0ba89c054c969359379342b.tar.gz
gcc-d207c3f7ffa7bdece0ba89c054c969359379342b.tar.bz2
fstream.tcc (filebuf::_M_init_filebuf): Don't set _M_buf_size based on macro, instead use _M_buf_size_opt.
2000-05-08 Benjamin Kosnik <bkoz@cygnus.com> * bits/fstream.tcc (filebuf::_M_init_filebuf): Don't set _M_buf_size based on macro, instead use _M_buf_size_opt. * bits/std_streambuf.h (basic_streambuf): Add _M_buf_size_opt. (basic_streambuf()): Set _M_buf_size_opt. * testsuite/27_io/filebuf.cc (filebuf): Use _M_buf_size_opt instead of _M_buf_size. From-SVN: r33768
-rw-r--r--libstdc++-v3/ChangeLog9
-rw-r--r--libstdc++-v3/bits/fstream.tcc4
-rw-r--r--libstdc++-v3/bits/std_streambuf.h18
-rw-r--r--libstdc++-v3/testsuite/27_io/filebuf.cc4
4 files changed, 25 insertions, 10 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 00d3c92..2b5b323 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,12 @@
+2000-05-08 Benjamin Kosnik <bkoz@cygnus.com>
+
+ * bits/fstream.tcc (filebuf::_M_init_filebuf): Don't set
+ _M_buf_size based on macro, instead use _M_buf_size_opt.
+ * bits/std_streambuf.h (basic_streambuf): Add _M_buf_size_opt.
+ (basic_streambuf()): Set _M_buf_size_opt.
+ * testsuite/27_io/filebuf.cc (filebuf): Use _M_buf_size_opt
+ instead of _M_buf_size.
+
2000-05-03 Phil Edwards <pme@sourceware.cygnus.com>
Felix Natter <fnatter@gmx.net>
diff --git a/libstdc++-v3/bits/fstream.tcc b/libstdc++-v3/bits/fstream.tcc
index d2d8c26..44cfb19 100644
--- a/libstdc++-v3/bits/fstream.tcc
+++ b/libstdc++-v3/bits/fstream.tcc
@@ -1,6 +1,6 @@
// File based streams -*- C++ -*-
-// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+// Copyright (C) 1997-1999, 2000 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
@@ -42,7 +42,7 @@ namespace std
_M_init_filebuf(void)
{
_M_buf_unified = true; // Tie input to output for basic_filebuf.
- _M_buf_size = static_cast<int_type>(BUFSIZ * sizeof(char_type));
+ _M_buf_size = _M_buf_size_opt;
try {
_M_file = new __file_type(&_M_lock);
}
diff --git a/libstdc++-v3/bits/std_streambuf.h b/libstdc++-v3/bits/std_streambuf.h
index 6aa9204..84699bf 100644
--- a/libstdc++-v3/bits/std_streambuf.h
+++ b/libstdc++-v3/bits/std_streambuf.h
@@ -1,6 +1,6 @@
// Stream buffer classes -*- C++ -*-
-// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+// Copyright (C) 1997-1999, 2000 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
@@ -84,9 +84,12 @@ namespace std {
// leave it NULL.
char_type* _M_buf;
- // Size of internal buffer, in bytes.
+ // Actual size of internal buffer, in bytes.
int_type _M_buf_size;
+ // Optimal or preferred size of internal buffer, in bytes.
+ int_type _M_buf_size_opt;
+
// True iff _M_in_* and _M_out_* buffers should always point to
// the same place. True for fstreams, false for sstreams.
bool _M_buf_unified;
@@ -284,10 +287,13 @@ namespace std {
protected:
basic_streambuf()
- : _M_buf(NULL), _M_buf_size(0), _M_buf_unified(false),
- _M_in_cur(0), _M_in_beg(0), _M_in_end(0), _M_out_cur(0), _M_out_beg(0),
- _M_out_end(0), _M_mode(ios_base::openmode(0)),
- _M_locale_buf(locale()), _M_locale_set(false)
+ : _M_buf(NULL), _M_buf_size(0),
+ _M_buf_size_opt(static_cast<int_type>(BUFSIZ * sizeof(char_type))),
+ _M_buf_unified(false), _M_in_cur(0), _M_in_beg(0), _M_in_end(0),
+ _M_out_cur(0), _M_out_beg(0), _M_out_end(0),
+ _M_mode(ios_base::openmode(0)), _M_locale_buf(locale()),
+ _M_locale_set(false)
+
{ _M_fctype_buf = &use_facet<__ctype_type>(this->getloc()); }
// Get area:
diff --git a/libstdc++-v3/testsuite/27_io/filebuf.cc b/libstdc++-v3/testsuite/27_io/filebuf.cc
index 830e0b1..586388e 100644
--- a/libstdc++-v3/testsuite/27_io/filebuf.cc
+++ b/libstdc++-v3/testsuite/27_io/filebuf.cc
@@ -1,6 +1,6 @@
// 990117 bkoz test functionality of basic_filebuf for char_type == char
-// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+// Copyright (C) 1997-1999, 2000 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
@@ -37,7 +37,7 @@ class derived_filebuf: public std::filebuf
{
public:
void
- set_size(int_type __size) { _M_buf_size = __size; }
+ set_size(int_type __size) { _M_buf_size_opt = __size; }
};
derived_filebuf fb_01; // in