summaryrefslogtreecommitdiff
path: root/xpath.c
diff options
context:
space:
mode:
authorWilliam M. Brack <wbrack@src.gnome.org>2007-06-06 17:19:24 +0000
committerWilliam M. Brack <wbrack@src.gnome.org>2007-06-06 17:19:24 +0000
commit97ac819cc650e5241303baa65b0fd04d112fd9e1 (patch)
tree5d2f3fb10da6e4eba7f992066576504ac7c61470 /xpath.c
parentd611c88a010fa7c64c407155e43b04bc4c7e9e38 (diff)
downloadlibxml2-97ac819cc650e5241303baa65b0fd04d112fd9e1.tar.gz
fixed problem with xmlXPathNodeSetSort; fixed problem with
* xpath.c: fixed problem with xmlXPathNodeSetSort; fixed problem with xmlXPathNodeTrailingSorted (both bug#413451) svn path=/trunk/; revision=3622
Diffstat (limited to 'xpath.c')
-rw-r--r--xpath.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/xpath.c b/xpath.c
index 209c2e90..8f6545a9 100644
--- a/xpath.c
+++ b/xpath.c
@@ -3194,6 +3194,11 @@ xmlXPathCmpNodesExt(xmlNodePtr node1, xmlNodePtr node2) {
turtle_comparison:
+ if (miscNode1 != NULL)
+ node1 = miscNode1;
+ if (miscNode2 != NULL)
+ node2 = miscNode2;
+
if (node1 == node2->prev)
return(1);
if (node1 == node2->next)
@@ -4612,12 +4617,13 @@ xmlXPathNodeTrailingSorted (xmlNodeSetPtr nodes, xmlNodePtr node) {
return(ret);
l = xmlXPathNodeSetGetLength(nodes);
- for (i = l; i > 0; i--) {
+ for (i = l - 1; i >= 0; i--) {
cur = xmlXPathNodeSetItem(nodes, i);
if (cur == node)
break;
xmlXPathNodeSetAddUnique(ret, cur);
}
+ xmlXPathNodeSetSort(ret); /* bug 413451 */
return(ret);
}