]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Fix stdio-common/tst-fmemopen.c format warnings.
authorJoseph Myers <joseph@codesourcery.com>
Thu, 27 Nov 2014 03:25:15 +0000 (03:25 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Thu, 27 Nov 2014 03:25:15 +0000 (03:25 +0000)
Testing for 32-bit x86 shows up warnings in
stdio-common/tst-fmemopen.c where off_t values are passed to %zu
printf formats.  Since the values are in messages relating to function
calls where the relevant argument is of type size_t, it seems most
appropriate to cast explicitly to size_t when passing to printf, which
this patch does.

Tested for 32-bit x86.

* stdio-common/tst-fmemopen.c (do_test): Cast st_size values to
size_t for %zu format.

ChangeLog
stdio-common/tst-fmemopen.c

index c9b49ca2903f0886b60f4488670c7504b764e92a..ab2220d9ea831877b7d64b78b08cfc73001bd3ed 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2014-11-27  Joseph Myers  <joseph@codesourcery.com>
 
+       * stdio-common/tst-fmemopen.c (do_test): Cast st_size values to
+       size_t for %zu format.
+
        * nss/tst-nss-test1.c (do_test): Use %td printf format for pointer
        difference, not %ju.
 
index aba931070bb3cdd82e26cfc5849856255c34e1c6..c5015a6f0ea5c33304b6fd9f6676d1a4d12a9c33 100644 (file)
@@ -108,13 +108,13 @@ do_test (void)
                                  MAP_SHARED, fd, 0)) == MAP_FAILED)
     {
       printf ("mmap (NULL, %zu, PROT_READ, MAP_SHARED, %i, 0) failed\n",
-             fs.st_size, fd);
+             (size_t) fs.st_size, fd);
       return 5;
     }
 
   if ((fp = fmemopen (mmap_data, fs.st_size, "r")) == NULL)
     {
-      printf ("fmemopen (%p, %zu) failed\n", mmap_data, fs.st_size);
+      printf ("fmemopen (%p, %zu) failed\n", mmap_data, (size_t) fs.st_size);
       return 1;
     }