This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix format strings in testsuite


Running the testsuite on x86-64 I noticed these problems and fixed
them with the appended patch.

I'm committing the patch now,
Andreas

2002-09-30  Andreas Jaeger  <aj@suse.de>

	* stdlib/tst-bsearch.c (main): Fix format strings.
	* stdio-common/tst-rndseek.c (do_test): Likewise.
	* libio/tst_swprintf.c (main): Likewise.
	* catgets/tst-catgets.c (main): Likewise.
	* libio/tst-fgetws.c (main): Likewise.
	* posix/tst-mmap.c (main): Likewise.
	* posix/bug-regex12.c (main): Likewise.
	* posix/bug-regex11.c (main): Likewise.
	* io/tst-getcwd.c (do_test): Likewise.

============================================================
Index: stdlib/tst-bsearch.c
--- stdlib/tst-bsearch.c	24 Sep 2002 04:21:06 -0000	1.4
+++ stdlib/tst-bsearch.c	30 Sep 2002 07:44:42 -0000
@@ -67,7 +67,7 @@ main (void)
       res = (struct entry *) bsearch (&key, arr, narr, sizeof (arr[0]), comp);
       if (res == NULL)
 	{
-	  printf ("entry %d not found\n", cnt);
+	  printf ("entry %zd not found\n", cnt);
 	  result = 1;
 	}
       else if (res != &arr[cnt])
@@ -112,7 +112,7 @@ main (void)
 	{
 	  if (res == NULL)
 	    {
-	      printf ("entry %d not found\n", cnt);
+	      printf ("entry %zd not found\n", cnt);
 	      result = 1;
 	    }
 	  else if (res != &arr[cnt])
============================================================
Index: stdio-common/tst-rndseek.c
--- stdio-common/tst-rndseek.c	24 Sep 2002 04:21:04 -0000	1.4
+++ stdio-common/tst-rndseek.c	30 Sep 2002 07:44:42 -0000
@@ -117,7 +117,7 @@ do_test (void)
 
       if (ch1 != ch2)
 	{
-	  printf ("%d: '%c' vs '%c'\n", i, ch1, ch2);
+	  printf ("%zd: '%c' vs '%c'\n", i, ch1, ch2);
 	  return 1;
 	}
     }
============================================================
Index: libio/tst_swprintf.c
--- libio/tst_swprintf.c	24 Sep 2002 04:21:05 -0000	1.5
+++ libio/tst_swprintf.c	30 Sep 2002 07:44:42 -0000
@@ -28,7 +28,7 @@ main (int argc, char *argv[])
   n = swprintf (buf, nbuf, L"Hello %s", "world");
   if (n != 11)
     {
-      printf ("incorrect return value: %d instead of 11\n", n);
+      printf ("incorrect return value: %zd instead of 11\n", n);
       result = 1;
     }
   else if (wcscmp (buf, L"Hello world") != 0)
@@ -41,7 +41,7 @@ main (int argc, char *argv[])
   n = swprintf (buf, nbuf, L"Is this >%g< 3.1?", 3.1);
   if (n != 18)
     {
-      printf ("incorrect return value: %d instead of 18\n", n);
+      printf ("incorrect return value: %zd instead of 18\n", n);
       result = 1;
     }
   else if (wcscmp (buf, L"Is this >3.1< 3.1?") != 0)
============================================================
Index: libio/tst-fgetws.c
--- libio/tst-fgetws.c	24 Sep 2002 04:21:05 -0000	1.2
+++ libio/tst-fgetws.c	30 Sep 2002 07:44:42 -0000
@@ -91,7 +91,7 @@ main (int argc, char *argv[])
     {
       printf ("Return Value: %p\n", ret);
       for (i = 0; i < wcslen (wcs) + 1; i++)
-	printf (" wcs[%d] = %04x", i, (unsigned int)wcs[i]);
+	printf (" wcs[%zd] = %04x", i, (unsigned int)wcs[i]);
       printf ("\n");
       result = 1;
     }
@@ -127,7 +127,7 @@ main (int argc, char *argv[])
 
       printf ("Return Value: %p\n", ret);
       for (i = 0; i < wcslen (wcs) + 1; i++)
-	printf (" wcs[%d] = 0x%04x", i, (unsigned int)wcs[i]);
+	printf (" wcs[%zd] = 0x%04x", i, (unsigned int)wcs[i]);
       printf ("\n");
 
       for (i = 0; il_str2[i] != '\n'; ++i)
