Removed 5 unnecessary dereferences (reported by Andriy, bug #301074).

* xmlschemas.c xmlregexp.c: Removed 5 unnecessary
  dereferences (reported by Andriy, bug #301074).
This commit is contained in:
Kasimier T. Buchcik 2005-04-19 15:02:20 +00:00
parent 3d42666362
commit c0e833f002
3 changed files with 32 additions and 15 deletions

View File

@ -1,3 +1,8 @@
Tue Apr 19 16:55:40 CEST 2005 Kasimier Buchcik <libxml2-cvs@cazic.net>
* xmlschemas.c xmlregexp.c: Removed 5 unnecessary
dereferences (reported by Andriy, bug #301074).
Tue Apr 19 22:33:18 HKT 2005 William Brack <wbrack@mmm.com.hk>
* xpath.c: Added some code to avoid integer overflow for

View File

@ -2635,14 +2635,14 @@ xmlRegStrEqualWildcard(const xmlChar *expStr, const xmlChar *valStr) {
do {
if (*valStr == XML_REG_STRING_SEPARATOR)
break;
*valStr++;
valStr++;
} while (*valStr != 0);
continue;
} else
return(0);
}
*expStr++;
*valStr++;
expStr++;
valStr++;
} while (*valStr != 0);
if (*expStr != 0)
return (0);

View File

@ -1883,14 +1883,14 @@ xmlSchemaVComplexTypeElemErr(xmlSchemaValidCtxtPtr ctxt,
end = cur;
if (*end == '*') {
localName = xmlStrdup(BAD_CAST "*");
*end++;
end++;
} else {
while ((*end != 0) && (*end != '|'))
end++;
localName = xmlStrncat(localName, BAD_CAST cur, end - cur);
}
if (*end != 0) {
*end++;
end++;
/*
* Skip "*|*" if they come with negated expressions, since
* they represent the same negated wildcard.
@ -11213,11 +11213,25 @@ xmlSchemaBuildAContentModel(xmlSchemaParserCtxtPtr ctxt,
} while (ns != NULL);
} else if (wild->negNsSet != NULL) {
xmlAutomataStatePtr deadEnd;
deadEnd = xmlAutomataNewState(ctxt->am);
ctxt->state = xmlAutomataNewTransition2(ctxt->am,
start, deadEnd, BAD_CAST "*", wild->negNsSet->value, wild);
/*
* Lead nodes with the negated namespace to the sink-state
* {"*", "##other"}.
*/
xmlAutomataNewTransition2(ctxt->am, start, NULL,
BAD_CAST "*", wild->negNsSet->value, wild);
/* ctxt->state =
* Capture those nodes with a transition which rejects
* everything {"", ""}.
*/
#if 0
xmlAutomataNewTransition2(ctxt->am, ctxt->state, NULL,
NULL, NULL, wild);
#endif
/*
* Open a door for nodes with any other namespace
* {"*", "*"}
*/
ctxt->state = xmlAutomataNewTransition2(ctxt->am,
start, NULL, BAD_CAST "*", BAD_CAST "*", wild);
xmlAutomataNewEpsilon(ctxt->am, ctxt->state, end);
@ -21881,22 +21895,20 @@ xmlSchemaValidateElementByWildcard(xmlSchemaValidCtxtPtr ctxt,
"bad arguments", NULL);
return (-1);
}
#if 0
if (wild->negNsSet != NULL) {
/*
* Workaround for negated namespaces.
* Don't process rejected namespaces.
*/
if (ctxt->node->ns != NULL) {
if (xmlSchemaMatchesWildcardNs(wild, ctxt->node->ns->href) == 0) {
ctxt->flags |= XML_SCHEMA_VALID_INVALID_NEG_WILDCARD;
/* ctxt->flags |= XML_SCHEMA_VALID_INVALID_NEG_WILDCARD; */
return (XML_SCHEMAV_ELEMENT_CONTENT);
}
} else if (xmlSchemaMatchesWildcardNs(wild, NULL) == 0) {
ctxt->flags |= XML_SCHEMA_VALID_INVALID_NEG_WILDCARD;
/* ctxt->flags |= XML_SCHEMA_VALID_INVALID_NEG_WILDCARD; */
return (XML_SCHEMAV_ELEMENT_CONTENT);
}
}
#endif
return(xmlSchemaValidateElementByWildcardInternal(ctxt,
wild, ctxt->node));
}