// File based streams -*- C++ -*-
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
{
// Allocate internal buffer only if one doesn't already exist
// (either allocated or provided by the user via setbuf).
- if (!_M_buf_allocated && !this->_M_buf)
+ if (!_M_buf_allocated && !_M_buf)
{
- this->_M_buf = new char_type[this->_M_buf_size];
+ _M_buf = new char_type[_M_buf_size];
_M_buf_allocated = true;
}
}
{
if (_M_buf_allocated)
{
- delete [] this->_M_buf;
- this->_M_buf = NULL;
+ delete [] _M_buf;
+ _M_buf = NULL;
_M_buf_allocated = false;
}
delete [] _M_ext_buf;
if (this->is_open())
{
_M_allocate_internal_buffer();
- this->_M_mode = __mode;
+ _M_mode = __mode;
// Setup initial buffer to 'uncommitted' mode.
_M_reading = false;
{ __testfail = true; }
// NB: Do this here so that re-opened filebufs will be cool...
- this->_M_mode = ios_base::openmode(0);
- this->_M_pback_init = false;
+ _M_mode = ios_base::openmode(0);
+ _M_pback_init = false;
_M_destroy_internal_buffer();
_M_reading = false;
_M_writing = false;
showmanyc()
{
streamsize __ret = -1;
- const bool __testin = this->_M_mode & ios_base::in;
+ const bool __testin = _M_mode & ios_base::in;
if (__testin && this->is_open())
{
// For a stateful encoding (-1) the pending sequence might be just
underflow()
{
int_type __ret = traits_type::eof();
- const bool __testin = this->_M_mode & ios_base::in;
+ const bool __testin = _M_mode & ios_base::in;
if (__testin && !_M_writing)
{
// Check for pback madness, and if so swich back to the
return traits_type::to_int_type(*this->gptr());
// Get and convert input sequence.
- const size_t __buflen = this->_M_buf_size > 1
- ? this->_M_buf_size - 1 : 1;
+ const size_t __buflen = _M_buf_size > 1
+ ? _M_buf_size - 1 : 1;
// Will be set to true if ::read() returns 0 indicating EOF.
bool __got_eof = false;
pbackfail(int_type __i)
{
int_type __ret = traits_type::eof();
- const bool __testin = this->_M_mode & ios_base::in;
+ const bool __testin = _M_mode & ios_base::in;
if (__testin && !_M_writing)
{
// Remember whether the pback buffer is active, otherwise below
// we may try to store in it a second char (libstdc++/9761).
- const bool __testpb = this->_M_pback_init;
+ const bool __testpb = _M_pback_init;
const bool __testeof = traits_type::eq_int_type(__i, __ret);
int_type __tmp;
if (this->eback() < this->gptr())
{
int_type __ret = traits_type::eof();
const bool __testeof = traits_type::eq_int_type(__c, __ret);
- const bool __testout = this->_M_mode & ios_base::out;
+ const bool __testout = _M_mode & ios_base::out;
if (__testout && !_M_reading)
{
if (this->pbase() < this->pptr())
__ret = traits_type::not_eof(__c);
}
}
- else if (this->_M_buf_size > 1)
+ else if (_M_buf_size > 1)
{
// Overflow in 'uncommitted' mode: set _M_writing, set
// the buffer to the initial 'write' mode, and put __c
{
// Clear out pback buffer before going on to the real deal...
streamsize __ret = 0;
- if (this->_M_pback_init)
+ if (_M_pback_init)
{
if (__n > 0 && this->gptr() == this->eback())
{
// Optimization in the always_noconv() case, to be generalized in the
// future: when __n > __buflen we read directly instead of using the
// buffer repeatedly.
- const bool __testin = this->_M_mode & ios_base::in;
- const streamsize __buflen = this->_M_buf_size > 1 ? this->_M_buf_size - 1
+ const bool __testin = _M_mode & ios_base::in;
+ const streamsize __buflen = _M_buf_size > 1 ? _M_buf_size - 1
: 1;
if (__n > __buflen && __check_facet(_M_codecvt).always_noconv()
&& __testin && !_M_writing)
// future: when __n is sufficiently large we write directly instead of
// using the buffer.
streamsize __ret = 0;
- const bool __testout = this->_M_mode & ios_base::out;
+ const bool __testout = _M_mode & ios_base::out;
if (__check_facet(_M_codecvt).always_noconv()
&& __testout && !_M_reading)
{
streamsize __bufavail = this->epptr() - this->pptr();
// Don't mistake 'uncommitted' mode buffered with unbuffered.
- if (!_M_writing && this->_M_buf_size > 1)
- __bufavail = this->_M_buf_size - 1;
+ if (!_M_writing && _M_buf_size > 1)
+ __bufavail = _M_buf_size - 1;
const streamsize __limit = std::min(__chunk, __bufavail);
if (__n >= __limit)
{
if (!this->is_open())
if (__s == 0 && __n == 0)
- this->_M_buf_size = 1;
+ _M_buf_size = 1;
else if (__s && __n > 0)
{
// This is implementation-defined behavior, and assumes that
// position to host the overflow char of a full put area.
// When __n == 1, 1 position will be used for the get area
// and 0 for the put area, as in the unbuffered case above.
- this->_M_buf = __s;
- this->_M_buf_size = __n;
+ _M_buf = __s;
+ _M_buf_size = __n;
}
return this;
}
{
if (_M_codecvt_tmp
&& !__check_facet(_M_codecvt_tmp).always_noconv())
- __testvalid = this->seekoff(0, ios_base::cur, this->_M_mode)
+ __testvalid = this->seekoff(0, ios_base::cur, _M_mode)
!= pos_type(off_type(-1));
}
else
// File based streams -*- C++ -*-
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
{
// Length _M_in_cur moved in the pback buffer.
_M_pback_cur_save += this->gptr() != this->eback();
- this->setg(this->_M_buf, _M_pback_cur_save, _M_pback_end_save);
+ this->setg(_M_buf, _M_pback_cur_save, _M_pback_end_save);
_M_pback_init = false;
}
}
void
_M_set_buffer(streamsize __off)
{
- const bool __testin = this->_M_mode & ios_base::in;
- const bool __testout = this->_M_mode & ios_base::out;
+ const bool __testin = _M_mode & ios_base::in;
+ const bool __testout = _M_mode & ios_base::out;
if (__testin && __off > 0)
- this->setg(this->_M_buf, this->_M_buf, this->_M_buf + __off);
+ this->setg(_M_buf, _M_buf, _M_buf + __off);
else
- this->setg(this->_M_buf, this->_M_buf, this->_M_buf);
+ this->setg(_M_buf, _M_buf, _M_buf);
- if (__testout && __off == 0 && this->_M_buf_size > 1 )
- this->setp(this->_M_buf, this->_M_buf + this->_M_buf_size - 1);
+ if (__testout && __off == 0 && _M_buf_size > 1 )
+ this->setp(_M_buf, _M_buf + _M_buf_size - 1);
else
this->setp(NULL, NULL);
}