72991e3
From ea7b3731b1a8a0f2fb7aa765a84374658b67b1b7 Mon Sep 17 00:00:00 2001
72991e3
From: Sixu Hu <husixu1@hotmail.com>
72991e3
Date: Wed, 22 Nov 2023 00:54:10 +0800
72991e3
Subject: [PATCH] Fix compatibility with libxml 2.12
72991e3
72991e3
---
72991e3
 src/main.c     | 6 ++++--
72991e3
 src/metadata.c | 7 +++++--
72991e3
 2 files changed, 9 insertions(+), 4 deletions(-)
72991e3
72991e3
diff --git a/src/main.c b/src/main.c
72991e3
index 26b4c512..7182b75b 100644
72991e3
--- a/src/main.c
72991e3
+++ b/src/main.c
72991e3
@@ -271,8 +271,10 @@ readCoreXmlCallback (void *context,
72991e3
     i += compReadXmlChunk ("</screen></core></compiz>", &offset, buffer + i,
72991e3
 			   length - i);
72991e3
 
72991e3
-    if (!offset && length > i)
72991e3
-	buffer[i++] = '\0';
72991e3
+    if (!offset && length > i) {
72991e3
+	    // buffer[i] = '\0';
72991e3
+        ctx->offset += 1;
72991e3
+    }
72991e3
 
72991e3
     ctx->offset += i;
72991e3
 
72991e3
diff --git a/src/metadata.c b/src/metadata.c
72991e3
index 3c1fa9ff..559734aa 100644
72991e3
--- a/src/metadata.c
72991e3
+++ b/src/metadata.c
72991e3
@@ -30,6 +30,7 @@
72991e3
 #include <libxml/xpath.h>
72991e3
 #include <libxml/xpathInternals.h>
72991e3
 #include <locale.h>
72991e3
+#include <stdlib.h>
72991e3
 
72991e3
 #include <compiz-core.h>
72991e3
 
72991e3
@@ -285,8 +286,10 @@ readPluginXmlCallback (void *context,
72991e3
     i += compReadXmlChunk ("</plugin></compiz>", &offset, buffer + i,
72991e3
 			   length - i);
72991e3
 
72991e3
-    if (!offset && length > i)
72991e3
-	buffer[i++] = '\0';
72991e3
+    if (!offset && length > i) {
72991e3
+	    // buffer[i] = '\0';
72991e3
+        ctx->offset += 1;
72991e3
+    }
72991e3
 
72991e3
     ctx->offset += i;
72991e3
 
72991e3
-- 
72991e3
GitLab
72991e3