aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Kosnik <bkoz@redhat.com>2001-01-08 23:51:57 +0000
committerBenjamin Kosnik <bkoz@gcc.gnu.org>2001-01-08 23:51:57 +0000
commit5a259aec511b294d3be1df9d54a3bebf8ad89c7c (patch)
tree870f1350c7c1c6a76c407cc0c7cbbc5745ea0e4c
parent5bb11b2e20b893361704d444fcf3a02de7f0bc89 (diff)
downloadgcc-5a259aec511b294d3be1df9d54a3bebf8ad89c7c.zip
gcc-5a259aec511b294d3be1df9d54a3bebf8ad89c7c.tar.gz
gcc-5a259aec511b294d3be1df9d54a3bebf8ad89c7c.tar.bz2
fpos.h (fpos:::fpos(streamoff __pos)): Explicitly initialize mbstate_t member, name offset data members *off, not pos.
2001-01-08 Benjamin Kosnik <bkoz@redhat.com> * include/bits/fpos.h (fpos:::fpos(streamoff __pos)): Explicitly initialize mbstate_t member, name offset data members *off, not pos. * include/bits/fstream.tcc (filebuf::filebuf): Same. From-SVN: r38809
-rw-r--r--libstdc++-v3/ChangeLog6
-rw-r--r--libstdc++-v3/include/bits/fpos.h35
-rw-r--r--libstdc++-v3/include/bits/fstream.tcc10
3 files changed, 27 insertions, 24 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index d39279a..8df53e5 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,5 +1,11 @@
2001-01-08 Benjamin Kosnik <bkoz@redhat.com>
+ * include/bits/fpos.h (fpos:::fpos(streamoff __pos)): Explicitly
+ initialize mbstate_t member, name offset data members *off, not pos.
+ * include/bits/fstream.tcc (filebuf::filebuf): Same.
+
+2001-01-08 Benjamin Kosnik <bkoz@redhat.com>
+
reported by Chris G. Demetriou <cgd@sibyte.com>
* configure.in: Change -linux-* to -linux*.
* configure: Regenerate.
diff --git a/libstdc++-v3/include/bits/fpos.h b/libstdc++-v3/include/bits/fpos.h
index 27792b0..197b80e 100644
--- a/libstdc++-v3/include/bits/fpos.h
+++ b/libstdc++-v3/include/bits/fpos.h
@@ -1,6 +1,6 @@
// File position object and stream types
-// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+// Copyright (C) 1997, 1998, 1999, 2000, 2001 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
@@ -48,10 +48,14 @@ namespace std {
class fpos
{
public:
-
// Types:
typedef _StateT __state_type;
+ private:
+ __state_type _M_st;
+ streamoff _M_off;
+
+ public:
__state_type
state() const { return _M_st; }
@@ -60,37 +64,30 @@ namespace std {
// NB: The standard defines only the implicit copy ctor and the
// previous two members. The rest is a "conforming extension".
- fpos(): _M_st(__state_type()), _M_pos(streamoff()) { }
+ fpos(): _M_st(__state_type()), _M_off(streamoff()) { }
- fpos(streamoff __pos, __state_type __st)
- : _M_st(__st), _M_pos(__pos) { }
+ fpos(streamoff __off, __state_type __st = __state_type())
+ : _M_st(__st), _M_off(__off) { }
- fpos(streamoff __pos)
- : _M_st(), _M_pos(__pos) { }
-
- operator streamoff() const { return _M_pos; }
+ operator streamoff() const { return _M_off; }
fpos&
- operator+=(streamoff __off) { _M_pos += __off; return *this; }
+ operator+=(streamoff __off) { _M_off += __off; return *this; }
fpos&
- operator-=(streamoff __off) { _M_pos -= __off; return *this; }
+ operator-=(streamoff __off) { _M_off -= __off; return *this; }
bool
- operator==(const fpos& __pos2) const { return _M_pos == __pos2._M_pos; }
+ operator==(const fpos& __pos) const { return _M_off == __pos._M_off; }
bool
- operator!=(const fpos& __pos2) const { return _M_pos != __pos2._M_pos; }
+ operator!=(const fpos& __pos) const { return _M_off != __pos._M_off; }
streamoff
- _M_position() const { return _M_pos; }
+ _M_position() const { return _M_off; }
void
- _M_position(streamoff __pos) { _M_pos = __pos; }
-
- private:
- __state_type _M_st;
- streamoff _M_pos;
+ _M_position(streamoff __off) { _M_off = __off; }
};
template<typename _State>
diff --git a/libstdc++-v3/include/bits/fstream.tcc b/libstdc++-v3/include/bits/fstream.tcc
index 72940ea..e43e8a3 100644
--- a/libstdc++-v3/include/bits/fstream.tcc
+++ b/libstdc++-v3/include/bits/fstream.tcc
@@ -1,6 +1,6 @@
// File based streams -*- C++ -*-
-// Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc.
+// Copyright (C) 1997, 1998, 1999, 2000, 2001 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
@@ -79,15 +79,15 @@ namespace std
template<typename _CharT, typename _Traits>
basic_filebuf<_CharT, _Traits>::
basic_filebuf()
- : __streambuf_type(), _M_file(NULL), _M_state_cur(), _M_state_beg(),
- _M_last_overflowed(false)
+ : __streambuf_type(), _M_file(NULL), _M_state_cur(__state_type()),
+ _M_state_beg(__state_type()), _M_last_overflowed(false)
{ _M_fcvt = &use_facet<__codecvt_type>(this->getloc()); }
template<typename _CharT, typename _Traits>
basic_filebuf<_CharT, _Traits>::
basic_filebuf(int __fd, const char* /*__name*/, ios_base::openmode __mode)
- : __streambuf_type(), _M_state_cur(), _M_state_beg(),
- _M_last_overflowed(false)
+ : __streambuf_type(), _M_state_cur(__state_type()),
+ _M_state_beg(__state_type()), _M_last_overflowed(false)
{
_M_fcvt = &use_facet<__codecvt_type>(this->getloc());
_M_filebuf_init();