mirror of git://gcc.gnu.org/git/gcc.git
streambuf.tcc (basic_streambuf::xsgetn): Fix uflow case.
2000-05-09 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. Co-Authored-By: Benjamin Kosnik <bkoz@gnu.org> Co-Authored-By: Dietmar Kuehl <dietmar_kuehl@yahoo.com> Co-Authored-By: Nathan Myers <ncm@cantrip.org> From-SVN: r33794
This commit is contained in:
parent
6b6c1201e6
commit
c0b84d79d2
|
@ -1,3 +1,12 @@
|
||||||
|
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>
|
2000-05-08 Steven King <sxking@uswest.net>
|
||||||
|
|
||||||
* bits/char_traits.h: use wchar_t utility functions for
|
* bits/char_traits.h: use wchar_t utility functions for
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Stream buffer classes -*- C++ -*-
|
// 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
|
// 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
|
// software; you can redistribute it and/or modify it under the
|
||||||
|
@ -145,10 +145,12 @@ namespace std {
|
||||||
|
|
||||||
if (__retval != __n)
|
if (__retval != __n)
|
||||||
{
|
{
|
||||||
if (this->uflow() != traits_type::eof())
|
int_type __c = this->uflow();
|
||||||
++__retval;
|
if (traits_type::eq_int_type(__c, traits_type::eof()))
|
||||||
else
|
break;
|
||||||
break;
|
|
||||||
|
traits_type::assign(*__s++, traits_type::to_char_type(__c));
|
||||||
|
++__retval;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -175,9 +177,9 @@ namespace std {
|
||||||
bool __testout = _M_mode & ios_base::out;
|
bool __testout = _M_mode & ios_base::out;
|
||||||
if (!(__testput && __testout))
|
if (!(__testput && __testout))
|
||||||
{
|
{
|
||||||
char_type __c = *__s;
|
int_type __c = traits_type::to_int_type(*__s);
|
||||||
char_type __overfc = this->overflow(__c);
|
int_type __overfc = this->overflow(__c);
|
||||||
if (__c == __overfc)
|
if (traits_type::eq_int_type(__c, __overfc))
|
||||||
{
|
{
|
||||||
++__retval;
|
++__retval;
|
||||||
++__s;
|
++__s;
|
||||||
|
|
|
@ -503,12 +503,31 @@ bool test03() {
|
||||||
return test;
|
return test;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool test04()
|
||||||
|
{
|
||||||
|
using namespace std;
|
||||||
|
typedef istream::int_type int_type;
|
||||||
|
|
||||||
int main() {
|
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';
|
||||||
|
|
||||||
|
#ifdef DEBUG_ASSERT
|
||||||
|
assert(test);
|
||||||
|
#endif
|
||||||
|
return test;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
test00();
|
test00();
|
||||||
test01();
|
test01();
|
||||||
test02();
|
test02();
|
||||||
test03();
|
test03();
|
||||||
|
test04();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue