From e21d0a503b1a01a074bed2805b68c097f825caae Mon Sep 17 00:00:00 2001 From: "William M. Brack" Date: Sat, 23 Oct 2004 16:42:01 +0000 Subject: [PATCH] changed some variable names for warning cleanup when -ansi flag is not * libexslt/crypto.c, libexslt/functions.c, libxslt/keys.c, libxslt/numbers.c, libxslt/pattern.c, libxslt/transform.c, libxslt/variables.c: changed some variable names for warning cleanup when -ansi flag is not present. * libxslt/namespaces.c: fixed potential NULL pointer reference pointed out by Dennis Dams (bug 156187) --- ChangeLog | 9 +++++ libexslt/crypto.c | 4 +-- libexslt/functions.c | 10 +++--- libxslt/keys.c | 6 ++-- libxslt/namespaces.c | 22 ++++++------ libxslt/numbers.c | 42 +++++++++++----------- libxslt/pattern.c | 92 +++++++++++++++++++++++------------------------ libxslt/transform.c | 2 -- libxslt/variables.c | 8 ++--- libxslt/xsltwin32config.h | 2 +- 10 files changed, 103 insertions(+), 94 deletions(-) diff --git a/ChangeLog b/ChangeLog index 58832c8..9541eb1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +Sat Oct 23 09:36:12 PDT 2004 William Brack + + * libexslt/crypto.c, libexslt/functions.c, libxslt/keys.c, + libxslt/numbers.c, libxslt/pattern.c, libxslt/transform.c, + libxslt/variables.c: changed some variable names for warning + cleanup when -ansi flag is not present. + * libxslt/namespaces.c: fixed potential NULL pointer reference + pointed out by Dennis Dams (bug 156187) + Mon Oct 18 17:04:27 CEST 2004 Daniel Veillard * libxslt.spec.in doc/Makefile.am: fix for RedHat bug #136072 diff --git a/libexslt/crypto.c b/libexslt/crypto.c index 2d5f357..c4ab1cd 100644 --- a/libexslt/crypto.c +++ b/libexslt/crypto.c @@ -237,7 +237,7 @@ exsltCryptoCryptoApiRc4Encrypt (xmlXPathParserContextPtr ctxt, exsltCryptoCryptoApiReportError (ctxt, __LINE__); goto fail; } -// Now encrypt data. +/* Now encrypt data. */ dwDataLen = msglen; memcpy (dest, msg, msglen); if (!CryptEncrypt (hKey, 0, TRUE, 0, dest, &dwDataLen, msglen)) { @@ -288,7 +288,7 @@ exsltCryptoCryptoApiRc4Decrypt (xmlXPathParserContextPtr ctxt, exsltCryptoCryptoApiReportError (ctxt, __LINE__); goto fail; } -// Now encrypt data. +/* Now encrypt data. */ dwDataLen = msglen; memcpy (dest, msg, msglen); if (!CryptDecrypt (hKey, 0, TRUE, 0, dest, &dwDataLen)) { diff --git a/libexslt/functions.c b/libexslt/functions.c index bed952d..b1804cc 100644 --- a/libexslt/functions.c +++ b/libexslt/functions.c @@ -455,7 +455,7 @@ static xsltElemPreCompPtr exsltFuncResultComp (xsltStylesheetPtr style, xmlNodePtr inst, xsltTransformFunction function) { xmlNodePtr test; - xmlChar *select; + xmlChar *sel; exsltFuncResultPreComp *ret; /* @@ -525,10 +525,10 @@ exsltFuncResultComp (xsltStylesheetPtr style, xmlNodePtr inst, /* * Precompute the select attribute */ - select = xmlGetNsProp(inst, (const xmlChar *) "select", NULL); - if (select != NULL) { - ret->select = xmlXPathCompile (select); - xmlFree(select); + sel = xmlGetNsProp(inst, (const xmlChar *) "select", NULL); + if (sel != NULL) { + ret->select = xmlXPathCompile (sel); + xmlFree(sel); } /* * Precompute the namespace list diff --git a/libxslt/keys.c b/libxslt/keys.c index 259c21b..cb7c998 100644 --- a/libxslt/keys.c +++ b/libxslt/keys.c @@ -630,9 +630,9 @@ xsltInitCtxtKey(xsltTransformContextPtr ctxt, xsltDocumentPtr doc, list = xsltEvalXPathKeys(ctxt, keyd->usecomp, keyd); if (list != NULL) { - int index = 0; + int ix = 0; - str = list[index++]; + str = list[ix++]; while (str != NULL) { #ifdef WITH_XSLT_DEBUG_KEYS XSLT_TRACE(ctxt,XSLT_TRACE_KEYS,xsltGenericDebug(xsltGenericDebugContext, @@ -671,7 +671,7 @@ xsltInitCtxtKey(xsltTransformContextPtr ctxt, xsltDocumentPtr doc, break; } xmlFree(str); - str = list[index++]; + str = list[ix++]; } xmlFree(list); #ifdef WITH_XSLT_DEBUG_KEYS diff --git a/libxslt/namespaces.c b/libxslt/namespaces.c index 3f55b96..6a5b080 100644 --- a/libxslt/namespaces.c +++ b/libxslt/namespaces.c @@ -492,16 +492,18 @@ xsltCopyNamespaceList(xsltTransformContextPtr ctxt, xmlNodePtr node, /* * Avoid duplicating namespace declrations on the tree */ - if ((node != NULL) && (node->ns != NULL) && - (xmlStrEqual(node->ns->href, cur->href)) && - (xmlStrEqual(node->ns->prefix, cur->prefix))) { - cur = cur->next; - continue; - } - tmp = xmlSearchNs(node->doc, node, cur->prefix); - if ((tmp != NULL) && (xmlStrEqual(tmp->href, cur->href))) { - cur = cur->next; - continue; + if (node != NULL) { + if ((node->ns != NULL) && + (xmlStrEqual(node->ns->href, cur->href)) && + (xmlStrEqual(node->ns->prefix, cur->prefix))) { + cur = cur->next; + continue; + } + tmp = xmlSearchNs(node->doc, node, cur->prefix); + if ((tmp != NULL) && (xmlStrEqual(tmp->href, cur->href))) { + cur = cur->next; + continue; + } } if (!xmlStrEqual(cur->href, XSLT_NAMESPACE)) { diff --git a/libxslt/numbers.c b/libxslt/numbers.c index 27e74df..62df43c 100644 --- a/libxslt/numbers.c +++ b/libxslt/numbers.c @@ -318,7 +318,7 @@ static void xsltNumberFormatTokenize(const xmlChar *format, xsltFormatPtr tokens) { - int index = 0; + int ix = 0; int j; int val; int len; @@ -336,19 +336,19 @@ xsltNumberFormatTokenize(const xmlChar *format, * Insert initial non-alphanumeric token. * There is always such a token in the list, even if NULL */ - while (! (IS_LETTER(val=xmlStringCurrentChar(NULL, format+index, &len)) || + while (! (IS_LETTER(val=xmlStringCurrentChar(NULL, format+ix, &len)) || IS_DIGIT(val)) ) { - if (format[index] == 0) /* if end of format string */ + if (format[ix] == 0) /* if end of format string */ break; /* while */ - index += len; + ix += len; } - if (index > 0) - tokens->start = xmlStrndup(format, index); + if (ix > 0) + tokens->start = xmlStrndup(format, ix); for (tokens->nTokens = 0; tokens->nTokens < MAX_TOKENS; tokens->nTokens++) { - if (format[index] == 0) + if (format[ix] == 0) break; /* for */ /* @@ -360,27 +360,27 @@ xsltNumberFormatTokenize(const xmlChar *format, tokens->end = NULL; } - val = xmlStringCurrentChar(NULL, format+index, &len); + val = xmlStringCurrentChar(NULL, format+ix, &len); if (IS_DIGIT_ONE(val) || IS_DIGIT_ZERO(val)) { tokens->tokens[tokens->nTokens].width = 1; while (IS_DIGIT_ZERO(val)) { tokens->tokens[tokens->nTokens].width++; - index += len; - val = xmlStringCurrentChar(NULL, format+index, &len); + ix += len; + val = xmlStringCurrentChar(NULL, format+ix, &len); } if (IS_DIGIT_ONE(val)) { tokens->tokens[tokens->nTokens].token = val - 1; - index += len; - val = xmlStringCurrentChar(NULL, format+index, &len); + ix += len; + val = xmlStringCurrentChar(NULL, format+ix, &len); } } else if ( (val == (xmlChar)'A') || (val == (xmlChar)'a') || (val == (xmlChar)'I') || (val == (xmlChar)'i') ) { tokens->tokens[tokens->nTokens].token = val; - index += len; - val = xmlStringCurrentChar(NULL, format+index, &len); + ix += len; + val = xmlStringCurrentChar(NULL, format+ix, &len); } else { /* XSLT section 7.7 * "Any other format token indicates a numbering sequence @@ -401,22 +401,22 @@ xsltNumberFormatTokenize(const xmlChar *format, * one wonders why XSLT doesn't refer to these instead). */ while (IS_LETTER(val) || IS_DIGIT(val)) { - index += len; - val = xmlStringCurrentChar(NULL, format+index, &len); + ix += len; + val = xmlStringCurrentChar(NULL, format+ix, &len); } /* * Insert temporary non-alphanumeric final tooken. */ - j = index; + j = ix; while (! (IS_LETTER(val) || IS_DIGIT(val))) { if (val == 0) break; /* while */ - index += len; - val = xmlStringCurrentChar(NULL, format+index, &len); + ix += len; + val = xmlStringCurrentChar(NULL, format+ix, &len); } - if (index > j) - tokens->end = xmlStrndup(&format[j], index - j); + if (ix > j) + tokens->end = xmlStrndup(&format[j], ix - j); } } diff --git a/libxslt/pattern.c b/libxslt/pattern.c index 477b514..b986e9e 100644 --- a/libxslt/pattern.c +++ b/libxslt/pattern.c @@ -382,7 +382,7 @@ xsltTestCompMatch(xsltTransformContextPtr ctxt, xsltCompMatchPtr comp, xmlNodePtr node, const xmlChar *mode, const xmlChar *modeURI) { int i; - xsltStepOpPtr step, select = NULL; + xsltStepOpPtr step, sel = NULL; if ((comp == NULL) || (node == NULL) || (ctxt == NULL)) { xsltTransformError(ctxt, NULL, node, @@ -411,7 +411,7 @@ xsltTestCompMatch(xsltTransformContextPtr ctxt, xsltCompMatchPtr comp, for (i = 0;i < comp->nbStep;i++) { step = &comp->steps[i]; if (step->op != XSLT_OP_PREDICATE) - select = step; + sel = step; switch (step->op) { case XSLT_OP_END: return(1); @@ -618,15 +618,15 @@ xsltTestCompMatch(xsltTransformContextPtr ctxt, xsltCompMatchPtr comp, if (comp->steps[i + 1].op == XSLT_OP_PREDICATE) { xmlDocPtr prevdoc, doc; xmlXPathObjectPtr list; - int index, j; + int ix, j; int nocache = 0; prevdoc = (xmlDocPtr) - XSLT_RUNTIME_EXTRA(ctxt, select->previousExtra); - index = (int) - XSLT_RUNTIME_EXTRA(ctxt, select->indexExtra); + XSLT_RUNTIME_EXTRA(ctxt, sel->previousExtra); + ix = (int) + XSLT_RUNTIME_EXTRA(ctxt, sel->indexExtra); list = (xmlXPathObjectPtr) - XSLT_RUNTIME_EXTRA_LST(ctxt, select->lenExtra); + XSLT_RUNTIME_EXTRA_LST(ctxt, sel->lenExtra); doc = node->doc; if ((list == NULL) || (prevdoc != doc)) { @@ -656,7 +656,7 @@ xsltTestCompMatch(xsltTransformContextPtr ctxt, xsltCompMatchPtr comp, xmlXPathFreeObject(newlist); return(-1); } - index = 0; + ix = 0; if ((parent == NULL) || (node->doc == NULL)) nocache = 1; @@ -673,13 +673,13 @@ xsltTestCompMatch(xsltTransformContextPtr ctxt, xsltCompMatchPtr comp, xmlXPathFreeObject(list); list = newlist; - XSLT_RUNTIME_EXTRA_LST(ctxt, select->lenExtra) = + XSLT_RUNTIME_EXTRA_LST(ctxt, sel->lenExtra) = (void *) list; - XSLT_RUNTIME_EXTRA(ctxt, select->previousExtra) = + XSLT_RUNTIME_EXTRA(ctxt, sel->previousExtra) = (void *) doc; - XSLT_RUNTIME_EXTRA(ctxt, select->indexExtra) = + XSLT_RUNTIME_EXTRA(ctxt, sel->indexExtra) = 0; - XSLT_RUNTIME_EXTRA_FREE(ctxt, select->lenExtra) = + XSLT_RUNTIME_EXTRA_FREE(ctxt, sel->lenExtra) = (xmlFreeFunc) xmlXPathFreeObject; } else list = newlist; @@ -691,7 +691,7 @@ xsltTestCompMatch(xsltTransformContextPtr ctxt, xsltCompMatchPtr comp, return(0); } /* TODO: store the index and use it for the scan */ - if (index == 0) { + if (ix == 0) { for (j = 0;j < list->nodesetval->nodeNr;j++) { if (list->nodesetval->nodeTab[j] == node) { if (nocache == 1) @@ -713,18 +713,18 @@ xsltTestCompMatch(xsltTransformContextPtr ctxt, xsltCompMatchPtr comp, */ oldCS = ctxt->xpathCtxt->contextSize; oldCP = ctxt->xpathCtxt->proximityPosition; - if ((select != NULL) && - (select->op == XSLT_OP_ELEM) && - (select->value != NULL) && + if ((sel != NULL) && + (sel->op == XSLT_OP_ELEM) && + (sel->value != NULL) && (node->type == XML_ELEMENT_NODE) && (node->parent != NULL)) { xmlNodePtr previous; - int index, nocache = 0; + int ix, nocache = 0; previous = (xmlNodePtr) - XSLT_RUNTIME_EXTRA(ctxt, select->previousExtra); - index = (int) - XSLT_RUNTIME_EXTRA(ctxt, select->indexExtra); + XSLT_RUNTIME_EXTRA(ctxt, sel->previousExtra); + ix = (int) + XSLT_RUNTIME_EXTRA(ctxt, sel->indexExtra); if ((previous != NULL) && (previous->parent == node->parent)) { /* @@ -741,9 +741,9 @@ xsltTestCompMatch(xsltTransformContextPtr ctxt, xsltCompMatchPtr comp, (sibling->name != NULL) && (previous->name[0] == sibling->name[0]) && (xmlStrEqual(previous->name, sibling->name))) { - if ((select->value2 == NULL) || + if ((sel->value2 == NULL) || ((sibling->ns != NULL) && - (xmlStrEqual(select->value2, + (xmlStrEqual(sel->value2, sibling->ns->href)))) indx++; } @@ -756,16 +756,16 @@ xsltTestCompMatch(xsltTransformContextPtr ctxt, xsltCompMatchPtr comp, while (sibling != NULL) { if (sibling == previous) break; - if ((select->value2 == NULL) || + if ((sel->value2 == NULL) || ((sibling->ns != NULL) && - (xmlStrEqual(select->value2, + (xmlStrEqual(sel->value2, sibling->ns->href)))) indx--; sibling = sibling->next; } } if (sibling != NULL) { - pos = index + indx; + pos = ix + indx; /* * If the node is in a Value Tree we cannot * cache it ! @@ -774,13 +774,13 @@ xsltTestCompMatch(xsltTransformContextPtr ctxt, xsltCompMatchPtr comp, (node->doc->name != NULL) && (node->doc->name[0] != ' ')) { len = (int) - XSLT_RUNTIME_EXTRA(ctxt, select->lenExtra); + XSLT_RUNTIME_EXTRA(ctxt, sel->lenExtra); XSLT_RUNTIME_EXTRA(ctxt, - select->previousExtra) = node; - XSLT_RUNTIME_EXTRA(ctxt, select->indexExtra) = + sel->previousExtra) = node; + XSLT_RUNTIME_EXTRA(ctxt, sel->indexExtra) = (void *) pos; } - index = pos; + ix = pos; } else pos = 0; } else { @@ -799,9 +799,9 @@ xsltTestCompMatch(xsltTransformContextPtr ctxt, xsltCompMatchPtr comp, (siblings->name != NULL) && (node->name[0] == siblings->name[0]) && (xmlStrEqual(node->name, siblings->name))) { - if ((select->value2 == NULL) || + if ((sel->value2 == NULL) || ((siblings->ns != NULL) && - (xmlStrEqual(select->value2, + (xmlStrEqual(sel->value2, siblings->ns->href)))) len++; } @@ -827,23 +827,23 @@ xsltTestCompMatch(xsltTransformContextPtr ctxt, xsltCompMatchPtr comp, * cache it ! */ if ((node->doc != NULL) && (nocache == 0)) { - XSLT_RUNTIME_EXTRA(ctxt, select->previousExtra) = + XSLT_RUNTIME_EXTRA(ctxt, sel->previousExtra) = node; - XSLT_RUNTIME_EXTRA(ctxt, select->indexExtra) = + XSLT_RUNTIME_EXTRA(ctxt, sel->indexExtra) = (void *) pos; - XSLT_RUNTIME_EXTRA(ctxt, select->lenExtra) = + XSLT_RUNTIME_EXTRA(ctxt, sel->lenExtra) = (void *) len; } } - } else if ((select != NULL) && (select->op == XSLT_OP_ALL) && + } else if ((sel != NULL) && (sel->op == XSLT_OP_ALL) && (node->type == XML_ELEMENT_NODE)) { xmlNodePtr previous; - int index, nocache = 0; + int ix, nocache = 0; previous = (xmlNodePtr) - XSLT_RUNTIME_EXTRA(ctxt, select->previousExtra); - index = (int) - XSLT_RUNTIME_EXTRA(ctxt, select->indexExtra); + XSLT_RUNTIME_EXTRA(ctxt, sel->previousExtra); + ix = (int) + XSLT_RUNTIME_EXTRA(ctxt, sel->indexExtra); if ((previous != NULL) && (previous->parent == node->parent)) { /* @@ -872,7 +872,7 @@ xsltTestCompMatch(xsltTransformContextPtr ctxt, xsltCompMatchPtr comp, } } if (sibling != NULL) { - pos = index + indx; + pos = ix + indx; /* * If the node is in a Value Tree we cannot * cache it ! @@ -881,10 +881,10 @@ xsltTestCompMatch(xsltTransformContextPtr ctxt, xsltCompMatchPtr comp, (node->doc->name != NULL) && (node->doc->name[0] != ' ')) { len = (int) - XSLT_RUNTIME_EXTRA(ctxt, select->lenExtra); + XSLT_RUNTIME_EXTRA(ctxt, sel->lenExtra); XSLT_RUNTIME_EXTRA(ctxt, - select->previousExtra) = node; - XSLT_RUNTIME_EXTRA(ctxt, select->indexExtra) = + sel->previousExtra) = node; + XSLT_RUNTIME_EXTRA(ctxt, sel->indexExtra) = (void *) pos; } } else @@ -924,11 +924,11 @@ xsltTestCompMatch(xsltTransformContextPtr ctxt, xsltCompMatchPtr comp, * cache it ! */ if ((node->doc != NULL) && (nocache == 0)) { - XSLT_RUNTIME_EXTRA(ctxt, select->previousExtra) = + XSLT_RUNTIME_EXTRA(ctxt, sel->previousExtra) = node; - XSLT_RUNTIME_EXTRA(ctxt, select->indexExtra) = + XSLT_RUNTIME_EXTRA(ctxt, sel->indexExtra) = (void *) pos; - XSLT_RUNTIME_EXTRA(ctxt, select->lenExtra) = + XSLT_RUNTIME_EXTRA(ctxt, sel->lenExtra) = (void *) len; } } diff --git a/libxslt/transform.c b/libxslt/transform.c index 90f1df5..5866f8a 100644 --- a/libxslt/transform.c +++ b/libxslt/transform.c @@ -65,8 +65,6 @@ static int xsltGetHTMLIDs(const xmlChar *version, const xmlChar **publicID, int xsltMaxDepth = 5000; -xmlDictPtr xmlDictCreateSub(xmlDictPtr sub); - /* * Useful macros */ diff --git a/libxslt/variables.c b/libxslt/variables.c index 6304259..a6181e7 100644 --- a/libxslt/variables.c +++ b/libxslt/variables.c @@ -784,8 +784,8 @@ xsltEvalGlobalVariables(xsltTransformContextPtr ctxt) { * @style: the XSLT transformation context * @name: the variable name * @ns_uri: the variable namespace URI - * @select: the expression which need to be evaluated to generate a value - * @tree: the subtree if select is NULL + * @sel: the expression which need to be evaluated to generate a value + * @tree: the subtree if sel is NULL * @comp: the precompiled value * @value: the string value if available * @@ -796,7 +796,7 @@ xsltEvalGlobalVariables(xsltTransformContextPtr ctxt) { */ static int xsltRegisterGlobalVariable(xsltStylesheetPtr style, const xmlChar *name, - const xmlChar *ns_uri, const xmlChar *select, + const xmlChar *ns_uri, const xmlChar *sel, xmlNodePtr tree, xsltStylePreCompPtr comp, const xmlChar *value) { xsltStackElemPtr elem, tmp; @@ -821,7 +821,7 @@ xsltRegisterGlobalVariable(xsltStylesheetPtr style, const xmlChar *name, return(-1); elem->comp = comp; elem->name = xmlDictLookup(style->dict, name, -1); - elem->select = xmlDictLookup(style->dict, select, -1); + elem->select = xmlDictLookup(style->dict, sel, -1); if (ns_uri) elem->nameURI = xmlDictLookup(style->dict, ns_uri, -1); elem->tree = tree; diff --git a/libxslt/xsltwin32config.h b/libxslt/xsltwin32config.h index 95392da..3718fa7 100644 --- a/libxslt/xsltwin32config.h +++ b/libxslt/xsltwin32config.h @@ -44,7 +44,7 @@ extern "C" { * * extra version information, used to show a CVS compilation */ -#define LIBXML_VERSION_EXTRA "-CVS958" +#define LIBXML_VERSION_EXTRA "-CVS959" /** * WITH_XSLT_DEBUG: -- 2.7.4