Do not print an error message from expat if the error was "parsing finished"

This commit is contained in:
Florent Le Coz
2014-04-11 23:34:42 +02:00
parent f00f5c3ffb
commit d2a7fd129a
+3 -2
View File
@@ -55,7 +55,8 @@ XmppParser::~XmppParser()
int XmppParser::feed(const char* data, const int len, const bool is_final) int XmppParser::feed(const char* data, const int len, const bool is_final)
{ {
int res = XML_Parse(this->parser, data, len, is_final); int res = XML_Parse(this->parser, data, len, is_final);
if (res == 0) if (res == XML_STATUS_ERROR &&
(XML_GetErrorCode(this->parser) != XML_ERROR_FINISHED))
log_error("Xml_Parse encountered an error: " << log_error("Xml_Parse encountered an error: " <<
XML_ErrorString(XML_GetErrorCode(this->parser))) XML_ErrorString(XML_GetErrorCode(this->parser)))
return res; return res;
@@ -64,7 +65,7 @@ int XmppParser::feed(const char* data, const int len, const bool is_final)
int XmppParser::parse(const int len, const bool is_final) int XmppParser::parse(const int len, const bool is_final)
{ {
int res = XML_ParseBuffer(this->parser, len, is_final); int res = XML_ParseBuffer(this->parser, len, is_final);
if (res == 0) if (res == XML_STATUS_ERROR)
log_error("Xml_Parsebuffer encountered an error: " << log_error("Xml_Parsebuffer encountered an error: " <<
XML_ErrorString(XML_GetErrorCode(this->parser))); XML_ErrorString(XML_GetErrorCode(this->parser)));
return res; return res;