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]

Fixes for format strings



With the appended patch the following warnings are fixed - now I don't
see any format warnings on ix86 for a normal make (make check has
still a number of warnings).

$ grep warning make--out  |grep format
programs/ld-ctype.c:1486: warning: int format, long unsigned int arg (arg 6)
programs/ld-ctype.c:1486: warning: unsigned int format, long unsigned int arg (arg 6)
programs/ld-collate.c:1305: warning: int format, long int arg (arg 3)
programs/ld-collate.c:1305: warning: unsigned int format, long int arg (arg 3)
connections.c:248: warning: char format, void arg (arg 3)
connections.c:296: warning: char format, void arg (arg 3)
pwdcache.c:210: warning: char format, void arg (arg 2)
grpcache.c:214: warning: char format, void arg (arg 2)
hstcache.c:299: warning: char format, void arg (arg 2)
nscd_conf.c:182: warning: too many arguments for format

Ok to commit?

Andreas

2000-12-09  Andreas Jaeger  <aj@suse.de>

	* locale/programs/ld-collate.c (handle_ellipsis): Fix format
	string.

	* locale/programs/ld-ctype.c (charclass_symbolic_ellipsis): Fix
	format string.

	* nscd/hstcache.c (addhstbyname): Add cast to avoid warning.
	* nscd/connections.c (handle_request): Likewise.
	* nscd/pwdcache.c (addpwbyname): Likewise.
	* nscd/grpcache.c (addgrbyname): Likewise.

	* nscd/nscd_conf.c (nscd_parse_file): Remove extra argument.

============================================================
Index: locale/programs/ld-collate.c
--- locale/programs/ld-collate.c	2000/09/26 18:44:35	1.87
+++ locale/programs/ld-collate.c	2000/12/09 12:34:03
@@ -1302,7 +1302,7 @@
 	      int cnt;
 
 	      /* Generate the the name.  */
-	      sprintf (buf + preflen, base == 10 ? "%d" : "%x", from);
+	      sprintf (buf + preflen, base == 10 ? "%ld" : "%lx", from);
 
 	      /* Look whether this name is already defined.  */
 	      if (find_entry (&collate->seq_table, buf, symlen,
============================================================
Index: locale/programs/ld-ctype.c
--- locale/programs/ld-ctype.c	2000/10/31 04:20:28	1.91
+++ locale/programs/ld-ctype.c	2000/12/09 12:34:07
@@ -107,7 +107,7 @@
 
 
 /* Type to describe a transliteration include statement.  */
-struct translit_include_t 
+struct translit_include_t
 {
   const char *copy_locale;
   const char *copy_repertoire;
@@ -1482,7 +1482,7 @@
 	  struct charseq *seq;
 	  uint32_t wch;
 
-	  sprintf (tmp, (base == 10 ? "%.*s%0*d" : "%.*s%0*X"), cp - last_str,
+	  sprintf (tmp, (base == 10 ? "%.*s%0*ld" : "%.*s%0*lX"), cp - last_str,
 		   last_str, now->val.str.lenmb - (cp - last_str), from);
 
 	  get_character (now, charmap, repertoire, &seq, &wch);
============================================================
Index: nscd/hstcache.c
--- nscd/hstcache.c	2000/09/29 16:36:02	1.11
+++ nscd/hstcache.c	2000/12/09 12:34:07
@@ -296,7 +296,7 @@
   uid_t oldeuid = 0;
 
   if (debug_level > 0)
-    dbg_log (_("Haven't found \"%s\" in hosts cache!"), key);
+    dbg_log (_("Haven't found \"%s\" in hosts cache!"), (char *)key);
 
   if (secure[hstdb])
     {
============================================================
Index: nscd/connections.c
--- nscd/connections.c	2000/10/23 16:56:14	1.25
+++ nscd/connections.c	2000/12/09 12:34:08
@@ -245,7 +245,7 @@
 				  key, buf, sizeof (buf)));
 	    }
 	  else
-	    dbg_log ("\t%s (%s)", serv2str[req->type], key);
+	    dbg_log ("\t%s (%s)", serv2str[req->type], (char *)key);
 	}
 
       /* Is this service enabled?  */
@@ -293,7 +293,7 @@
   else if (debug_level > 0)
     {
       if (req->type == INVALIDATE)
-	dbg_log ("\t%s (%s)", serv2str[req->type], key);
+	dbg_log ("\t%s (%s)", serv2str[req->type], (char *)key);
       else
 	dbg_log ("\t%s", serv2str[req->type]);
     }
============================================================
Index: nscd/pwdcache.c
--- nscd/pwdcache.c	2000/05/04 13:21:38	1.15
+++ nscd/pwdcache.c	2000/12/09 12:34:08
@@ -207,7 +207,7 @@
   uid_t oldeuid = 0;
 
   if (debug_level > 0)
-    dbg_log (_("Haven't found \"%s\" in password cache!"), key);
+    dbg_log (_("Haven't found \"%s\" in password cache!"), (char *)key);
 
   if (secure[pwddb])
     {
============================================================
Index: nscd/grpcache.c
--- nscd/grpcache.c	2000/09/29 16:36:02	1.17
+++ nscd/grpcache.c	2000/12/09 12:34:08
@@ -211,7 +211,7 @@
   uid_t oldeuid = 0;
 
   if (debug_level > 0)
-    dbg_log (_("Haven't found \"%s\" in group cache!"), key);
+    dbg_log (_("Haven't found \"%s\" in group cache!"), (char *)key);
 
   if (secure[grpdb])
     {
============================================================
Index: nscd/nscd_conf.c
--- nscd/nscd_conf.c	2000/04/30 04:29:33	1.7
+++ nscd/nscd_conf.c	2000/12/09 12:34:08
@@ -179,7 +179,7 @@
       else if (strcmp (entry, "server-user") == 0)
         {
           if (!arg1)
-            dbg_log (_("Must specify user name for server-user option"), arg1);
+            dbg_log (_("Must specify user name for server-user option"));
           else
             server_user = strdup (arg1);
         }

-- 
 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]