1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-10-20 03:52:25 +03:00

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
This commit is contained in:
Daniel Veillard
2005-09-04 12:01:57 +00:00
parent 07b7200775
commit f03a8cdacd
5 changed files with 62 additions and 7 deletions

View File

@@ -1634,6 +1634,14 @@ xmlStreamPushInternal(xmlStreamCtxtPtr stream,
* Fast check for ".".
*/
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
@@ -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);
}
/**