Author: sebor
Date: Sat Mar 4 17:26:59 2006
New Revision: 383265
URL: http://svn.apache.org/viewcvs?rev=383265&view=rev
Log:
2006-03-04 Martin Sebor <[EMAIL PROTECTED]>
* istream.cc (_C_ipfx, _C_unsafe_get, _C_get, read, getline,
operator>>): Used direct initialization instead of copy
initialization for int_type objects.
(read): Eliminated an assumption about the return type of
int_type's assignment operator.
Modified:
incubator/stdcxx/trunk/include/istream.cc
Modified: incubator/stdcxx/trunk/include/istream.cc
URL:
http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/include/istream.cc?rev=383265&r1=383264&r2=383265&view=diff
==============================================================================
--- incubator/stdcxx/trunk/include/istream.cc (original)
+++ incubator/stdcxx/trunk/include/istream.cc Sat Mar 4 17:26:59 2006
@@ -115,7 +115,7 @@
}
else {
- const int_type __c = __rdbuf->sgetc ();
+ const int_type __c (__rdbuf->sgetc ());
if (traits_type::eq_int_type (__c, traits_type::eof ())) {
this->setstate (__errbits);
@@ -144,7 +144,7 @@
// of exceptions thrown from streambuf virtuals
for (; ; __rdbuf->sbumpc (), ++_C_gcount) {
- const int_type __c = __rdbuf->sgetc ();
+ const int_type __c (__rdbuf->sgetc ());
if (traits_type::eq_int_type (__c, traits_type::eof ())) {
this->setstate (__errbits);
@@ -178,7 +178,7 @@
ios_base::iostate __err = ios_base::goodbit;
// initialize in case sgetc() below throws
- int_type __c = traits_type::eof ();
+ int_type __c (traits_type::eof ());
_TRY {
@@ -232,7 +232,7 @@
_TRY {
for ( ; ; ) {
- int_type __c = this->rdbuf ()->sgetc ();
+ int_type __c (this->rdbuf ()->sgetc ());
if (traits_type::eq_int_type (__c, traits_type::eof ())) {
__err = ios_base::eofbit;
@@ -322,11 +322,12 @@
// handle 27.6.1.3, p17 and p18
if (0 == --__n && _C_nullterm & __flags) {
- int_type __c;
+ if (!__getline)
+ break;
- if ( !__getline
- || !traits_type::eq_int_type (__c = this->rdbuf
()->sgetc(),
- traits_type::eof ())
+ const int_type __c (this->rdbuf ()->sgetc ());
+
+ if ( !traits_type::eq_int_type (__c, traits_type::eof ())
&& !traits_type::eq_int_type (__c, __delim))
break;
@@ -336,7 +337,7 @@
}
// get (possibly extract) next char
- const int_type __c = _C_unsafe_get (&_C_gcount, __delim, __flags);
+ const int_type __c (_C_unsafe_get (&_C_gcount, __delim, __flags));
// eof or delimiter may terminate input
if ( traits_type::eq_int_type (__c, traits_type::eof())
@@ -612,7 +613,7 @@
}
else {
- const int_type __c = __rdbuf->sgetc ();
+ const int_type __c (__rdbuf->sgetc ());
if (traits_type::eq_int_type (__c, traits_type::eof ())) {
__err = ios_base::eofbit;
@@ -734,7 +735,7 @@
// no data in buffer, trigger underflow()
// note that streambuf may be unbuffered
- const int_type __c = __rdbuf->sgetc ();
+ const int_type __c (__rdbuf->sgetc ());
if (traits_type::eq_int_type (__c, traits_type::eof ())) {
traits_type::assign (__line [_C_gcount], char_type ());
@@ -821,7 +822,7 @@
for ( ; __maxlen != __i; ++__i, __rdbuf->sbumpc ()) {
- const _TYPENAME _Traits::int_type __c = __rdbuf->sgetc ();
+ const _TYPENAME _Traits::int_type __c (__rdbuf->sgetc ());
if (_Traits::eq_int_type (__c, _Traits::eof ())) {
__err = ios_base::eofbit;
@@ -938,7 +939,7 @@
// no data in buffer, trigger underflow()
// note that streambuf may be unbuffered
- const int_type __c = __rdbuf->sgetc ();
+ const int_type __c (__rdbuf->sgetc ());
if (_Traits::eq_int_type (__c, _Traits::eof ())) {
__err = ios_base::eofbit;
@@ -998,8 +999,8 @@
for ( ; ; ) {
- const _TYPENAME _Traits::int_type __c =
- __is.rdbuf ()->sgetc ();
+ const _TYPENAME _Traits::int_type
+ __c (__is.rdbuf ()->sgetc ());
if (_Traits::eq_int_type (__c, _Traits::eof ())) {
// 21.3.7.9, p7