+2002-11-05 Benjamin Kosnik <bkoz@redhat.com>
+
+ PR libstdc++/8258
+ * include/bits/istream.tcc (istream::readsome): Don't set eofbit
+ for null buffer.
+ (istream::operator>>(_CharT*)): Use traits_type.
+ (istream::ws): Same.
+ (istream::operator>>(string)): Same.
+ * testsuite/27_io/istream_unformatted.cc (test11): Add.
+
2002-11-05 Paolo Carlini <pcarlini@unitus.it>
PR libstdc++/8466
* configure.target (hppa*): Define cpu_include_dir.
* config/os/hpux/os_defines.h (_GLIBCPP_INST_ATOMICITY_LOCK): Define.
- * src/misc-inst.cc (std): Instantiate atomicity lock when
+ * src/misc-inst.cc: Instantiate atomicity lock when
_GLIBCPP_INST_ATOMICITY_LOCK is defined.
* config/cpu/hppa/atomicity.h: New file.
{
try
{
+ // Cannot compare int_type with streamsize generically.
streamsize __num = this->rdbuf()->in_avail();
- if (__num > 0)
+ if (__num >= 0)
{
__num = min(__num, __n);
if (__num)
int_type __c = __sb->sgetc();
while (__extracted < __num - 1
- && __c != __eof && !__ctype.is(ctype_base::space, __c))
+ && !_Traits::eq_int_type(__c, __eof)
+ && !__ctype.is(ctype_base::space, __c))
{
*__s++ = __c;
++__extracted;
__c = __sb->snextc();
}
- if (__c == __eof)
+ if (_Traits::eq_int_type(__c, __eof))
__in.setstate(ios_base::eofbit);
#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
__streambuf_type* __sb = __in.rdbuf();
__int_type __c = __sb->sgetc();
- while (__c != __eof && __ctype.is(ctype_base::space, __c))
+ while (!_Traits::eq_int_type(__c, __eof)
+ && __ctype.is(ctype_base::space, __c))
__c = __sb->snextc();
- if (__c == __eof)
+
+ if (_Traits::eq_int_type(__c, __eof))
__in.setstate(ios_base::eofbit);
return __in;
__int_type __c = __sb->sgetc();
while (__extracted < __n
- && __c != __eof && !__ctype.is(ctype_base::space, __c))
+ && !_Traits::eq_int_type(__c, __eof)
+ && !__ctype.is(ctype_base::space, __c))
{
__str += _Traits::to_char_type(__c);
++__extracted;
__c = __sb->snextc();
}
- if (__c == __eof)
+ if (_Traits::eq_int_type(__c, __eof))
__in.setstate(ios_base::eofbit);
__in.width(0);
}
VERIFY( test );
}
+
+// libstdc++/8258
+class mybuf : public std::basic_streambuf<char>
+{ };
+
+void test11()
+{
+ bool test = true;
+ using namespace std;
+ char arr[10];
+ mybuf sbuf;
+ basic_istream<char, char_traits<char> > istr(&sbuf);
+
+ VERIFY(istr.rdstate() == ios_base::goodbit);
+ VERIFY(istr.readsome(arr, 10) == 0);
+ VERIFY(istr.rdstate() == ios_base::goodbit);
+}
+
+
int
main()
{
test08();
test09();
test10();
-
+ test11();
return 0;
}