ANSI and 64-bit related cleanup - format arguments
authorMatthew Mondor <mmondor@pulsar-zone.net>
Sat, 27 Aug 2016 15:47:46 +0000 (15:47 +0000)
committerMatthew Mondor <mmondor@pulsar-zone.net>
Sat, 27 Aug 2016 15:47:46 +0000 (15:47 +0000)
Code was built with -Werror=format-extra-args -Werror=format= and
breaking cases fixed.

TODO
src/ircd.c
src/m_rwho.c
src/s_bsd.c
src/throttle.c

diff --git a/TODO b/TODO
index b3c494c..406ed2d 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,8 +1,7 @@
 ANSI fixes
 ----------
 
-- Fix any function arg mismatch (use -Werror=) (too many arg)
-- Fix format argument related warnings
+- Build with -Werror=maybe-uninitialized
 - Recheck warnings with -Wall
 
 Future TODO List
index 319caca..bfadb30 100644 (file)
 #include "numeric.h"
 #include "msg.h"
 #include "sbuf.h"
+#include <stdio.h>
 #include <sys/file.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <sys/resource.h>
 #include <sys/socket.h>
+#include <inttypes.h>
 #include <stdint.h>
 #include <pwd.h>
 #include <signal.h>
@@ -214,7 +216,7 @@ void restart(char *mesg)
     was_here = YES;
         
 #ifdef  USE_SYSLOG
-    (void) syslog(LOG_WARNING, "Restarting Server because: %s, sbrk(0)-etext: %lld",
+    (void) syslog(LOG_WARNING, "Restarting Server because: %s, sbrk(0)-etext: %ld",
                   mesg, (intptr_t)sbrk((size_t)0) - (intptr_t)sbrk0);
 #endif
     server_reboot();
@@ -1016,8 +1018,9 @@ void io_loop()
 
         if (timeofday < lasttimeofday) 
         {
-            ircsprintf(to_send, "System clock running backwards - (%d < %d)",
-                       timeofday, lasttimeofday);
+            ircsprintf(to_send, "System clock running backwards - (%" PRIu64
+                      " < %" PRIu64 ")",
+                       (uint64_t)timeofday, (uint64_t)lasttimeofday);
             report_error(to_send, &me);
         }
 
index 594a3a8..061822e 100644 (file)
@@ -1045,7 +1045,7 @@ static void rwho_reply(aClient *cptr, aClient *ac, char *buf, chanMember *cm)
         dst += ircsprintf(dst, " %d", rwho_opts.thismatches);
 
     if (rwho_opts.rplfields & RWO_TS)
-        dst += ircsprintf(dst, " %d", ac->tsinfo);
+        dst += ircsprintf(dst, " %ld", (long)ac->tsinfo);
 
     if (rwho_opts.rplfields & RWO_STYPE)
         dst += ircsprintf(dst, " %d", ac->user->servicetype);
index db816b6..12bf7b1 100644 (file)
@@ -1062,7 +1062,7 @@ static void set_sock_opts(int fd, aClient * cptr)
         else if (optlen > 0)
         {
             for (*readbuf = '\0'; optlen > 0; optlen--, s += 3)
-                ircsprintf(s, "%02.2x:", *t++);
+                ircsprintf(s, "%02x:", *t++);
             *s = '\0';
             sendto_realops("Connection %s using IP opts: (%s)",
                             get_client_name(cptr, HIDEME), readbuf);
index cc5f52e..d239e20 100644 (file)
@@ -480,8 +480,7 @@ throttle_check(char *host, int fd, time_t sotime)
             /* We steal this message from undernet, because mIRC detects it 
              * and doesn't try to autoreconnect */
             elength = ircsnprintf(errbufr, 512, "ERROR :Your host is trying "
-                                  "to (re)connect too fast -- throttled.\r\n",
-                                  tp->addr);
+                                  "to (re)connect too fast -- throttled.\r\n");
             send(fd, errbufr, elength, 0);
 
             tp->zline_start = sotime;