+Sat Oct 23 09:36:12 PDT 2004 William Brack <wbrack@mmm.com.hk>
+
+ * 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 <daniel@veillard.com>
* libxslt.spec.in doc/Makefile.am: fix for RedHat bug #136072
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)) {
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)) {
exsltFuncResultComp (xsltStylesheetPtr style, xmlNodePtr inst,
xsltTransformFunction function) {
xmlNodePtr test;
- xmlChar *select;
+ xmlChar *sel;
exsltFuncResultPreComp *ret;
/*
/*
* 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
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,
break;
}
xmlFree(str);
- str = list[index++];
+ str = list[ix++];
}
xmlFree(list);
#ifdef WITH_XSLT_DEBUG_KEYS
/*
* 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)) {
xsltNumberFormatTokenize(const xmlChar *format,
xsltFormatPtr tokens)
{
- int index = 0;
+ int ix = 0;
int j;
int val;
int len;
* 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 */
/*
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
* 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);
}
}
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,
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);
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)) {
xmlXPathFreeObject(newlist);
return(-1);
}
- index = 0;
+ ix = 0;
if ((parent == NULL) || (node->doc == NULL))
nocache = 1;
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;
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)
*/
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)) {
/*
(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++;
}
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 !
(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 {
(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++;
}
* 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)) {
/*
}
}
if (sibling != NULL) {
- pos = index + indx;
+ pos = ix + indx;
/*
* If the node is in a Value Tree we cannot
* cache it !
(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
* 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;
}
}
int xsltMaxDepth = 5000;
-xmlDictPtr xmlDictCreateSub(xmlDictPtr sub);
-
/*
* Useful macros
*/
* @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
*
*/
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;
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;
*
* extra version information, used to show a CVS compilation
*/
-#define LIBXML_VERSION_EXTRA "-CVS958"
+#define LIBXML_VERSION_EXTRA "-CVS959"
/**
* WITH_XSLT_DEBUG: