diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index d39279a980a..8df53e58caa 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,9 @@ +2001-01-08 Benjamin Kosnik + + * 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 reported by Chris G. Demetriou diff --git a/libstdc++-v3/include/bits/fpos.h b/libstdc++-v3/include/bits/fpos.h index 27792b04a84..197b80eaf71 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 diff --git a/libstdc++-v3/include/bits/fstream.tcc b/libstdc++-v3/include/bits/fstream.tcc index 72940ea87cd..e43e8a328e7 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 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 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();