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

Unified Diff: third_party/libxslt/libexslt/strings.c

Issue 1848793005: Roll libxslt to 891681e3e948f31732229f53cb6db7215f740fc7 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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/libexslt/functions.c ('k') | third_party/libxslt/libxslt.doap » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/libxslt/libexslt/strings.c
diff --git a/third_party/libxslt/libexslt/strings.c b/third_party/libxslt/libexslt/strings.c
index 045cc14b63e7a23d687d9dcf2e2530f4970de974..f5f2d3c5c3d594416d5c7694e998c71dd46123a4 100644
--- a/third_party/libxslt/libexslt/strings.c
+++ b/third_party/libxslt/libexslt/strings.c
@@ -351,8 +351,8 @@ exsltStrDecodeUriFunction (xmlXPathParserContextPtr ctxt, int nargs) {
*/
static void
exsltStrPaddingFunction (xmlXPathParserContextPtr ctxt, int nargs) {
- int number, str_len = 0;
- xmlChar *str = NULL, *ret = NULL, *tmp;
+ int number, str_len = 0, str_size = 0;
+ xmlChar *str = NULL, *ret = NULL;
if ((nargs < 1) || (nargs > 2)) {
xmlXPathSetArityError(ctxt);
@@ -362,11 +362,13 @@ exsltStrPaddingFunction (xmlXPathParserContextPtr ctxt, int nargs) {
if (nargs == 2) {
str = xmlXPathPopString(ctxt);
str_len = xmlUTF8Strlen(str);
+ str_size = xmlStrlen(str);
}
if (str_len == 0) {
if (str != NULL) xmlFree(str);
str = xmlStrdup((const xmlChar *) " ");
str_len = 1;
+ str_size = 1;
}
number = (int) xmlXPathPopNumber(ctxt);
@@ -378,13 +380,13 @@ exsltStrPaddingFunction (xmlXPathParserContextPtr ctxt, int nargs) {
}
while (number >= str_len) {
- ret = xmlStrncat(ret, str, str_len);
+ ret = xmlStrncat(ret, str, str_size);
number -= str_len;
}
- tmp = xmlUTF8Strndup (str, number);
- ret = xmlStrcat(ret, tmp);
- if (tmp != NULL)
- xmlFree (tmp);
+ if (number > 0) {
+ str_size = xmlUTF8Strsize(str, number);
+ ret = xmlStrncat(ret, str, str_size);
+ }
xmlXPathReturnString(ctxt, ret);
@@ -445,7 +447,7 @@ exsltStrAlignFunction (xmlXPathParserContextPtr ctxt, int nargs) {
} else {
int str_s;
- str_s = xmlStrlen (str);
+ str_s = xmlUTF8Strsize(padding, str_l);
ret = xmlStrdup (str);
ret = xmlStrcat (ret, padding + str_s);
}
@@ -838,11 +840,7 @@ exsltStrXpathCtxtRegister (xmlXPathContextPtr ctxt, const xmlChar *prefix)
&& !xmlXPathRegisterFuncNS(ctxt,
(const xmlChar *) "concat",
(const xmlChar *) EXSLT_STRINGS_NAMESPACE,
- exsltStrConcatFunction)
- && !xmlXPathRegisterFuncNS(ctxt,
- (const xmlChar *) "replace",
- (const xmlChar *) EXSLT_STRINGS_NAMESPACE,
- exsltStrReplaceFunction)) {
+ exsltStrConcatFunction)) {
return 0;
}
return -1;
« no previous file with comments | « third_party/libxslt/libexslt/functions.c ('k') | third_party/libxslt/libxslt.doap » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698