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

Unified Diff: third_party/libxslt/libxslt/xsltutils.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/libxslt/xsltutils.h ('k') | third_party/libxslt/linux/COPYING » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/libxslt/libxslt/xsltutils.c
diff --git a/third_party/libxslt/libxslt/xsltutils.c b/third_party/libxslt/libxslt/xsltutils.c
index ab981a4237274e6ea44604250f047b9c6c844ead..1646c44931ed531885ce6f2ae74b314154b36239 100644
--- a/third_party/libxslt/libxslt/xsltutils.c
+++ b/third_party/libxslt/libxslt/xsltutils.c
@@ -519,7 +519,7 @@ xsltMessage(xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst) {
*
* Default handler for out of context error messages.
*/
-static void
+static void LIBXSLT_ATTR_FORMAT(2,3)
xsltGenericErrorDefaultFunc(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...) {
va_list args;
@@ -565,7 +565,7 @@ xsltSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler) {
*
* Default handler for out of context error messages.
*/
-static void
+static void LIBXSLT_ATTR_FORMAT(2,3)
xsltGenericDebugDefaultFunc(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...) {
va_list args;
@@ -1963,7 +1963,7 @@ xsltSaveProfiling(xsltTransformContextPtr ctxt, FILE *output) {
int nb, i,j,k,l;
int max;
int total;
- long totalt;
+ unsigned long totalt;
xsltTemplatePtr *templates;
xsltStylesheetPtr style;
xsltTemplatePtr templ1,templ2;
@@ -2076,7 +2076,7 @@ xsltSaveProfiling(xsltTransformContextPtr ctxt, FILE *output) {
for (i = 0; i < nb; i++) {
char ix_str[20], timep_str[20], times_str[20], timec_str[20], called_str[20];
- int t;
+ unsigned long t;
templ1 = templates[i];
/* callers */
@@ -2087,9 +2087,9 @@ xsltSaveProfiling(xsltTransformContextPtr ctxt, FILE *output) {
break;
}
t=templ2?templ2->time:totalt;
- sprintf(times_str,"%8.3f",(float)t/XSLT_TIMESTAMP_TICS_PER_SEC);
- sprintf(timec_str,"%8.3f",(float)childt[k]/XSLT_TIMESTAMP_TICS_PER_SEC);
- sprintf(called_str,"%6d/%d",
+ snprintf(times_str,sizeof(times_str),"%8.3f",(float)t/XSLT_TIMESTAMP_TICS_PER_SEC);
+ snprintf(timec_str,sizeof(timec_str),"%8.3f",(float)childt[k]/XSLT_TIMESTAMP_TICS_PER_SEC);
+ snprintf(called_str,sizeof(called_str),"%6d/%d",
templ1->templCountTab[j], /* number of times caller calls 'this' */
templ1->nbCalls); /* total number of calls to 'this' */
@@ -2098,10 +2098,10 @@ xsltSaveProfiling(xsltTransformContextPtr ctxt, FILE *output) {
(templ2?(templ2->name?(char *)templ2->name:pretty_templ_match(templ2)):"-"),k);
}
/* this */
- sprintf(ix_str,"[%d]",i);
- sprintf(timep_str,"%6.2f",(float)templ1->time*100.0/totalt);
- sprintf(times_str,"%8.3f",(float)templ1->time/XSLT_TIMESTAMP_TICS_PER_SEC);
- sprintf(timec_str,"%8.3f",(float)childt[i]/XSLT_TIMESTAMP_TICS_PER_SEC);
+ snprintf(ix_str,sizeof(ix_str),"[%d]",i);
+ snprintf(timep_str,sizeof(timep_str),"%6.2f",(float)templ1->time*100.0/totalt);
+ snprintf(times_str,sizeof(times_str),"%8.3f",(float)templ1->time/XSLT_TIMESTAMP_TICS_PER_SEC);
+ snprintf(timec_str,sizeof(timec_str),"%8.3f",(float)childt[i]/XSLT_TIMESTAMP_TICS_PER_SEC);
fprintf(output, "%-5s %-6s %-8s %-8s %6d %s [%d]\n",
ix_str, timep_str,times_str,timec_str,
templ1->nbCalls,
@@ -2123,9 +2123,9 @@ xsltSaveProfiling(xsltTransformContextPtr ctxt, FILE *output) {
templ2 = templates[k];
for (l = 0; l < templ2->templNr; l++) {
if (templ2->templCalledTab[l] == templ1) {
- sprintf(times_str,"%8.3f",(float)templ2->time/XSLT_TIMESTAMP_TICS_PER_SEC);
- sprintf(timec_str,"%8.3f",(float)childt[k]/XSLT_TIMESTAMP_TICS_PER_SEC);
- sprintf(called_str,"%6d/%d",
+ snprintf(times_str,sizeof(times_str),"%8.3f",(float)templ2->time/XSLT_TIMESTAMP_TICS_PER_SEC);
+ snprintf(timec_str,sizeof(timec_str),"%8.3f",(float)childt[k]/XSLT_TIMESTAMP_TICS_PER_SEC);
+ snprintf(called_str,sizeof(called_str),"%6d/%d",
templ2->templCountTab[l], /* number of times 'this' calls callee */
total); /* total number of calls from 'this' */
fprintf(output, " %-8s %-8s %-12s %s [%d]\n",
@@ -2245,19 +2245,19 @@ xsltGetProfileInformation(xsltTransformContextPtr ctxt)
for (i = 0; i < nb; i++) {
child = xmlNewChild(root, NULL, BAD_CAST "template", NULL);
- sprintf(buf, "%d", i + 1);
+ snprintf(buf, sizeof(buf), "%d", i + 1);
xmlSetProp(child, BAD_CAST "rank", BAD_CAST buf);
xmlSetProp(child, BAD_CAST "match", BAD_CAST templates[i]->match);
xmlSetProp(child, BAD_CAST "name", BAD_CAST templates[i]->name);
xmlSetProp(child, BAD_CAST "mode", BAD_CAST templates[i]->mode);
- sprintf(buf, "%d", templates[i]->nbCalls);
+ snprintf(buf, sizeof(buf), "%d", templates[i]->nbCalls);
xmlSetProp(child, BAD_CAST "calls", BAD_CAST buf);
- sprintf(buf, "%ld", templates[i]->time);
+ snprintf(buf, sizeof(buf), "%ld", templates[i]->time);
xmlSetProp(child, BAD_CAST "time", BAD_CAST buf);
- sprintf(buf, "%ld", templates[i]->time / templates[i]->nbCalls);
+ snprintf(buf, sizeof(buf), "%ld", templates[i]->time / templates[i]->nbCalls);
xmlSetProp(child, BAD_CAST "average", BAD_CAST buf);
};
« no previous file with comments | « third_party/libxslt/libxslt/xsltutils.h ('k') | third_party/libxslt/linux/COPYING » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698