summaryrefslogtreecommitdiff
path: root/libstdc++-v3/include
diff options
context:
space:
mode:
authorbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>2001-01-08 23:51:57 +0000
committerbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>2001-01-08 23:51:57 +0000
commita4c9d2729e584f18f348d5f73b494f2e969b3a1b (patch)
tree870f1350c7c1c6a76c407cc0c7cbbc5745ea0e4c /libstdc++-v3/include
parent9007522bf97494be0eb119dc7a5daa5207755acf (diff)
downloadgcc-a4c9d2729e584f18f348d5f73b494f2e969b3a1b.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@38809 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include')
-rw-r--r--libstdc++-v3/include/bits/fpos.h35
-rw-r--r--libstdc++-v3/include/bits/fstream.tcc10
2 files changed, 21 insertions, 24 deletions
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<typename _State>
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<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();