From 2977e42b2fd9b0813e1b2b06004587ccd18588e7 Mon Sep 17 00:00:00 2001 From: KNnut <9387720+KNnut@users.noreply.github.com> Date: Mon, 20 Nov 2023 16:04:05 +0800 Subject: [PATCH 1/4] Fix xml2_init.cpp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit xml2_init.cpp: In function ‘SEXPREC* init_libxml2()’: xml2_init.cpp:46:35: error: invalid conversion from ‘void (*)(void*, xmlError*)’ {aka ‘void (*)(void*, _xmlError*)’} to ‘xmlStructuredErrorFunc’ {aka ‘void (*)(void*, const _xmlError*)’} [-fpermissive] 46 | xmlSetStructuredErrorFunc(NULL, handleStructuredError); | ^~~~~~~~~~~~~~~~~~~~~ | | | void (*)(void*, xmlError*) {aka void (*)(void*, _xmlError*)} In file included from xml2_init.cpp:8: /usr/include/libxml2/libxml/xmlerror.h:898:57: note: initializing argument 2 of ‘void xmlSetStructuredErrorFunc(void*, xmlStructuredErrorFunc)’ 898 | xmlStructuredErrorFunc handler); | ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~ make: *** [/usr/lib64/R/etc/Makeconf:200: xml2_init.o] Error 1 ERROR: compilation failed for package ‘xml2’ --- src/xml2_init.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/xml2_init.cpp b/src/xml2_init.cpp index b89c64a..146d802 100644 --- a/src/xml2_init.cpp +++ b/src/xml2_init.cpp @@ -10,7 +10,7 @@ #include #include "xml2_utils.h" -void handleStructuredError(void* userData, xmlError* error) { +void handleStructuredError(void* userData, const xmlError* error) { BEGIN_CPP std::string message = std::string(error->message); -- 2.42.0 From 44b37495c8a37da2d9485706ad9dc0f0bf569901 Mon Sep 17 00:00:00 2001 From: KNnut <9387720+KNnut@users.noreply.github.com> Date: Mon, 20 Nov 2023 16:08:05 +0800 Subject: [PATCH 2/4] Fix xml2_schema.cpp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit xml2_schema.cpp: In function ‘SEXPREC* doc_validate(SEXP, SEXP)’: xml2_schema.cpp:25:3: error: ‘xmlLineNumbersDefault’ was not declared in this scope 25 | xmlLineNumbersDefault(1); | ^~~~~~~~~~~~~~~~~~~~~ xml2_schema.cpp:33:44: error: invalid conversion from ‘void (*)(void*, xmlError*)’ {aka ‘void (*)(void*, _xmlError*)’} to ‘xmlStructuredErrorFunc’ {aka ‘void (*)(void*, const _xmlError*)’} [-fpermissive] 33 | xmlSchemaSetParserStructuredErrors(cptr, handleSchemaError, &vec); | ^~~~~~~~~~~~~~~~~ | | | void (*)(void*, xmlError*) {aka void (*)(void*, _xmlError*)} In file included from xml2_schema.cpp:5: /usr/include/libxml2/libxml/xmlschemas.h:156:65: note: initializing argument 2 of ‘void xmlSchemaSetParserStructuredErrors(xmlSchemaParserCtxtPtr, xmlStructuredErrorFunc, void*)’ 156 | xmlStructuredErrorFunc serror, | ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~ xml2_schema.cpp:39:43: error: invalid conversion from ‘void (*)(void*, xmlError*)’ {aka ‘void (*)(void*, _xmlError*)’} to ‘xmlStructuredErrorFunc’ {aka ‘void (*)(void*, const _xmlError*)’} [-fpermissive] 39 | xmlSchemaSetValidStructuredErrors(vptr, handleSchemaError, &vec); | ^~~~~~~~~~~~~~~~~ | | | void (*)(void*, xmlError*) {aka void (*)(void*, _xmlError*)} /usr/include/libxml2/libxml/xmlschemas.h:185:65: note: initializing argument 2 of ‘void xmlSchemaSetValidStructuredErrors(xmlSchemaValidCtxtPtr, xmlStructuredErrorFunc, void*)’ 185 | xmlStructuredErrorFunc serror, | ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~ make: *** [/usr/lib64/R/etc/Makeconf:200: xml2_schema.o] Error 1 xml2_schema.cpp: In function ‘SEXPREC* doc_validate(SEXP, SEXP)’: xml2_schema.cpp:25:3: error: ‘xmlLineNumbersDefault’ was not declared in this scope 25 | xmlLineNumbersDefault(1); | ^~~~~~~~~~~~~~~~~~~~~ make: *** [/usr/lib64/R/etc/Makeconf:200: xml2_schema.o] Error 1 --- src/xml2_schema.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/xml2_schema.cpp b/src/xml2_schema.cpp index dfe37e5..36cdfbb 100644 --- a/src/xml2_schema.cpp +++ b/src/xml2_schema.cpp @@ -1,12 +1,13 @@ #include +#include #include #include "xml2_types.h" #include #include #include "xml2_utils.h" -void handleSchemaError(void* userData, xmlError* error) { +void handleSchemaError(void* userData, const xmlError* error) { std::vector * vec = (std::vector *) userData; std::string message = std::string(error->message); message.resize(message.size() - 1); -- 2.42.0 From 6edd3384bb372657c335d13a42cd7df8db59b239 Mon Sep 17 00:00:00 2001 From: KNnut <9387720+KNnut@users.noreply.github.com> Date: Wed, 22 Nov 2023 12:56:35 +0800 Subject: [PATCH 3/4] also works in older version libxml2 --- src/xml2_init.cpp | 11 +++++++++++ src/xml2_schema.cpp | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/src/xml2_init.cpp b/src/xml2_init.cpp index 146d802..779157f 100644 --- a/src/xml2_init.cpp +++ b/src/xml2_init.cpp @@ -10,7 +10,18 @@ #include #include "xml2_utils.h" +/* * * + * Author: Nick Wellnhofer + * Date: Thu, 21 Sep 2023 23:52:52 +0200 + * https://github.com/GNOME/libxml2/commit/45470611b047db78106dcb2fdbd4164163c15ab7 + * + * error: Make xmlGetLastError return a const error + */ +#if defined(LIBXML_VERSION) && (LIBXML_VERSION >= 21200) void handleStructuredError(void* userData, const xmlError* error) { +#else +void handleStructuredError(void* userData, xmlError* error) { +#endif BEGIN_CPP std::string message = std::string(error->message); diff --git a/src/xml2_schema.cpp b/src/xml2_schema.cpp index 36cdfbb..ad26073 100644 --- a/src/xml2_schema.cpp +++ b/src/xml2_schema.cpp @@ -7,7 +7,18 @@ #include #include "xml2_utils.h" +/* * * + * Author: Nick Wellnhofer + * Date: Thu, 21 Sep 2023 23:52:52 +0200 + * https://github.com/GNOME/libxml2/commit/45470611b047db78106dcb2fdbd4164163c15ab7 + * + * error: Make xmlGetLastError return a const error + */ +#if defined(LIBXML_VERSION) && (LIBXML_VERSION >= 21200) void handleSchemaError(void* userData, const xmlError* error) { +#else +void handleSchemaError(void* userData, xmlError* error) { +#endif std::vector * vec = (std::vector *) userData; std::string message = std::string(error->message); message.resize(message.size() - 1); -- 2.42.0 From 1a43a7253e2dde1543405a6c29345e5501ca99a3 Mon Sep 17 00:00:00 2001 From: KNnut <9387720+KNnut@users.noreply.github.com> Date: Wed, 22 Nov 2023 14:49:58 +0800 Subject: [PATCH 4/4] better info --- src/xml2_init.cpp | 6 +++--- src/xml2_schema.cpp | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/xml2_init.cpp b/src/xml2_init.cpp index 779157f..74ddd36 100644 --- a/src/xml2_init.cpp +++ b/src/xml2_init.cpp @@ -12,10 +12,10 @@ /* * * * Author: Nick Wellnhofer - * Date: Thu, 21 Sep 2023 23:52:52 +0200 - * https://github.com/GNOME/libxml2/commit/45470611b047db78106dcb2fdbd4164163c15ab7 + * Date: Tue, 24 Oct 2023 15:02:36 +0200 + * https://github.com/GNOME/libxml2/commit/61034116d0a3c8b295c6137956adc3ae55720711 * - * error: Make xmlGetLastError return a const error + * error: Make more xmlError structs constant */ #if defined(LIBXML_VERSION) && (LIBXML_VERSION >= 21200) void handleStructuredError(void* userData, const xmlError* error) { diff --git a/src/xml2_schema.cpp b/src/xml2_schema.cpp index ad26073..ec9d9c1 100644 --- a/src/xml2_schema.cpp +++ b/src/xml2_schema.cpp @@ -9,10 +9,10 @@ /* * * * Author: Nick Wellnhofer - * Date: Thu, 21 Sep 2023 23:52:52 +0200 - * https://github.com/GNOME/libxml2/commit/45470611b047db78106dcb2fdbd4164163c15ab7 + * Date: Tue, 24 Oct 2023 15:02:36 +0200 + * https://github.com/GNOME/libxml2/commit/61034116d0a3c8b295c6137956adc3ae55720711 * - * error: Make xmlGetLastError return a const error + * error: Make more xmlError structs constant */ #if defined(LIBXML_VERSION) && (LIBXML_VERSION >= 21200) void handleSchemaError(void* userData, const xmlError* error) { -- 2.42.0