diff options
author | Michael Orlitzky <michael@orlitzky.com> | 2024-02-07 22:08:18 -0500 |
---|---|---|
committer | John-Mark Bell <jmb@pexip.com> | 2024-02-08 20:36:52 +0000 |
commit | 251165e9d81815f0fc99eddffdc19e953aeac3d4 (patch) | |
tree | fca4a30afa7076de956d8f24843d6981121773af /bindings | |
parent | 885dba86dd2faef25444d576a7b8a367f2688ed9 (diff) | |
download | libdom-251165e9d81815f0fc99eddffdc19e953aeac3d4.tar.gz libdom-251165e9d81815f0fc99eddffdc19e953aeac3d4.tar.bz2 |
bindings/xml/libxml_xmlparser.c: update for libxml2 >= 2.12.0
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.
Diffstat (limited to 'bindings')
-rw-r--r-- | bindings/xml/libxml_xmlparser.c | 16 |
1 files changed, 16 insertions, 0 deletions
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; +#endif if (parser->err != DOM_NO_ERR) return; @@ -349,7 +353,11 @@ void xml_parser_end_document(void *ctx) dom_xml_parser *parser = (dom_xml_parser *) ctx; xmlNodePtr node; xmlNodePtr n; +#if LIBXML_VERSION >= 21200 + const xmlError *xmlerr; +#else xmlErrorPtr xmlerr; +#endif if (parser->err != DOM_NO_ERR) return; @@ -431,7 +439,11 @@ void xml_parser_start_element_ns(void *ctx, const xmlChar *localname, { dom_xml_parser *parser = (dom_xml_parser *) ctx; xmlNodePtr parent = parser->xml_ctx->node; +#if LIBXML_VERSION >= 21200 + const xmlError *xmlerr; +#else xmlErrorPtr xmlerr; +#endif if (parser->err != DOM_NO_ERR) return; @@ -510,7 +522,11 @@ void xml_parser_end_element_ns(void *ctx, const xmlChar *localname, dom_xml_parser *parser = (dom_xml_parser *) ctx; xmlNodePtr node = parser->xml_ctx->node; xmlNodePtr n; +#if LIBXML_VERSION >= 21200 + const xmlError *xmlerr; +#else xmlErrorPtr xmlerr; +#endif if (parser->err != DOM_NO_ERR) return; |