diff options
author | Paolo Carlini <pcarlini@suse.de> | 2004-11-26 20:34:27 +0000 |
---|---|---|
committer | Paolo Carlini <pcarlini@suse.de> | 2004-11-26 20:34:27 +0000 |
commit | 8551be96699d651df3583d649dc76fb77f3e2a34 (patch) | |
tree | b5be3c1e292bc1d5153f23e0b397d3ec01a857d4 /libstdc++-v3/src | |
parent | 40d9dde23663a7e7821b15be5f14a68167c046bc (diff) |
2004-11-26 Paolo Carlini <pcarlini@suse.de>
DR 243. get and getline when sentry reports failure [WP]
* include/bits/istream.tcc (istream<>::get, istream<>::getline):
Store a null character only if the array has a non-zero size.
* src/istream.cc (istream<char>::getline, istream<wchar_t>::getline):
Likewise.
* testsuite/27_io/basic_istream/get/char/3.cc: New.
* testsuite/27_io/basic_istream/getline/char/6.cc: New.
* testsuite/27_io/basic_istream/getline/wchar_t/6.cc: New.
* docs/html/ext/howto.html: Add an entry for DR 243.
* testsuite/27_io/basic_istream/getline/wchar_t/1.cc: New.
* testsuite/27_io/basic_istream/getline/wchar_t/2.cc: New.
* testsuite/27_io/basic_istream/getline/wchar_t/3.cc: New.
* testsuite/27_io/basic_istream/getline/wchar_t/4.cc: New.
* testsuite/27_io/basic_istream/getline/wchar_t/5.cc: New.
git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@91348 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/src')
-rw-r--r-- | libstdc++-v3/src/istream.cc | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/libstdc++-v3/src/istream.cc b/libstdc++-v3/src/istream.cc index 462824dada9..39de7538f0d 100644 --- a/libstdc++-v3/src/istream.cc +++ b/libstdc++-v3/src/istream.cc @@ -94,7 +94,10 @@ namespace std catch(...) { this->_M_setstate(ios_base::badbit); } } - *__s = char_type(); + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 243. get and getline when sentry reports failure. + if (__n > 0) + *__s = char_type(); if (!_M_gcount) __err |= ios_base::failbit; if (__err) @@ -358,7 +361,10 @@ namespace std catch(...) { this->_M_setstate(ios_base::badbit); } } - *__s = char_type(); + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 243. get and getline when sentry reports failure. + if (__n > 0) + *__s = char_type(); if (!_M_gcount) __err |= ios_base::failbit; if (__err) |