output-only filebufs.
* include/std/std_fstream.h (basic_filebuf::_M_set_indeterminate):
Likewise.
(basic_filebuf::_M_set_determinate): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@52685
138bc75d-0d04-0410-961f-
82ee72b054a4
2002-04-23 Jason Merrill <jason@redhat.com>
+ * include/bits/fstream.tcc (basic_filebuf::seekoff): Fix for
+ output-only filebufs.
+ * include/std/std_fstream.h (basic_filebuf::_M_set_indeterminate):
+ Likewise.
+ (basic_filebuf::_M_set_determinate): Likewise.
+
PR libstdc++/6414
* include/bits/fstream.tcc (basic_filebuf::seekoff): Adjust return
value properly in the trivial case.
else
{
__ret = _M_file.seekoff(__off, ios_base::cur, __mode);
- __ret += _M_in_cur - _M_filepos;
+ __ret += max(_M_out_cur, _M_in_cur) - _M_filepos;
}
}
_M_last_overflowed = false;
this->setg(_M_buf, _M_buf, _M_buf);
if (_M_mode & ios_base::out)
this->setp(_M_buf, _M_buf);
- _M_filepos = _M_in_end;
+ _M_filepos = _M_buf;
}
void
this->setg(_M_buf, _M_buf, _M_buf + __off);
if (__testout)
this->setp(_M_buf, _M_buf + __off);
- _M_filepos = _M_in_end;
+ _M_filepos = _M_buf + __off;
}
bool
pos06 = is03.tellp();
VERIFY( pos05 == pos06 );
+ // libstdc++/6414
+ if01.seekg(0, std::ios_base::beg);
+ pos01 = if01.tellg();
+ if01.peek();
+ pos02 = if01.tellg();
+ VERIFY( pos02 == pos01 );
+
#ifdef DEBUG_ASSERT
assert(test);
#endif