bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

warnings in some test files


From: Bruno Haible
Subject: warnings in some test files
Date: Tue, 20 Mar 2007 01:43:05 +0100
User-agent: KMail/1.5.4

Hi Simon,

Got these gcc warnings:

test-crc.c:37: warning: long unsigned int format, unsigned int arg (arg 2)
test-crc.c:44: warning: long unsigned int format, unsigned int arg (arg 2)
test-crc.c:51: warning: long unsigned int format, unsigned int arg (arg 2)
test-crc.c:58: warning: long unsigned int format, unsigned int arg (arg 2)
test-gc-pbkdf2-sha1.c:98: warning: int format, size_t arg (arg 2)
test-gc-pbkdf2-sha1.c:104: warning: int format, size_t arg (arg 2)
test-getaddrinfo.c:53: warning: int format, size_t arg (arg 2)
test-read-file.c:45: warning: int format, size_t arg (arg 2)
test-read-file.c:60: warning: int format, size_t arg (arg 2)

Fixing them like this:

2007-03-17  Bruno Haible  <address@hidden>

        * tests/test-crc.c (main): Make printf statements 64-bit clean.
        * tests/test-gc-pbkdf2-sha1.c (main): Likewise.
        * tests/test-getaddrinfo.c (simple): Likewise.
        * tests/test-read-file.c (main): Likewise.

--- tests/test-crc.c    6 Jul 2006 23:56:00 -0000       1.2
+++ tests/test-crc.c    17 Mar 2007 19:18:09 -0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005, 2006 Free Software Foundation
+ * Copyright (C) 2005, 2006, 2007 Free Software Foundation
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -34,28 +34,28 @@
   p = crc32_update_no_xor (42, "foo", 3);
   if (p != 0x46e87f05)
     {
-      printf ("cunx got %lx\n", p);
+      printf ("cunx got %lx\n", (unsigned long) p);
       return 1;
     }
 
   p = crc32_no_xor ("foo", 3);
   if (p != 0x7332bc33)
     {
-      printf ("cnx got %lx\n", p);
+      printf ("cnx got %lx\n", (unsigned long) p);
       return 1;
     }
 
   p = crc32_update (42, "foo", 3);
   if (p != 0xb9a9a617)
     {
-      printf ("cu got %lx\n", p);
+      printf ("cu got %lx\n", (unsigned long) p);
       return 1;
     }
 
   p = crc32 ("foo", 3);
   if (p != 0x8c736521)
     {
-      printf ("c got %lx\n", p);
+      printf ("c got %lx\n", (unsigned long) p);
       return 1;
     }
 
--- tests/test-gc-pbkdf2-sha1.c 12 Oct 2005 13:13:29 -0000      1.1
+++ tests/test-gc-pbkdf2-sha1.c 17 Mar 2007 19:18:09 -0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2002, 2003, 2004, 2005  Free Software Foundation
+ * Copyright (C) 2002, 2003, 2004, 2005, 2007  Free Software Foundation
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -95,13 +95,14 @@
                           pkcs5[i].iterations, out, pkcs5[i].dklen);
       if (rc != GC_OK)
        {
-         printf ("PKCS5 entry %d failed fatally: %d\n", i, rc);
+         printf ("PKCS5 entry %ld failed fatally: %d\n",
+                 (unsigned long) i, rc);
          return 1;
        }
 
       if (memcmp (pkcs5[i].expected, out, pkcs5[i].dklen) != 0)
        {
-         printf ("PKCS5 entry %d failed\n", i);
+         printf ("PKCS5 entry %ld failed\n", (unsigned long) i);
          return 1;
        }
     }
--- tests/test-getaddrinfo.c    14 Aug 2006 18:28:32 -0000      1.3
+++ tests/test-getaddrinfo.c    17 Mar 2007 19:18:09 -0000
@@ -1,6 +1,6 @@
 /* Test the getaddrinfo module.
 
-   Copyright (C) 2006 Free Software Foundation, Inc.
+   Copyright (C) 2006-2007 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -50,7 +50,7 @@
       printf ("\tfamily %x\n", ai->ai_family);
       printf ("\tsocktype %x\n", ai->ai_socktype);
       printf ("\tprotocol %x\n", ai->ai_protocol);
-      printf ("\taddrlen %d: ", ai->ai_addrlen);
+      printf ("\taddrlen %ld: ", (unsigned long) ai->ai_addrlen);
       printf ("\tFound %s\n",
              inet_ntop (ai->ai_family,
                         &((struct sockaddr_in *)
--- tests/test-read-file.c      14 Nov 2006 20:31:04 -0000      1.2
+++ tests/test-read-file.c      17 Mar 2007 19:18:09 -0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006 Free Software Foundation
+ * Copyright (C) 2006-2007 Free Software Foundation
  * Written by Simon Josefsson
  *
  * This program is free software; you can redistribute it and/or modify
@@ -42,7 +42,7 @@
     if (out[len] != '\0')
       perror ("BAD: out[len] not zero");
 
-    printf ("Read %d from %s...\n", len, FILE1);
+    printf ("Read %ld from %s...\n", (unsigned long) len, FILE1);
 
     free (out);
   }
@@ -57,7 +57,7 @@
     if (out[len] != '\0')
       perror ("BAD: out[len] not zero");
 
-    printf ("Read %d from %s...\n", len, FILE2);
+    printf ("Read %ld from %s...\n", (unsigned long) len, FILE2);
 
     free (out);
   }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]