File: 0020-Clean-up-attributes-in-source-doc.patch

package info (click to toggle)
libxslt 1.1.35-1.2%2Bdeb13u2
  • links: PTS, VCS
  • area: main
  • in suites: trixie-proposed-updates
  • size: 30,068 kB
  • sloc: xml: 75,625; ansic: 34,784; sh: 4,249; makefile: 3,128; python: 3,060; javascript: 429; perl: 34
file content (53 lines) | stat: -rw-r--r-- 1,619 bytes parent folder | download | duplicates (4)
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 452fb4ca9b9803448826008b9573987c615912a1 Mon Sep 17 00:00:00 2001
From: Nick Wellnhofer <wellnhofer@aevum.de>
Date: Wed, 31 Aug 2022 21:37:44 +0200
Subject: [PATCH] Clean up attributes in source doc

Also make bit flag constants unsigned to avoid implicit-conversion
warnings.
---
 libxslt/transform.c | 10 ++++++++++
 libxslt/xsltutils.h |  6 +++---
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/libxslt/transform.c b/libxslt/transform.c
index 7489504f..38a70c62 100644
--- a/libxslt/transform.c
+++ b/libxslt/transform.c
@@ -5763,6 +5763,16 @@ xsltCleanupSourceDoc(xmlDocPtr doc) {
         if (psviPtr)
             *psviPtr = NULL;
 
+        if (cur->type == XML_ELEMENT_NODE) {
+            xmlAttrPtr prop = cur->properties;
+
+            while (prop) {
+                prop->atype &= ~(XSLT_SOURCE_NODE_MASK << 27);
+                prop->psvi = NULL;
+                prop = prop->next;
+            }
+        }
+
         if (cur->children != NULL && cur->type != XML_ENTITY_REF_NODE) {
             cur = cur->children;
         } else {
diff --git a/libxslt/xsltutils.h b/libxslt/xsltutils.h
index d858b04e..484032e7 100644
--- a/libxslt/xsltutils.h
+++ b/libxslt/xsltutils.h
@@ -245,9 +245,9 @@ XSLTPUBFUN xmlXPathCompExprPtr XSLTCALL
 						 int flags);
 
 #ifdef IN_LIBXSLT
-#define XSLT_SOURCE_NODE_MASK       15
-#define XSLT_SOURCE_NODE_HAS_KEY    1
-#define XSLT_SOURCE_NODE_HAS_ID     2
+#define XSLT_SOURCE_NODE_MASK       15u
+#define XSLT_SOURCE_NODE_HAS_KEY    1u
+#define XSLT_SOURCE_NODE_HAS_ID     2u
 int
 xsltGetSourceNodeFlags(xmlNodePtr node);
 int
-- 
2.47.2