<<< Date Index >>>     <<< Thread Index >>>

[PATCH] minor fixes for compiler warnings



No fuctional changes here, just eliminating some compiler warnings that
trigger my "what did I do wrong" response every time I patch. :)

pid_t is signed, but I cast to unsigned and changed the format specifier
because an extra minus in the formatted string would be irregular. (Of
course it would be highly irregular to get a negative pid_t anyway, but
that's a separate worry.)

It looks like several other warns in 1.5.6 have been fixed in CVS
already -- thanks!

-- 
 -D.    dgc@xxxxxxxxxxxx                                  NSIT::ENSS
Index: mbox.c
===================================================================
RCS file: /home/roessler/cvs/mutt/mbox.c,v
retrieving revision 3.4
diff -u -r3.4 mbox.c
--- mbox.c      7 Feb 2004 21:38:32 -0000       3.4
+++ mbox.c      19 Jul 2004 05:05:21 -0000
@@ -924,8 +924,8 @@
     
     char savefile[_POSIX_PATH_MAX];
     
-    snprintf (savefile, sizeof (savefile), "%s/mutt.%s-%s-%d",
-             NONULL (Tempdir), NONULL(Username), NONULL(Hostname), getpid ());
+    snprintf (savefile, sizeof (savefile), "%s/mutt.%s-%s-%u",
+             NONULL (Tempdir), NONULL(Username), NONULL(Hostname), (unsigned 
int)getpid ());
     rename (tempfile, savefile);
     mutt_unblock_signals ();
     mx_fastclose_mailbox (ctx);
Index: mh.c
===================================================================
RCS file: /home/roessler/cvs/mutt/mh.c,v
retrieving revision 3.20
diff -u -r3.20 mh.c
--- mh.c        14 Jul 2004 05:07:18 -0000      3.20
+++ mh.c        19 Jul 2004 05:05:21 -0000
@@ -933,9 +933,9 @@
 
   FOREVER
   {
-    snprintf (path, _POSIX_PATH_MAX, "%s/tmp/%s.%ld.%d_%d.%s%s",
-             dest->path, subdir, time (NULL), getpid (), Counter++,
-             NONULL (Hostname), suffix);
+    snprintf (path, _POSIX_PATH_MAX, "%s/tmp/%s.%ld.%u_%d.%s%s",
+             dest->path, subdir, time (NULL), (unsigned int)getpid (),
+             Counter++, NONULL (Hostname), suffix);
 
     dprint (2, (debugfile, "maildir_open_new_message (): Trying %s.\n",
                path));
@@ -1014,8 +1014,9 @@
   /* construct a new file name. */
   FOREVER
   {
-    snprintf (path, _POSIX_PATH_MAX, "%s/%ld.%d_%d.%s%s", subdir,
-             time (NULL), getpid (), Counter++, NONULL (Hostname), suffix);
+    snprintf (path, _POSIX_PATH_MAX, "%s/%ld.%u_%d.%s%s", subdir,
+             time (NULL), (unsigned int)getpid (), Counter++, 
+             NONULL (Hostname), suffix);
     snprintf (full, _POSIX_PATH_MAX, "%s/%s", ctx->path, path);
 
     dprint (2, (debugfile, "maildir_commit_message (): renaming %s to %s.\n",
Index: pgp.c
===================================================================
RCS file: /home/roessler/cvs/mutt/pgp.c,v
retrieving revision 3.29
diff -u -r3.29 pgp.c
--- pgp.c       14 Jul 2004 05:58:30 -0000      3.29
+++ pgp.c       19 Jul 2004 05:05:21 -0000
@@ -244,7 +244,9 @@
 
   char body_charset[STRING];
   mutt_get_body_charset (body_charset, sizeof (body_charset), m);
-  
+
+  rc = 0;      /* silence false compiler warning if (s->flags & M_DISPLAY) */
+
   fseek (s->fpin, m->offset, 0);
   last_pos = m->offset;
   
Index: sendlib.c
===================================================================
RCS file: /home/roessler/cvs/mutt/sendlib.c,v
retrieving revision 3.26
diff -u -r3.26 sendlib.c
--- sendlib.c   12 Jul 2004 13:22:24 -0000      3.26
+++ sendlib.c   19 Jul 2004 05:05:22 -0000
@@ -1770,9 +1770,9 @@
   if(!(fqdn = mutt_fqdn(0)))
     fqdn = NONULL(Hostname);
 
-  snprintf (buf, sizeof (buf), "<%d%02d%02d%02d%02d%02d.G%c%d@%s>",
+  snprintf (buf, sizeof (buf), "<%d%02d%02d%02d%02d%02d.G%c%u@%s>",
            tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour,
-           tm->tm_min, tm->tm_sec, MsgIdPfx, getpid (), fqdn);
+           tm->tm_min, tm->tm_sec, MsgIdPfx, (unsigned int)getpid (), fqdn);
   MsgIdPfx = (MsgIdPfx == 'Z') ? 'A' : MsgIdPfx + 1;
   return (safe_strdup (buf));
 }