Subject: [PATCH] libxml2 ends up being compiled for C90, which lacks the %z
 format specifier corresponding to size_t.  On platforms where size_t and
 "unsigned long" is not the same underlying type, various format specifiers
 then become wrong. Add casts so that the argument to various printf()
 functions actually match the argument.

---
 runtest.c    | 2 +-
 testlimits.c | 9 +++++----
 timsort.h    | 2 +-
 xmlIO.c      | 2 +-
 4 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/runtest.c b/runtest.c
index bb74d2a..521455e 100644
--- a/runtest.c
+++ b/runtest.c
@@ -688,7 +688,7 @@ static int compareFileMem(const char *filename, const char *mem, int size) {
     }
     if (info.st_size != size) {
         fprintf(stderr, "file %s is %ld bytes, result is %d bytes\n",
-	        filename, info.st_size, size);
+	        filename, (long)info.st_size, size);
         return(-1);
     }
     fd = open(filename, RD_FLAGS);
diff --git a/testlimits.c b/testlimits.c
index 577f593..fbc1fc1 100644
--- a/testlimits.c
+++ b/testlimits.c
@@ -1284,13 +1284,14 @@ saxTest(const char *filename, size_t limit, int options, int fail) {
         if (fail)
             res = 0;
         else {
-            fprintf(stderr, "Failed to parse '%s' %lu\n", filename, limit);
+            fprintf(stderr, "Failed to parse '%s' %lu\n", filename,
+		    (unsigned long)limit);
             res = 1;
         }
     } else {
         if (fail) {
             fprintf(stderr, "Failed to get failure for '%s' %lu\n",
-                    filename, limit);
+                    filename, (unsigned long)limit);
             res = 1;
         } else
             res = 0;
@@ -1339,7 +1340,7 @@ readerTest(const char *filename, size_t limit, int options, int fail) {
                         filename, crazy_indx);
             else
                 fprintf(stderr, "Failed to parse '%s' %lu\n",
-                        filename, limit);
+                        filename, (unsigned long)limit);
             res = 1;
         }
     } else {
@@ -1349,7 +1350,7 @@ readerTest(const char *filename, size_t limit, int options, int fail) {
                         filename, crazy_indx);
             else
                 fprintf(stderr, "Failed to get failure for '%s' %lu\n",
-                        filename, limit);
+                        filename, (unsigned long)limit);
             res = 1;
         } else
             res = 0;
diff --git a/timsort.h b/timsort.h
index 795f272..ba22cc7 100644
--- a/timsort.h
+++ b/timsort.h
@@ -323,7 +323,7 @@ static void TIM_SORT_RESIZE(TEMP_STORAGE_T *store, const size_t new_size)
     SORT_TYPE *tempstore = (SORT_TYPE *)realloc(store->storage, new_size * sizeof(SORT_TYPE));
     if (tempstore == NULL)
     {
-      fprintf(stderr, "Error allocating temporary storage for tim sort: need %lu bytes", sizeof(SORT_TYPE) * new_size);
+      fprintf(stderr, "Error allocating temporary storage for tim sort: need %lu bytes", (unsigned long)(sizeof(SORT_TYPE) * new_size));
       exit(1);
     }
     store->storage = tempstore;
diff --git a/xmlIO.c b/xmlIO.c
index 1a79c09..cdac8e8 100644
--- a/xmlIO.c
+++ b/xmlIO.c
@@ -1674,7 +1674,7 @@ xmlZMemBuffExtend( xmlZMemBuffPtr buff, size_t ext_amt ) {
 	xmlStrPrintf(msg, 500,
 		    "xmlZMemBuffExtend:  %s %lu bytes.\n",
 		    "Allocation failure extending output buffer to",
-		    new_size );
+		    (unsigned long)new_size );
 	xmlIOErr(XML_IO_WRITE, (const char *) msg);
     }
 
-- 
2.6.4

