+2000-05-03 Vadim Egorov <egorovv@mailandnews.com>
+ Benjamin Kosnik <bkoz@gnu.org>
+ Nathan Myers <ncm@cantrip.org>
+ Dietmar Kuehl <dietmar_kuehl@yahoo.com>
+
+ * bits/streambuf.tcc (basic_streambuf::xsgetn): Fix uflow case.
+ (basic_streambuf::xsputn): Make consistent.
+ * testsuite/27_io/filebuf.cc: Add tests.
+
2000-05-08 Steven King <sxking@uswest.net>
* bits/char_traits.h: use wchar_t utility functions for
// Stream buffer classes -*- C++ -*-
-// Copyright (C) 1997-1999 Free Software Foundation, Inc.
+// Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
if (__retval != __n)
{
- if (this->uflow() != traits_type::eof())
- ++__retval;
- else
- break;
+ int_type __c = this->uflow();
+ if (traits_type::eq_int_type(__c, traits_type::eof()))
+ break;
+
+ traits_type::assign(*__s++, traits_type::to_char_type(__c));
+ ++__retval;
}
}
}
bool __testout = _M_mode & ios_base::out;
if (!(__testput && __testout))
{
- char_type __c = *__s;
- char_type __overfc = this->overflow(__c);
- if (__c == __overfc)
+ int_type __c = traits_type::to_int_type(*__s);
+ int_type __overfc = this->overflow(__c);
+ if (traits_type::eq_int_type(__c, __overfc))
{
++__retval;
++__s;
return test;
}
+bool test04()
+{
+ using namespace std;
+ typedef istream::int_type int_type;
+
+ bool test = true;
+ ifstream ifs(name_02);
+ char buffer[] = "xxxxxxxxxx";
+ int_type len1 = ifs.rdbuf()->sgetn(buffer, sizeof(buffer));
+ test &= len1 == sizeof(buffer);
+ test &= buffer[0] == 'a';
-int main() {
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+ return test;
+}
+
+int main()
+{
test00();
test01();
test02();
test03();
+ test04();
return 0;
}