# HG changeset patch # User Evan Schoenberg # Date 1215187640 0 # Node ID 0eca6c183d60db04a6cf67041c44ce4df5a5a8ad # Parent 1b3aea14661351ffb101c98edbcc7d6f6df792d6 xmlParseChunk() never returns less than 0. It retusn an error code from the xmlParserErrors enum. Success is indicated by XML_ERR_OK, which is 0 and is why this 'error check' coincidentally always passed. We now properly debug log xmlParseChunk()-returns errors and disconnect with the XML Parse error if there is a failure. Refinements to follow. diff -r 1b3aea146613 -r 0eca6c183d60 libpurple/protocols/jabber/parser.c --- a/libpurple/protocols/jabber/parser.c Fri Jul 04 15:41:26 2008 +0000 +++ b/libpurple/protocols/jabber/parser.c Fri Jul 04 16:07:20 2008 +0000 @@ -199,12 +199,16 @@ void jabber_parser_process(JabberStream *js, const char *buf, int len) { + int ret; + if (js->context == NULL) { /* libxml inconsistently starts parsing on creating the * parser, so do a ParseChunk right afterwards to force it. */ js->context = xmlCreatePushParserCtxt(&jabber_parser_libxml, js, buf, len, NULL); xmlParseChunk(js->context, "", 0, 0); - } else if (xmlParseChunk(js->context, buf, len, 0) < 0) { + } else if ((ret = xmlParseChunk(js->context, buf, len, 0)) != XML_ERR_OK) { + purple_debug_error("jabber", "xmlParseChunk returned error %i", ret); + purple_connection_error_reason (js->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("XML Parse error"));