diff --git a/ChangeLog b/ChangeLog index 7b68300d..5e59a30f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Tue Apr 19 16:55:40 CEST 2005 Kasimier Buchcik + + * xmlschemas.c xmlregexp.c: Removed 5 unnecessary + dereferences (reported by Andriy, bug #301074). + Tue Apr 19 22:33:18 HKT 2005 William Brack * xpath.c: Added some code to avoid integer overflow for diff --git a/xmlregexp.c b/xmlregexp.c index 495f1c57..30ffdefd 100644 --- a/xmlregexp.c +++ b/xmlregexp.c @@ -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); diff --git a/xmlschemas.c b/xmlschemas.c index b29de7b0..eb8b865b 100644 --- a/xmlschemas.c +++ b/xmlschemas.c @@ -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)); }