2001-01-08 Benjamin Kosnik <bkoz@redhat.com>
authorbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 8 Jan 2001 23:51:57 +0000 (23:51 +0000)
committerbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 8 Jan 2001 23:51:57 +0000 (23:51 +0000)
* 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

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/fpos.h
libstdc++-v3/include/bits/fstream.tcc

index d39279a..8df53e5 100644 (file)
@@ -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.
index 27792b0..197b80e 100644 (file)
@@ -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>
index 72940ea..e43e8a3 100644 (file)
@@ -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();