[LIBXSLT] Update to v1.1.29. CORE-11557
[reactos.git] / reactos / dll / 3rdparty / libxslt / xsltutils.c
index 0f904f6..53facee 100644 (file)
@@ -495,7 +495,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;
 
@@ -541,7 +541,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;
 
@@ -1939,7 +1939,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;
@@ -2052,7 +2052,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 */
@@ -2063,9 +2063,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' */
 
@@ -2074,10 +2074,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,
@@ -2099,9 +2099,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",
@@ -2221,19 +2221,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);
     };