gentoo-ebuilds/x11-plugins/pidgin-sipe/files/pidgin-sipe-1.25.0-libxml2.patch
Cristian Othón Martínez Vera 0bef22095f
x11-plugins/pidgin-sipe: fix compilation with libxml2 >= 2.12, fix tests, update HOMEPAGE
I bumped with this when I was trying to rebuild it after the libxml2 subslot op

Closes: https://bugs.gentoo.org/730118
Closes: https://bugs.gentoo.org/932640
Signed-off-by: Cristian Othón Martínez Vera <cfuga@cfuga.mx>
Part-of: https://github.com/gentoo/gentoo/pull/42536
Closes: https://github.com/gentoo/gentoo/pull/42536
Signed-off-by: Sam James <sam@gentoo.org>
2025-07-25 07:50:18 +01:00

63 lines
1.5 KiB
Diff

https://repo.or.cz/siplcs.git/commit/8c37bad762decd3aad86cfe758187a610804b196
Bug: https://bugs.gentoo.org/932640
From: Stefan Becker <chemobejk@gmail.com>
Date: Mon, 22 Jan 2024 22:47:20 +0200
Subject: [PATCH] xml: update for libxml2 >= 2.12 API changes
- error callback is now passed a const error
- provide alternative implementation for the deprecated
xmlSAXUserParseMemory() API
--- 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.11.4.GIT