From e995daa37529715214c6c4a2587e4134aaaba02f Mon Sep 17 00:00:00 2001 From: Nils Philippsen Date: Fri, 17 Nov 2023 23:26:06 +0100 Subject: [PATCH] Fix failure to build with libxml2 version 2.12 This declared some xmlError pointers const, which probably was always assumed, but not made explicit. Signed-off-by: Nils Philippsen --- gtk2_ardour/ardour_ui.cc | 8 ++++++-- libs/pbd/xml++.cc | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index 54ed79ea83d..77ddbbe99ca 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -255,7 +255,7 @@ libxml_generic_error_func (void* /* parsing_context*/, static void libxml_structured_error_func (void* /* parsing_context*/, - xmlErrorPtr err) + const xmlError *err) { string msg; @@ -403,7 +403,11 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir) /* stop libxml from spewing to stdout/stderr */ xmlSetGenericErrorFunc (this, libxml_generic_error_func); - xmlSetStructuredErrorFunc (this, libxml_structured_error_func); + + /* Cast to xmlStructuredErrorFunc to cope with different constness in different + * versions of libxml2. */ + + xmlSetStructuredErrorFunc (this, (xmlStructuredErrorFunc)libxml_structured_error_func); /* Set this up early */ diff --git a/libs/pbd/xml++.cc b/libs/pbd/xml++.cc index 5c57ad8395d..1f5a85772f6 100644 --- a/libs/pbd/xml++.cc +++ b/libs/pbd/xml++.cc @@ -170,7 +170,7 @@ XMLTree::write() const result = xmlSaveFormatFileEnc(_filename.c_str(), doc, "UTF-8", 1); #ifndef NDEBUG if (result == -1) { - xmlErrorPtr xerr = xmlGetLastError (); + const xmlError *xerr = xmlGetLastError (); if (!xerr) { std::cerr << "unknown XML error during xmlSaveFormatFileEnc()." << std::endl; } else {