aboutsummaryrefslogtreecommitdiffstats
path: root/pattern.c
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@src.gnome.org>2005-09-04 12:01:57 +0000
committerDaniel Veillard <veillard@src.gnome.org>2005-09-04 12:01:57 +0000
commitf03a8cdacdce917d09972c65371953e8a57a2ac3 (patch)
tree760a7b7b12f2aad5a2aff6dc5cd6fca58491c8c5 /pattern.c
parent07b7200775ea3a6ac6bf676f57b470ef7cf0e0b3 (diff)
downloadandroid_external_libxml2-f03a8cdacdce917d09972c65371953e8a57a2ac3.tar.gz
android_external_libxml2-f03a8cdacdce917d09972c65371953e8a57a2ac3.tar.bz2
android_external_libxml2-f03a8cdacdce917d09972c65371953e8a57a2ac3.zip
fixing yet another pattern induced XPath bug #314282 reverted back last
* pattern.c xpath.c include/libxml/pattern.h: fixing yet another pattern induced XPath bug #314282 * relaxng.c: reverted back last change it was seriously broken Daniel
Diffstat (limited to 'pattern.c')
-rw-r--r--pattern.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/pattern.c b/pattern.c
index 7dc9f59c..a76a58c5 100644
--- a/pattern.c
+++ b/pattern.c
@@ -1635,6 +1635,14 @@ xmlStreamPushInternal(xmlStreamCtxtPtr stream,
*/
if (comp->nbStep == 0) {
/*
+ * / and . are handled at the XPath node set creation
+ * level by checking min depth
+ */
+ if (stream->flags & XML_PATTERN_XPATH) {
+ stream = stream->next;
+ continue; /* while */
+ }
+ /*
* For non-pattern like evaluation like XML Schema IDCs
* or traditional XPath expressions, this will match if
* we are at the first level only, otherwise on every level.
@@ -2157,7 +2165,33 @@ xmlPatternMaxDepth(xmlPatternPtr comp) {
comp = comp->next;
}
return(ret);
+}
+/**
+ * xmlPatternMinDepth:
+ * @comp: the precompiled pattern
+ *
+ * Check the minimum depth reachable by a pattern, 0 mean the / or . are
+ * part of the set.
+ *
+ * Returns -1 in case of error otherwise the depth,
+ *
+ */
+int
+xmlPatternMinDepth(xmlPatternPtr comp) {
+ int ret = 12345678;
+ if (comp == NULL)
+ return(-1);
+ while (comp != NULL) {
+ if (comp->stream == NULL)
+ return(-1);
+ if (comp->stream->nbStep < ret)
+ ret = comp->stream->nbStep;
+ if (ret == 0)
+ return(0);
+ comp = comp->next;
+ }
+ return(ret);
}
/**