mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-30 22:43:14 +03:00
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:
@ -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>
|
Tue Apr 19 22:33:18 HKT 2005 William Brack <wbrack@mmm.com.hk>
|
||||||
|
|
||||||
* xpath.c: Added some code to avoid integer overflow for
|
* xpath.c: Added some code to avoid integer overflow for
|
||||||
|
@ -2635,14 +2635,14 @@ xmlRegStrEqualWildcard(const xmlChar *expStr, const xmlChar *valStr) {
|
|||||||
do {
|
do {
|
||||||
if (*valStr == XML_REG_STRING_SEPARATOR)
|
if (*valStr == XML_REG_STRING_SEPARATOR)
|
||||||
break;
|
break;
|
||||||
*valStr++;
|
valStr++;
|
||||||
} while (*valStr != 0);
|
} while (*valStr != 0);
|
||||||
continue;
|
continue;
|
||||||
} else
|
} else
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
*expStr++;
|
expStr++;
|
||||||
*valStr++;
|
valStr++;
|
||||||
} while (*valStr != 0);
|
} while (*valStr != 0);
|
||||||
if (*expStr != 0)
|
if (*expStr != 0)
|
||||||
return (0);
|
return (0);
|
||||||
|
36
xmlschemas.c
36
xmlschemas.c
@ -1883,14 +1883,14 @@ xmlSchemaVComplexTypeElemErr(xmlSchemaValidCtxtPtr ctxt,
|
|||||||
end = cur;
|
end = cur;
|
||||||
if (*end == '*') {
|
if (*end == '*') {
|
||||||
localName = xmlStrdup(BAD_CAST "*");
|
localName = xmlStrdup(BAD_CAST "*");
|
||||||
*end++;
|
end++;
|
||||||
} else {
|
} else {
|
||||||
while ((*end != 0) && (*end != '|'))
|
while ((*end != 0) && (*end != '|'))
|
||||||
end++;
|
end++;
|
||||||
localName = xmlStrncat(localName, BAD_CAST cur, end - cur);
|
localName = xmlStrncat(localName, BAD_CAST cur, end - cur);
|
||||||
}
|
}
|
||||||
if (*end != 0) {
|
if (*end != 0) {
|
||||||
*end++;
|
end++;
|
||||||
/*
|
/*
|
||||||
* Skip "*|*" if they come with negated expressions, since
|
* Skip "*|*" if they come with negated expressions, since
|
||||||
* they represent the same negated wildcard.
|
* they represent the same negated wildcard.
|
||||||
@ -11213,11 +11213,25 @@ xmlSchemaBuildAContentModel(xmlSchemaParserCtxtPtr ctxt,
|
|||||||
} while (ns != NULL);
|
} while (ns != NULL);
|
||||||
|
|
||||||
} else if (wild->negNsSet != NULL) {
|
} else if (wild->negNsSet != NULL) {
|
||||||
xmlAutomataStatePtr deadEnd;
|
|
||||||
|
/*
|
||||||
deadEnd = xmlAutomataNewState(ctxt->am);
|
* Lead nodes with the negated namespace to the sink-state
|
||||||
ctxt->state = xmlAutomataNewTransition2(ctxt->am,
|
* {"*", "##other"}.
|
||||||
start, deadEnd, BAD_CAST "*", wild->negNsSet->value, wild);
|
*/
|
||||||
|
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,
|
ctxt->state = xmlAutomataNewTransition2(ctxt->am,
|
||||||
start, NULL, BAD_CAST "*", BAD_CAST "*", wild);
|
start, NULL, BAD_CAST "*", BAD_CAST "*", wild);
|
||||||
xmlAutomataNewEpsilon(ctxt->am, ctxt->state, end);
|
xmlAutomataNewEpsilon(ctxt->am, ctxt->state, end);
|
||||||
@ -21881,22 +21895,20 @@ xmlSchemaValidateElementByWildcard(xmlSchemaValidCtxtPtr ctxt,
|
|||||||
"bad arguments", NULL);
|
"bad arguments", NULL);
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
#if 0
|
|
||||||
if (wild->negNsSet != NULL) {
|
if (wild->negNsSet != NULL) {
|
||||||
/*
|
/*
|
||||||
* Workaround for negated namespaces.
|
* Don't process rejected namespaces.
|
||||||
*/
|
*/
|
||||||
if (ctxt->node->ns != NULL) {
|
if (ctxt->node->ns != NULL) {
|
||||||
if (xmlSchemaMatchesWildcardNs(wild, ctxt->node->ns->href) == 0) {
|
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);
|
return (XML_SCHEMAV_ELEMENT_CONTENT);
|
||||||
}
|
}
|
||||||
} else if (xmlSchemaMatchesWildcardNs(wild, NULL) == 0) {
|
} 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);
|
return (XML_SCHEMAV_ELEMENT_CONTENT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return(xmlSchemaValidateElementByWildcardInternal(ctxt,
|
return(xmlSchemaValidateElementByWildcardInternal(ctxt,
|
||||||
wild, ctxt->node));
|
wild, ctxt->node));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user