From 163fe8b81e7d1f25d745936ca3812e1913d95389 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 9 May 2014 18:29:36 -0700 Subject: Use parsing exception as fall back for io error --- xml/parser.cxx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/xml/parser.cxx b/xml/parser.cxx index 28a17ce..db1a9d0 100644 --- a/xml/parser.cxx +++ b/xml/parser.cxx @@ -96,6 +96,9 @@ namespace xml pqname_ = &qname_; pvalue_ = &value_; + line_ = 0; + column_ = 0; + attr_i_ = 0; start_ns_i_ = 0; end_ns_i_ = 0; @@ -672,6 +675,12 @@ namespace xml is.read (b, static_cast (cap)); } + // If the caller hasn't configured the stream to use exceptions, + // then use the parsing exception to report an error. + // + if (is.bad () || (is.fail () && !is.eof ())) + throw parsing (*this, "io failure"); + bool eof (is.eof ()); s = XML_ParseBuffer (p_, static_cast (is.gcount ()), eof); -- cgit v1.1