Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compilation with libxml2 2.12.0 #417

Merged
merged 7 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# xml2 (development version)

* Now compatible with limxml2 2.12.0 and later (@KNnut).

* Fix format string issues detected in R-devel.

* `xml_serialize()` now includes the document type so that `xml_unserialize()` works also for HTML documents (#407, @HenrikBengtsson).
Expand Down
11 changes: 11 additions & 0 deletions src/xml2_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,18 @@
#include <string>
#include "xml2_utils.h"

/* * *
* Author: Nick Wellnhofer <wellnhofer@aevum.de>
* Date: Tue, 24 Oct 2023 15:02:36 +0200
* /~https://github.com/GNOME/libxml2/commit/61034116d0a3c8b295c6137956adc3ae55720711
*
* error: Make more xmlError structs constant
*/
#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);
Expand Down
13 changes: 11 additions & 2 deletions src/xml2_schema.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,18 @@
#include "xml2_types.h"
#include "xml2_utils.h"

/* * *
* Author: Nick Wellnhofer <wellnhofer@aevum.de>
* Date: Tue, 24 Oct 2023 15:02:36 +0200
* /~https://github.com/GNOME/libxml2/commit/61034116d0a3c8b295c6137956adc3ae55720711
*
* error: Make more xmlError structs constant
*/
#if defined(LIBXML_VERSION) && (LIBXML_VERSION >= 21200)
void handleSchemaError(void* userData, const xmlError* error) {
#else
void handleSchemaError(void* userData, xmlError* error) {
#endif
std::vector<std::string> * vec = (std::vector<std::string> *) userData;
std::string message = std::string(error->message);
message.resize(message.size() - 1);
Expand All @@ -22,8 +33,6 @@ extern "C" SEXP doc_validate(SEXP doc_sxp, SEXP schema_sxp) {
XPtrDoc doc(doc_sxp);
XPtrDoc schema(schema_sxp);

xmlLineNumbersDefault(1);

BEGIN_CPP

std::vector<std::string> vec;
Expand Down
Loading