Mercurial > pidgin.yaz
diff libgaim/xmlnode.c @ 15351:682908b965cf
[gaim-migrate @ 18143]
A really great raw XMPP plugin.
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Wed, 17 Jan 2007 08:58:26 +0000 |
parents | c65def04fb44 |
children |
line wrap: on
line diff
--- a/libgaim/xmlnode.c Wed Jan 17 06:29:23 2007 +0000 +++ b/libgaim/xmlnode.c Wed Jan 17 08:58:26 2007 +0000 @@ -441,6 +441,7 @@ struct _xmlnode_parser_data { xmlnode *current; + gboolean error; }; static void @@ -453,7 +454,7 @@ xmlnode *node; int i; - if(!element_name) { + if(!element_name || xpd->error) { return; } else { if(xpd->current) @@ -486,7 +487,7 @@ { struct _xmlnode_parser_data *xpd = user_data; - if(!element_name || !xpd->current) + if(!element_name || !xpd->current || xpd->error) return; if(xpd->current->parent) { @@ -500,15 +501,22 @@ { struct _xmlnode_parser_data *xpd = user_data; - if(!xpd->current) + if(!xpd->current || xpd->error) return; - + if(!text || !text_len) return; xmlnode_insert_data(xpd->current, (const char*) text, text_len); } +static void +xmlnode_parser_error_libxml(void *user_data, const char *msg, ...) +{ + struct _xmlnode_parser_data *xpd = user_data; + xpd->error = TRUE; +} + static xmlSAXHandler xmlnode_parser_libxml = { .internalSubset = NULL, .isStandalone = NULL, @@ -532,7 +540,7 @@ .processingInstruction = NULL, .comment = NULL, .warning = NULL, - .error = NULL, + .error = xmlnode_parser_error_libxml, .fatalError = NULL, .getParameterEntity = NULL, .cdataBlock = NULL, @@ -564,6 +572,12 @@ xpd->current = NULL; } ret = xpd->current; + if (xpd->error) { + ret = NULL; + if (xpd->current) + xmlnode_free(xpd->current); + } + g_free(xpd); return ret; }