PR libstdc++/13217
* include/bits/fstream.tcc (underflow): Deal gracefully with
read errors: throw ios_base::failure.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@74506
138bc75d-0d04-0410-961f-
82ee72b054a4
+2003-12-10 Paolo Carlini <pcarlini@suse.de>
+
+ PR libstdc++/13217
+ * include/bits/fstream.tcc (underflow): Deal gracefully with
+ read errors: throw ios_base::failure.
+
2003-12-10 Benjamin Kosnik <bkoz@redhat.com>
PR libstdc++/10063
PR libstdc++/11544
PR libstdc++/11603
- * include/bits/fstream.tcc (underflow): Throw ios_base:failure
+ * include/bits/fstream.tcc (underflow): Throw ios_base::failure
upon incomplete or invalid byte sequences in the file.
* testsuite/27_io/basic_filebuf/underflow/wchar_t/11544-1.cc: New.
* testsuite/27_io/basic_filebuf/underflow/wchar_t/11544-2.cc: New.
streamsize __elen = _M_file.xsgetn(_M_ext_end, __rlen);
if (__elen == 0)
__got_eof = true;
+ else if (__elen == -1)
+ break;
_M_ext_end += __elen;
}
__throw_ios_failure("basic_filebuf::underflow "
"incomplete character in file");
}
- else
+ else if (__r == codecvt_base::error)
__throw_ios_failure("basic_filebuf::underflow "
"invalid byte sequence in file");
+ else
+ __throw_ios_failure("basic_filebuf::underflow "
+ "error reading the file");
}
return __ret;
}