aboutsummaryrefslogtreecommitdiff
path: root/audio/ardour/libxml2-2.12-fix.patch
blob: 00ebd0f4e223f7679a27a26347e05c1cbed9b749 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
From e995daa37529715214c6c4a2587e4134aaaba02f Mon Sep 17 00:00:00 2001
From: Nils Philippsen <nils@tiptoe.de>
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 <nils@tiptoe.de>
---
 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 {