Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(350)

Unified Diff: third_party/libxslt/libxslt/templates.c

Issue 1193533007: Upgrade to libxml 2.9.2 and libxslt 1.1.28 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: no iconv Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/libxslt/libxslt/templates.h ('k') | third_party/libxslt/libxslt/transform.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/libxslt/libxslt/templates.c
diff --git a/third_party/libxslt/libxslt/templates.c b/third_party/libxslt/libxslt/templates.c
index 41f1157758fd74b57c2316c51d19a3cb908caf5e..02193f7eef7e04ed71e2136b9b099ac3a6ddcb5e 100644
--- a/third_party/libxslt/libxslt/templates.c
+++ b/third_party/libxslt/libxslt/templates.c
@@ -40,7 +40,7 @@
* Module interfaces *
* *
************************************************************************/
-
+
/**
* xsltEvalXPathPredicate:
* @ctxt: the XSLT transformation context
@@ -199,7 +199,8 @@ xsltEvalTemplateString(xsltTransformContextPtr ctxt,
xmlNodePtr oldInsert, insert = NULL;
xmlChar *ret;
- if ((ctxt == NULL) || (contextNode == NULL) || (inst == NULL))
+ if ((ctxt == NULL) || (contextNode == NULL) || (inst == NULL) ||
+ (inst->type != XML_ELEMENT_NODE))
return(NULL);
if (inst->children == NULL)
@@ -280,7 +281,17 @@ xsltAttrTemplateValueProcessNode(xsltTransformContextPtr ctxt,
ret = xmlStrncat(ret, str, cur - str);
str = cur;
cur++;
- while ((*cur != 0) && (*cur != '}')) cur++;
+ while ((*cur != 0) && (*cur != '}')) {
+ /* Need to check for literal (bug539741) */
+ if ((*cur == '\'') || (*cur == '"')) {
+ char delim = *(cur++);
+ while ((*cur != 0) && (*cur != delim))
+ cur++;
+ if (*cur != 0)
+ cur++; /* skip the ending delimiter */
+ } else
+ cur++;
+ }
if (*cur == 0) {
xsltTransformError(ctxt, NULL, inst,
"xsltAttrTemplateValueProcessNode: unmatched '{'\n");
@@ -381,7 +392,8 @@ xsltEvalAttrValueTemplate(xsltTransformContextPtr ctxt, xmlNodePtr inst,
xmlChar *ret;
xmlChar *expr;
- if ((ctxt == NULL) || (inst == NULL) || (name == NULL))
+ if ((ctxt == NULL) || (inst == NULL) || (name == NULL) ||
+ (inst->type != XML_ELEMENT_NODE))
return(NULL);
expr = xsltGetNsProp(inst, name, ns);
@@ -425,7 +437,8 @@ xsltEvalStaticAttrValueTemplate(xsltStylesheetPtr style, xmlNodePtr inst,
const xmlChar *ret;
xmlChar *expr;
- if ((style == NULL) || (inst == NULL) || (name == NULL))
+ if ((style == NULL) || (inst == NULL) || (name == NULL) ||
+ (inst->type != XML_ELEMENT_NODE))
return(NULL);
expr = xsltGetNsProp(inst, name, ns);
@@ -455,7 +468,7 @@ xsltEvalStaticAttrValueTemplate(xsltStylesheetPtr style, xmlNodePtr inst,
* Evaluates Attribute Value Templates and copies the attribute over to
* the result element.
* This does *not* process attribute sets (xsl:use-attribute-set).
- *
+ *
*
* Returns the generated attribute node.
*/
@@ -466,16 +479,17 @@ xsltAttrTemplateProcess(xsltTransformContextPtr ctxt, xmlNodePtr target,
const xmlChar *value;
xmlAttrPtr ret;
- if ((ctxt == NULL) || (attr == NULL) || (target == NULL))
+ if ((ctxt == NULL) || (attr == NULL) || (target == NULL) ||
+ (target->type != XML_ELEMENT_NODE))
return(NULL);
-
+
if (attr->type != XML_ATTRIBUTE_NODE)
return(NULL);
/*
* Skip all XSLT attributes.
*/
-#ifdef XSLT_REFACTORED
+#ifdef XSLT_REFACTORED
if (attr->psvi == xsltXSLTAttrMarker)
return(NULL);
#else
@@ -512,7 +526,7 @@ xsltAttrTemplateProcess(xsltTransformContextPtr ctxt, xmlNodePtr target,
}
ret = ret->next;
}
- if (ret != NULL) {
+ if (ret != NULL) {
/* free the existing value */
xmlFreeNodeList(ret->children);
ret->children = ret->last = NULL;
@@ -531,7 +545,7 @@ xsltAttrTemplateProcess(xsltTransformContextPtr ctxt, xmlNodePtr target,
xsltGetNamespace(ctxt, attr->parent, attr->ns, target),
attr->name, NULL);
else
- ret = xmlNewNsProp(target, NULL, attr->name, NULL);
+ ret = xmlNewNsProp(target, NULL, attr->name, NULL);
}
/*
* Set the value.
@@ -583,11 +597,11 @@ xsltAttrTemplateProcess(xsltTransformContextPtr ctxt, xmlNodePtr target,
} else {
if (attr->ns) {
xsltTransformError(ctxt, NULL, attr->parent,
- "Internal error: Failed to create attribute '{%s}%s'.\n",
+ "Internal error: Failed to create attribute '{%s}%s'.\n",
attr->ns->href, attr->name);
} else {
xsltTransformError(ctxt, NULL, attr->parent,
- "Internal error: Failed to create attribute '%s'.\n",
+ "Internal error: Failed to create attribute '%s'.\n",
attr->name);
}
}
@@ -615,7 +629,7 @@ xsltAttrTemplateProcess(xsltTransformContextPtr ctxt, xmlNodePtr target,
* attributes will be disattached.)
*/
xmlAttrPtr
-xsltAttrListTemplateProcess(xsltTransformContextPtr ctxt,
+xsltAttrListTemplateProcess(xsltTransformContextPtr ctxt,
xmlNodePtr target, xmlAttrPtr attrs)
{
xmlAttrPtr attr, copy, last;
@@ -624,11 +638,12 @@ xsltAttrListTemplateProcess(xsltTransformContextPtr ctxt,
const xmlChar *value;
xmlChar *valueAVT;
- if ((ctxt == NULL) || (target == NULL) || (attrs == NULL))
+ if ((ctxt == NULL) || (target == NULL) || (attrs == NULL) ||
+ (target->type != XML_ELEMENT_NODE))
return(NULL);
oldInsert = ctxt->insert;
- ctxt->insert = target;
+ ctxt->insert = target;
/*
* Instantiate LRE-attributes.
@@ -821,7 +836,7 @@ xmlNodePtr *
xsltTemplateProcess(xsltTransformContextPtr ctxt ATTRIBUTE_UNUSED, xmlNodePtr node) {
if (node == NULL)
return(NULL);
-
+
return(0);
}
« no previous file with comments | « third_party/libxslt/libxslt/templates.h ('k') | third_party/libxslt/libxslt/transform.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698