From: <vac...@us...> - 2009-05-17 18:56:31
|
Revision: 142 http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=142&view=rev Author: vaclavslavik Date: 2009-05-17 18:56:30 +0000 (Sun, 17 May 2009) Log Message: ----------- fixed event_parser::parse_stream() to return false on empty input (patch #2787836 by Michael Grundberg) Modified Paths: -------------- trunk/AUTHORS trunk/NEWS trunk/src/libxml/event_parser.cxx Modified: trunk/AUTHORS =================================================================== --- trunk/AUTHORS 2009-05-16 15:04:35 UTC (rev 141) +++ trunk/AUTHORS 2009-05-17 18:56:30 UTC (rev 142) @@ -13,3 +13,4 @@ Daniel Evison Frank Grimm Gary Passero + Michael Grundberg <mgr...@us...> Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2009-05-16 15:04:35 UTC (rev 141) +++ trunk/NEWS 2009-05-17 18:56:30 UTC (rev 142) @@ -1,5 +1,8 @@ Added Visual C++ 200x projects and fixed VC6 project. + Fixed xml::event_parser::parse_stream() to return false on empty + input (Michael Grundberg, #2787836). + Version 0.6.0 Fixed libxmlwrapp to not depend on libxslt if XSLT support Modified: trunk/src/libxml/event_parser.cxx =================================================================== --- trunk/src/libxml/event_parser.cxx 2009-05-16 15:04:35 UTC (rev 141) +++ trunk/src/libxml/event_parser.cxx 2009-05-17 18:56:30 UTC (rev 142) @@ -124,6 +124,13 @@ bool xml::event_parser::parse_stream (std::istream &stream) { char buffer[const_buffer_size]; + if (stream && (stream.eof() || stream.peek() == std::istream::traits_type::eof())) + { + pimpl_->parser_status_ = false; + pimpl_->last_error_message_ = "empty xml document"; + return false; + } + while (pimpl_->parser_status_ && (stream.read(buffer, const_buffer_size) || stream.gcount())) pimpl_->parser_status_ = parse_chunk(buffer, stream.gcount()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |