mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-08-05 13:27:09 +02:00
69 lines
1.8 KiB
Diff
69 lines
1.8 KiB
Diff
Source: https://src.fedoraproject.org/rpms/pidgin-sipe/blob/rawhide/f/pidgin-sipe-1.25.0-fix-libxml2-2.12-build.patch
|
|
---
|
|
From 8c37bad762decd3aad86cfe758187a610804b196 Mon Sep 17 00:00:00 2001
|
|
From: Stefan Becker <chemobejk@gmail.com>
|
|
Date: Mon, 22 Jan 2024 22:47:20 +0200
|
|
Subject: [PATCH 1/2] xml: update for libxml2 >= 2.12 API changes
|
|
|
|
- error callback is now passed a const error
|
|
- provide alternative implementation for the deprecated
|
|
xmlSAXUserParseMemory() API
|
|
---
|
|
src/core/sipe-xml.c | 31 ++++++++++++++++++++++++++++++-
|
|
1 file changed, 30 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/src/core/sipe-xml.c b/src/core/sipe-xml.c
|
|
index cfc53115..e69d6d02 100644
|
|
--- a/src/core/sipe-xml.c
|
|
+++ b/src/core/sipe-xml.c
|
|
@@ -154,7 +154,13 @@ static void callback_error(void *user_data, const char *msg, ...)
|
|
g_free(errmsg);
|
|
}
|
|
|
|
-static void callback_serror(void *user_data, xmlErrorPtr error)
|
|
+static void callback_serror(void *user_data,
|
|
+#if LIBXML_VERSION > 21200
|
|
+ const xmlError *error
|
|
+#else
|
|
+ xmlErrorPtr error
|
|
+#endif
|
|
+)
|
|
{
|
|
struct _parser_data *pd = user_data;
|
|
|
|
@@ -217,8 +223,31 @@ sipe_xml *sipe_xml_parse(const gchar *string, gsize length)
|
|
if (string && length) {
|
|
struct _parser_data *pd = g_new0(struct _parser_data, 1);
|
|
|
|
+#if LIBXML_VERSION > 21200
|
|
+ xmlParserCtxtPtr ctxt = xmlNewSAXParserCtxt(&parser, pd);
|
|
+
|
|
+ if (ctxt) {
|
|
+ xmlCtxtReadMemory(ctxt,
|
|
+ string,
|
|
+ length,
|
|
+ NULL,
|
|
+ NULL,
|
|
+ 0);
|
|
+
|
|
+ pd->error = !ctxt->wellFormed;
|
|
+
|
|
+ if (ctxt->myDoc) {
|
|
+ xmlFreeDoc(ctxt->myDoc);
|
|
+ ctxt->myDoc = NULL;
|
|
+ }
|
|
+
|
|
+ xmlFreeParserCtxt(ctxt);
|
|
+ } else
|
|
+ pd->error = TRUE;
|
|
+#else
|
|
if (xmlSAXUserParseMemory(&parser, pd, string, length))
|
|
pd->error = TRUE;
|
|
+#endif
|
|
|
|
if (pd->error) {
|
|
sipe_xml_free(pd->root);
|
|
--
|
|
2.43.0
|
|
|