istream.tcc (getline): Tweaks.

2000-07-24  Benjamin Kosnik  <bkoz@purist.soma.redhat.com>

	* bits/istream.tcc (getline): Tweaks.

From-SVN: r35235
This commit is contained in:
Benjamin Kosnik 2000-07-24 20:47:37 +00:00 committed by Benjamin Kosnik
parent 9fed97f1bd
commit 020226e5f2
3 changed files with 13 additions and 4 deletions

View File

@ -1,10 +1,14 @@
2000-07-24 Benjamin Kosnik <bkoz@purist.soma.redhat.com>
* bits/istream.tcc (getline): Tweaks.
2000-07-23 Brent Verner <brent@rcfile.org> 2000-07-23 Brent Verner <brent@rcfile.org>
* bits/istream.tcc: istream::getline(char_type*, streamsize, * bits/istream.tcc: istream::getline(char_type*, streamsize,
char_type) make compliant char_type) make compliant
* testsuite/27_io/istream_unformatted.cc: test for compliant behavior * testsuite/27_io/istream_unformatted.cc: test for compliant behavior
2000-07-23 Benjamin Kosnik <bkoz@haight.constant.com> 2000-07-23 Benjamin Kosnik <bkoz@purist.soma.redhat.com>
* acinclude.m4 (enable_cshadow_headers): Fix problems with blddir * acinclude.m4 (enable_cshadow_headers): Fix problems with blddir
and srcdir used to define CSHADOW_INCLUDES.. and srcdir used to define CSHADOW_INCLUDES..

View File

@ -1520,7 +1520,7 @@ dnl Then, if any (well almost any) other make is called, and GNU make also
dnl exists, then the other make wraps the GNU make. dnl exists, then the other make wraps the GNU make.
dnl dnl
dnl @author John Darrington <j.darrington@elvis.murdoch.edu.au> dnl @author John Darrington <j.darrington@elvis.murdoch.edu.au>
dnl @version $Id: acinclude.m4,v 1.45 2000/07/21 20:59:23 gdr Exp $ dnl @version $Id: acinclude.m4,v 1.46 2000/07/24 16:33:55 bkoz Exp $
dnl dnl
dnl #### Changes for libstdc++-v3: reformatting and linewrapping; prepending dnl #### Changes for libstdc++-v3: reformatting and linewrapping; prepending
dnl #### GLIBCPP_ to the macro name; adding the :-make fallback in the dnl #### GLIBCPP_ to the macro name; adding the :-make fallback in the

View File

@ -626,21 +626,26 @@ namespace std {
try { try {
__streambuf_type* __sb = this->rdbuf(); __streambuf_type* __sb = this->rdbuf();
int_type __c = __sb->sbumpc(); int_type __c = __sb->sbumpc();
++_M_gcount;
const int_type __idelim = traits_type::to_int_type(__delim); const int_type __idelim = traits_type::to_int_type(__delim);
const int_type __eof = traits_type::eof(); const int_type __eof = traits_type::eof();
bool __testdelim = __c == __idelim; bool __testdelim = __c == __idelim;
bool __testeof = __c == __eof; bool __testeof = __c == __eof;
while (++_M_gcount < __n && !__testeof && !__testdelim) while (_M_gcount < __n && !__testeof && !__testdelim)
{ {
*__s++ = traits_type::to_char_type(__c); *__s++ = traits_type::to_char_type(__c);
__c = __sb->sbumpc(); __c = __sb->sbumpc();
++_M_gcount;
__testeof = __c == __eof; __testeof = __c == __eof;
__testdelim = __c == __idelim; __testdelim = __c == __idelim;
} }
if (__testeof) if (__testeof)
this->setstate(ios_base::eofbit); {
--_M_gcount;
this->setstate(ios_base::eofbit);
}
else if (!__testdelim) else if (!__testdelim)
{ {
--_M_gcount; --_M_gcount;