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
This commit is contained in:
Benjamin Kosnik 2001-01-08 23:51:57 +00:00 committed by Benjamin Kosnik
parent 5bb11b2e20
commit 5a259aec51
3 changed files with 27 additions and 24 deletions

View File

@ -1,3 +1,9 @@
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> 2001-01-08 Benjamin Kosnik <bkoz@redhat.com>
reported by Chris G. Demetriou <cgd@sibyte.com> reported by Chris G. Demetriou <cgd@sibyte.com>

View File

@ -1,6 +1,6 @@
// File position object and stream types // 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 // 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 // software; you can redistribute it and/or modify it under the
@ -48,10 +48,14 @@ namespace std {
class fpos class fpos
{ {
public: public:
// Types: // Types:
typedef _StateT __state_type; typedef _StateT __state_type;
private:
__state_type _M_st;
streamoff _M_off;
public:
__state_type __state_type
state() const { return _M_st; } state() const { return _M_st; }
@ -60,37 +64,30 @@ namespace std {
// NB: The standard defines only the implicit copy ctor and the // NB: The standard defines only the implicit copy ctor and the
// previous two members. The rest is a "conforming extension". // 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) fpos(streamoff __off, __state_type __st = __state_type())
: _M_st(__st), _M_pos(__pos) { } : _M_st(__st), _M_off(__off) { }
fpos(streamoff __pos) operator streamoff() const { return _M_off; }
: _M_st(), _M_pos(__pos) { }
operator streamoff() const { return _M_pos; }
fpos& fpos&
operator+=(streamoff __off) { _M_pos += __off; return *this; } operator+=(streamoff __off) { _M_off += __off; return *this; }
fpos& fpos&
operator-=(streamoff __off) { _M_pos -= __off; return *this; } operator-=(streamoff __off) { _M_off -= __off; return *this; }
bool bool
operator==(const fpos& __pos2) const { return _M_pos == __pos2._M_pos; } operator==(const fpos& __pos) const { return _M_off == __pos._M_off; }
bool bool
operator!=(const fpos& __pos2) const { return _M_pos != __pos2._M_pos; } operator!=(const fpos& __pos) const { return _M_off != __pos._M_off; }
streamoff streamoff
_M_position() const { return _M_pos; } _M_position() const { return _M_off; }
void void
_M_position(streamoff __pos) { _M_pos = __pos; } _M_position(streamoff __off) { _M_off = __off; }
private:
__state_type _M_st;
streamoff _M_pos;
}; };
template<typename _State> template<typename _State>

View File

@ -1,6 +1,6 @@
// File based streams -*- C++ -*- // 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 // 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 // software; you can redistribute it and/or modify it under the
@ -79,15 +79,15 @@ namespace std
template<typename _CharT, typename _Traits> template<typename _CharT, typename _Traits>
basic_filebuf<_CharT, _Traits>:: basic_filebuf<_CharT, _Traits>::
basic_filebuf() basic_filebuf()
: __streambuf_type(), _M_file(NULL), _M_state_cur(), _M_state_beg(), : __streambuf_type(), _M_file(NULL), _M_state_cur(__state_type()),
_M_last_overflowed(false) _M_state_beg(__state_type()), _M_last_overflowed(false)
{ _M_fcvt = &use_facet<__codecvt_type>(this->getloc()); } { _M_fcvt = &use_facet<__codecvt_type>(this->getloc()); }
template<typename _CharT, typename _Traits> template<typename _CharT, typename _Traits>
basic_filebuf<_CharT, _Traits>:: basic_filebuf<_CharT, _Traits>::
basic_filebuf(int __fd, const char* /*__name*/, ios_base::openmode __mode) basic_filebuf(int __fd, const char* /*__name*/, ios_base::openmode __mode)
: __streambuf_type(), _M_state_cur(), _M_state_beg(), : __streambuf_type(), _M_state_cur(__state_type()),
_M_last_overflowed(false) _M_state_beg(__state_type()), _M_last_overflowed(false)
{ {
_M_fcvt = &use_facet<__codecvt_type>(this->getloc()); _M_fcvt = &use_facet<__codecvt_type>(this->getloc());
_M_filebuf_init(); _M_filebuf_init();