Version 2.12.0 of libxml2 changes a few functions to return (const
xmlError *) where previously they returned only (xmlError *).
Compilers generally are not happy with this. For example,
  bindings/xml/libxml_xmlparser.c: In function 'xml_parser_start_document':
  bindings/xml/libxml_xmlparser.c:327:16: error: assignment discards 'const'
  qualifier from pointer target type [-Werror=discarded-qualifiers]
  327 |         xmlerr = xmlCtxtGetLastError(parser->xml_ctx);
This commit adds a few #ifdefs to handle both versions of the API
cleanly. It's probably not the sexiest fix, but it's simple and gets
the job done.
---
 bindings/xml/libxml_xmlparser.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
diff --git a/bindings/xml/libxml_xmlparser.c b/bindings/xml/libxml_xmlparser.c
index 28aadf1..cd7f8ad 100644
--- a/bindings/xml/libxml_xmlparser.c
+++ b/bindings/xml/libxml_xmlparser.c
@@ -317,7 +317,11 @@ dom_xml_error dom_xml_parser_completed(dom_xml_parser *parser)
 void xml_parser_start_document(void *ctx)
 {
 	dom_xml_parser *parser = (dom_xml_parser *) ctx;
+#if LIBXML_VERSION >= 21200
+	const xmlError *xmlerr;
+#else
 	xmlErrorPtr xmlerr;
+
 
No comments:
Post a Comment