comparison libpurple/xmlnode.c @ 25586:f424f26dd329

*** Plucked rev d34a1589 (darkrain42@pidgin.im): Feed a fake </stream:stream> to the XMPP parser to silence warnings. Upgrading to TLS and disconnecting should no longer emit 'Extra content at the end of the document' References #8830. *** Plucked rev ca9f6d5b (darkrain42@pidgin.im): Add xmlnode and bonjour structured error handlers. Various libraries may set global structured error handlers and libxml2 prefers those to a per-context normal error handler. This causes us to break badly. References #8830. *** Plucked rev 34f4897e (darkrain42@pidgin.im): xmlCtxtGetLastError may return NULL, especially with other misbehaving libraries in our address space. References #8136.
author Paul Aurich <paul@darkrain42.org>
date Wed, 29 Apr 2009 20:57:53 +0000
parents efde7e6ed5f2
children 01f1929d0936
comparison
equal deleted inserted replaced
25585:3ebd399dd81e 25586:f424f26dd329
661 va_start(args, msg); 661 va_start(args, msg);
662 vsnprintf(errmsg, sizeof(errmsg), msg, args); 662 vsnprintf(errmsg, sizeof(errmsg), msg, args);
663 va_end(args); 663 va_end(args);
664 664
665 purple_debug_error("xmlnode", "Error parsing xml file: %s", errmsg); 665 purple_debug_error("xmlnode", "Error parsing xml file: %s", errmsg);
666 }
667
668 static void
669 xmlnode_parser_structural_error_libxml(void *user_data, xmlErrorPtr error)
670 {
671 struct _xmlnode_parser_data *xpd = user_data;
672
673 if (error && (error->level == XML_ERR_ERROR ||
674 error->level == XML_ERR_FATAL)) {
675 xpd->error = TRUE;
676 purple_debug_error("xmlnode", "XML parser error for xmlnode %p: "
677 "Domain %i, code %i, level %i: %s",
678 user_data, error->domain, error->code, error->level,
679 error->message ? error->message : "(null)\n");
680 } else if (error)
681 purple_debug_warning("xmlnode", "XML parser error for xmlnode %p: "
682 "Domain %i, code %i, level %i: %s",
683 user_data, error->domain, error->code, error->level,
684 error->message ? error->message : "(null)\n");
685 else
686 purple_debug_warning("xmlnode", "XML parser error for xmlnode %p\n",
687 user_data);
666 } 688 }
667 689
668 static xmlSAXHandler xmlnode_parser_libxml = { 690 static xmlSAXHandler xmlnode_parser_libxml = {
669 NULL, /* internalSubset */ 691 NULL, /* internalSubset */
670 NULL, /* isStandalone */ 692 NULL, /* isStandalone */
695 NULL, /* externalSubset */ 717 NULL, /* externalSubset */
696 XML_SAX2_MAGIC, /* initialized */ 718 XML_SAX2_MAGIC, /* initialized */
697 NULL, /* _private */ 719 NULL, /* _private */
698 xmlnode_parser_element_start_libxml, /* startElementNs */ 720 xmlnode_parser_element_start_libxml, /* startElementNs */
699 xmlnode_parser_element_end_libxml, /* endElementNs */ 721 xmlnode_parser_element_end_libxml, /* endElementNs */
700 NULL, /* serror */ 722 xmlnode_parser_structural_error_libxml, /* serror */
701 }; 723 };
702 724
703 xmlnode * 725 xmlnode *
704 xmlnode_from_str(const char *str, gssize size) 726 xmlnode_from_str(const char *str, gssize size)
705 { 727 {