@@ -172,7 +172,7 @@ main (int argc, char *argv[])
     {
       printf ("Return Value: %p\n", ret);
       for (i = 0; i < wcslen (wcs) + 1; i++)
-	printf (" wcs[%d] = 0x%04x", i, (unsigned int)wcs[i]);
+	printf (" wcs[%zd] = 0x%04x", i, (unsigned int)wcs[i]);
       printf ("\n");
     }
 
============================================================
Index: catgets/tst-catgets.c
--- catgets/tst-catgets.c	24 Sep 2002 04:21:06 -0000	1.3
+++ catgets/tst-catgets.c	30 Sep 2002 07:44:42 -0000
@@ -45,7 +45,7 @@ main (void)
 
 	  if (trans == NULL)
 	    {
-	      printf ("catgets return NULL for %d\n", cnt);
+	      printf ("catgets return NULL for %zd\n", cnt);
 	      result = 1;
 	    }
 	  else if (strcmp (trans, msgs[cnt]) != 0 && msgs[cnt][0] != '\0')
============================================================
Index: posix/tst-mmap.c
--- posix/tst-mmap.c	24 Sep 2002 04:21:02 -0000	1.3
+++ posix/tst-mmap.c	30 Sep 2002 07:44:42 -0000
@@ -167,7 +167,7 @@ main (void)
       for (c = ps; c < ps + 1000; ++c)
 	if (ptr[c - ps] != '0' + (c % 10))
 	  {
-	    printf ("wrong data mapped at offset %d\n", c);
+	    printf ("wrong data mapped at offset %zd\n", c);
 	    result = 1;
 	  }
     }
@@ -187,7 +187,7 @@ main (void)
       for (c = ps; c < ps + 1000; ++c)
 	if (ptr[c - ps] != '0' + (c % 10))
 	  {
-	    printf ("wrong data mapped at offset %d\n", c);
+	    printf ("wrong data mapped at offset %zd\n", c);
 	    result = 1;
 	  }
     }
============================================================
Index: posix/bug-regex12.c
--- posix/bug-regex12.c	28 Sep 2002 20:51:17 -0000	1.1
+++ posix/bug-regex12.c	30 Sep 2002 07:44:42 -0000
@@ -52,7 +52,7 @@ main (void)
 	{
 	  char buf[500];
 	  regerror (n, &re, buf, sizeof (buf));
-	  printf ("regcomp %d failed: %s\n", i, buf);
+	  printf ("regcomp %zd failed: %s\n", i, buf);
 	  ret = 1;
 	  continue;
 	}
@@ -60,7 +60,7 @@ main (void)
       if (! regexec (&re, tests[i].string, tests[i].nmatch,
 		     tests[i].nmatch ? rm : NULL, 0))
 	{
-	  printf ("regexec %d incorrectly matched\n", i);
+	  printf ("regexec %zd incorrectly matched\n", i);
 	  ret = 1;
 	}
 
============================================================
Index: posix/bug-regex11.c
--- posix/bug-regex11.c	28 Sep 2002 20:51:17 -0000	1.3
+++ posix/bug-regex11.c	30 Sep 2002 07:44:42 -0000
@@ -58,14 +58,14 @@ main (void)
 	{
 	  char buf[500];
 	  regerror (n, &re, buf, sizeof (buf));
-	  printf ("regcomp %d failed: %s\n", i, buf);
+	  printf ("regcomp %zd failed: %s\n", i, buf);
 	  ret = 1;
 	  continue;
 	}
 
       if (regexec (&re, tests[i].string, tests[i].nmatch, rm, 0))
 	{
-	  printf ("regexec %d failed\n", i);
+	  printf ("regexec %zd failed\n", i);
 	  ret = 1;
 	  regfree (&re);
 	  continue;
============================================================
Index: io/tst-getcwd.c
--- io/tst-getcwd.c	24 Sep 2002 04:21:09 -0000	1.4
+++ io/tst-getcwd.c	30 Sep 2002 07:44:42 -0000
@@ -152,7 +152,7 @@ getcwd (NULL, sbs) = \"%s\", getcwd (the
   for (i = len + 1; i < sizeof thepath; ++i)
     if (thepath[i] != '\xff')
       {
-	printf ("thepath[%d] != '\xff'\n", i);
+	printf ("thepath[%zd] != '\xff'\n", i);
 	return 1;
       }
 

-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]