0004-Fix-comparison-with-root-node-in-xmlXPathCmpNodes.patch 934 B

12345678910111213141516171819202122232425262728293031323334
  1. From a005199330b86dada19d162cae15ef9bdcb6baa8 Mon Sep 17 00:00:00 2001
  2. From: Nick Wellnhofer <wellnhofer@aevum.de>
  3. Date: Tue, 28 Jun 2016 14:19:58 +0200
  4. Subject: [PATCH] Fix comparison with root node in xmlXPathCmpNodes
  5. This change has already been made in xmlXPathCmpNodesExt but not in
  6. xmlXPathCmpNodes.
  7. ---
  8. xpath.c | 4 ++--
  9. 1 file changed, 2 insertions(+), 2 deletions(-)
  10. diff --git a/xpath.c b/xpath.c
  11. index 751665b..d992841 100644
  12. --- a/xpath.c
  13. +++ b/xpath.c
  14. @@ -3342,13 +3342,13 @@ xmlXPathCmpNodes(xmlNodePtr node1, xmlNodePtr node2) {
  15. * compute depth to root
  16. */
  17. for (depth2 = 0, cur = node2;cur->parent != NULL;cur = cur->parent) {
  18. - if (cur == node1)
  19. + if (cur->parent == node1)
  20. return(1);
  21. depth2++;
  22. }
  23. root = cur;
  24. for (depth1 = 0, cur = node1;cur->parent != NULL;cur = cur->parent) {
  25. - if (cur == node2)
  26. + if (cur->parent == node2)
  27. return(-1);
  28. depth1++;
  29. }
  30. --
  31. 2.10.1