From 65c2f1d78acaea8cde6578eaef0c0051f31369f9 Mon Sep 17 00:00:00 2001 From: "Kasimier T. Buchcik" Date: Mon, 17 Oct 2005 12:39:58 +0000 Subject: [PATCH] Silenced intel compiler warnings (reported by Kjartan Maraas, bug * tree.c pattern.c: Silenced intel compiler warnings (reported by Kjartan Maraas, bug #318517). * xmlschemas.c: The above changes in pattern.c revealed an inconsistency wrt IDCs: we now _only_ pop XPath states, if we really pushed them beforehand; this was previously not checked for the case when we discover an element node to be invalid wrt the content model. Fixed segfault in xmlSchemaGetEffectiveValueConstraint(). --- ChangeLog | 11 +++++++++++ pattern.c | 6 ++---- tree.c | 6 ++---- xmlschemas.c | 22 ++++++++++++++-------- 4 files changed, 29 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index d9e4c165..00266bf5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +Mon Oct 17 14:29:08 CEST 2005 Kasimier Buchcik + + * tree.c pattern.c: Silenced intel compiler warnings (reported + by Kjartan Maraas, bug #318517). + * xmlschemas.c: The above changes in pattern.c revealed an + inconsistency wrt IDCs: we now _only_ pop XPath states, if + we really pushed them beforehand; this was previously not + checked for the case when we discover an element node to be + invalid wrt the content model. + Fixed segfault in xmlSchemaGetEffectiveValueConstraint(). + Fri Oct 14 16:40:18 CEST 2005 Kasimier Buchcik * result/schemas/*.err: Adapted regression test results. diff --git a/pattern.c b/pattern.c index f65c6153..9f3b0254 100644 --- a/pattern.c +++ b/pattern.c @@ -1931,11 +1931,9 @@ xmlStreamPushAttr(xmlStreamCtxtPtr stream, int xmlStreamPop(xmlStreamCtxtPtr stream) { int i, lev; - int ret; - + if (stream == NULL) return(-1); - ret = 0; while (stream != NULL) { /* * Reset block-level. @@ -1945,7 +1943,7 @@ xmlStreamPop(xmlStreamCtxtPtr stream) { stream->level--; if (stream->level < 0) - ret = -1; + return(-1); /* * Check evolution of existing states */ diff --git a/tree.c b/tree.c index 3031d503..fa7785b4 100644 --- a/tree.c +++ b/tree.c @@ -6258,7 +6258,7 @@ xmlGetNsProp(xmlNodePtr node, const xmlChar *name, const xmlChar *nameSpace) { */ int xmlUnsetProp(xmlNodePtr node, const xmlChar *name) { - xmlAttrPtr prop, prev = NULL;; + xmlAttrPtr prop; if ((node == NULL) || (node->type != XML_ELEMENT_NODE) || (name == NULL)) return(-1); @@ -6270,7 +6270,6 @@ xmlUnsetProp(xmlNodePtr node, const xmlChar *name) { xmlFreeProp(prop); return(0); } - prev = prop; prop = prop->next; } return(-1); @@ -6287,7 +6286,7 @@ xmlUnsetProp(xmlNodePtr node, const xmlChar *name) { */ int xmlUnsetNsProp(xmlNodePtr node, xmlNsPtr ns, const xmlChar *name) { - xmlAttrPtr prop, prev = NULL;; + xmlAttrPtr prop; if ((node == NULL) || (node->type != XML_ELEMENT_NODE) || (name == NULL)) return(-1); @@ -6303,7 +6302,6 @@ xmlUnsetNsProp(xmlNodePtr node, xmlNsPtr ns, const xmlChar *name) { xmlFreeProp(prop); return(0); } - prev = prop; prop = prop->next; } return(-1); diff --git a/xmlschemas.c b/xmlschemas.c index 43e66fbd..dbefae78 100644 --- a/xmlschemas.c +++ b/xmlschemas.c @@ -896,6 +896,7 @@ struct _xmlSchemaNodeInfo { int sizeNsBindings; int hasKeyrefs; + int appliedXPath; /* Indicates that an XPath has been applied. */ }; #define XML_SCHEMAS_ATTR_UNKNOWN 1 @@ -13867,15 +13868,17 @@ xmlSchemaGetEffectiveValueConstraint(xmlSchemaAttributeUsePtr attruse, if (attruse->defValue != NULL) { *value = attruse->defValue; - *val = attruse->defVal; + if (val != NULL) + *val = attruse->defVal; if (attruse->flags & XML_SCHEMA_ATTR_USE_FIXED) *fixed = 1; return(1); - } else if ((WXS_ATTRUSE_DECL(attruse) != NULL) && - (WXS_ATTRUSE_DECL(attruse)->defValue != NULL)) { - *value = (WXS_ATTRUSE_DECL(attruse))->defValue; - *val = (WXS_ATTRUSE_DECL(attruse))->defVal; - if ((WXS_ATTRUSE_DECL(attruse))->flags & XML_SCHEMAS_ATTR_FIXED) + } else if ((attruse->attrDecl != NULL) && + (attruse->attrDecl->defValue != NULL)) { + *value = attruse->attrDecl->defValue; + if (val != NULL) + *val = attruse->attrDecl->defVal; + if (attruse->attrDecl->flags & XML_SCHEMAS_ATTR_FIXED) *fixed = 1; return(1); } @@ -20965,7 +20968,7 @@ xmlSchemaParse(xmlSchemaParserCtxtPtr ctxt) if (res == -1) goto exit_failure; if (res != 0) - goto exit; + goto exit; if (bucket == NULL) { /* TODO: Error code, actually we failed to *locate* the schema. */ @@ -23510,6 +23513,7 @@ static void xmlSchemaClearElemInfo(xmlSchemaNodeInfoPtr ielem) { ielem->hasKeyrefs = 0; + ielem->appliedXPath = 0; if (ielem->flags & XML_SCHEMA_NODE_INFO_FLAG_OWNED_NAMES) { FREE_AND_NULL(ielem->localName); FREE_AND_NULL(ielem->nsName); @@ -25811,7 +25815,8 @@ end_elem: /* * Evaluate the history of XPath state objects. */ - if (xmlSchemaXPathProcessHistory(vctxt, vctxt->depth) == -1) + if (inode->appliedXPath && + (xmlSchemaXPathProcessHistory(vctxt, vctxt->depth) == -1)) goto internal_error; /* * MAYBE TODO: @@ -26390,6 +26395,7 @@ type_validation: */ if (vctxt->xpathStates != NULL) { ret = xmlSchemaXPathEvaluate(vctxt, XML_ELEMENT_NODE); + vctxt->inode->appliedXPath = 1; if (ret == -1) { VERROR_INT("xmlSchemaValidateElem", "calling xmlSchemaXPathEvaluate()");