ソースを参照

* C++ compile warning fixes (Still compat with C)

svn: 1316
Bryan Drewery 22 年 前
コミット
03d098da24

+ 1 - 1
src/auth.c

@@ -76,7 +76,7 @@ makehash(struct userrec *u, char *randstring)
   char hash[256] = "", *secpass = NULL;
 
   if (get_user(&USERENTRY_SECPASS, u)) {
-    secpass = strdup(get_user(&USERENTRY_SECPASS, u));
+    secpass = strdup((char *) get_user(&USERENTRY_SECPASS, u));
     secpass[strlen(secpass)] = 0;
   }
   egg_snprintf(hash, sizeof hash, "%s%s%s", randstring, (secpass && secpass[0]) ? secpass : "", authkey);

+ 7 - 7
src/base64.c

@@ -5,7 +5,7 @@
 #include <stdio.h>
 #include "base64.h"
 
-static const char base64[64] = ".\\0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
+static const char base64[65] = ".\\0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
 static const char base64r[256] = {
   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -26,7 +26,7 @@ static const char base64r[256] = {
 };
 
 char *
-b64enc(const unsigned char *data, int len)
+b64enc(const unsigned char *data, size_t len)
 {
   char *dest = NULL;
 
@@ -36,9 +36,9 @@ b64enc(const unsigned char *data, int len)
 }
 
 void
-b64enc_buf(const unsigned char *data, int len, char *dest)
+b64enc_buf(const unsigned char *data, size_t len, char *dest)
 {
-  int i, t;
+  size_t i, t;
 
 #define DB(x) ((unsigned char) (x + i < len ? data[x + i] : 0))
     for (i = 0, t = 0; i < len; i += 3, t += 4) {
@@ -52,7 +52,7 @@ b64enc_buf(const unsigned char *data, int len, char *dest)
 }
 
 char *
-b64dec(const unsigned char *data, int *len)
+b64dec(const unsigned char *data, size_t *len)
 {
   char *dest = NULL;
 
@@ -62,9 +62,9 @@ b64dec(const unsigned char *data, int *len)
 }
 
 void
-b64dec_buf(const unsigned char *data, int *len, char *dest)
+b64dec_buf(const unsigned char *data, size_t *len, char *dest)
 {
-  int t, i;
+  size_t t, i;
 
 #define DB(x) ((unsigned char) (x + i < *len ? base64r[(unsigned char) data[x + i]] : 0))
   for (i = 0, t = 0; i < *len; i += 4, t += 3) {

+ 6 - 4
src/base64.h

@@ -1,10 +1,12 @@
 #ifndef _BASE64_H_
 #  define _BASE64_H_
 
-char *b64enc(const unsigned char *data, int len);
-void b64enc_buf(const unsigned char *data, int len, char *dest);
+#include <sys/types.h>
 
-char *b64dec(const unsigned char *data, int *len);
-void b64dec_buf(const unsigned char *data, int *len, char *dest);
+char *b64enc(const unsigned char *data, size_t len);
+void b64enc_buf(const unsigned char *data, size_t len, char *dest);
+
+char *b64dec(const unsigned char *data, size_t *len);
+void b64dec_buf(const unsigned char *data, size_t *len, char *dest);
 
 #endif /* !_BASE64_H_ */

+ 1 - 1
src/binary.c

@@ -233,7 +233,7 @@ readcfg(const char *cfgfile)
 static void edpack(settings_t *incfg, const char *hash, int what)
 {
   char *tmp = NULL;
-  char *(*enc_dec_string)();
+  char *(*enc_dec_string)(const char *, char *);
   
   if (what == PACK_ENC)
     enc_dec_string = encrypt_string;

+ 37 - 37
src/botcmd.c

@@ -664,7 +664,7 @@ static void bot_nlinked(int idx, char *par)
 #endif
     x = '-';
   }
-  addbot(newbot, dcc[idx].nick, next, x, vlocalhub, vbuildts, vversion ? vversion : "");
+  addbot(newbot, dcc[idx].nick, next, x, vlocalhub, vbuildts, vversion ? vversion : (char *) "");
 }
 
 static void bot_unlinked(int idx, char *par)
@@ -1159,42 +1159,42 @@ static void bot_versions(int sock, char *par)
  */
 botcmd_t C_bot[] =
 {
-  {"a",			(Function) bot_actchan},
-  {"aw",		(Function) bot_away},
-  {"bye",		(Function) bot_bye},
-  {"c",			(Function) bot_chan2},
-  {"cg",                (Function) bot_config},
-  {"cgb",		(Function) bot_configbroad},
-  {"cp", 		(Function) bot_cmdpass},
-  {"ct",		(Function) bot_chat},
-  {"e",			(Function) bot_error},
-  {"el",		(Function) bot_endlink},
-  {"i",			(Function) bot_idle},
-  {"j",			(Function) bot_join},
-  {"l",			(Function) bot_link},
-  {"n",			(Function) bot_nlinked},
-  {"nc",		(Function) bot_nickchange},
-  {"p",			(Function) bot_priv},
-  {"pi",		(Function) bot_ping},
-  {"po",		(Function) bot_pong},
-  {"pt",		(Function) bot_part},
-  {"r",			(Function) bot_reject},
-  {"rc", 		(Function) bot_remotecmd},
-  {"rr", 		(Function) bot_remotereply},
-  {"s",			(Function) bot_share},
-  {"sb",		(Function) bot_shareupdate},
-  {"si",		(Function) bot_shellinfo},
-  {"t",			(Function) bot_trace},
-  {"tb",		(Function) bot_thisbot},
-  {"td",		(Function) bot_traced},
-  {"ts", 		(Function) bot_timesync},
-  {"u",			(Function) bot_update},
-  {"ul",		(Function) bot_unlink},
-  {"un",		(Function) bot_unlinked},
-  {"v",			(Function) bot_versions},
-  {"w",			(Function) bot_who},
-  {"z",			(Function) bot_zapf},
-  {"zb",		(Function) bot_zapfbroad},
+  {"a",			bot_actchan},
+  {"aw",		bot_away},
+  {"bye",		bot_bye},
+  {"c",			bot_chan2},
+  {"cg",                bot_config},
+  {"cgb",		bot_configbroad},
+  {"cp", 		bot_cmdpass},
+  {"ct",		bot_chat},
+  {"e",			bot_error},
+  {"el",		bot_endlink},
+  {"i",			bot_idle},
+  {"j",			bot_join},
+  {"l",			bot_link},
+  {"n",			bot_nlinked},
+  {"nc",		bot_nickchange},
+  {"p",			bot_priv},
+  {"pi",		bot_ping},
+  {"po",		bot_pong},
+  {"pt",		bot_part},
+  {"r",			bot_reject},
+  {"rc", 		bot_remotecmd},
+  {"rr", 		bot_remotereply},
+  {"s",			bot_share},
+  {"sb",		bot_shareupdate},
+  {"si",		bot_shellinfo},
+  {"t",			bot_trace},
+  {"tb",		bot_thisbot},
+  {"td",		bot_traced},
+  {"ts", 		bot_timesync},
+  {"u",			bot_update},
+  {"ul",		bot_unlink},
+  {"un",		bot_unlinked},
+  {"v",			bot_versions},
+  {"w",			bot_who},
+  {"z",			bot_zapf},
+  {"zb",		bot_zapfbroad},
   {NULL,		NULL}
 };
 

+ 1 - 1
src/botmsg.c

@@ -385,7 +385,7 @@ void botnet_send_reject(int idx, char *fromp, char *frombot, char *top, char *to
   tputs(dcc[idx].sock, OBUF, len);
 }
 
-inline void putallbots(char *par)
+void putallbots(char *par)
 { 
   botnet_send_zapf_broad(-1, conf.bot->nick, NULL, par);
 

+ 1 - 1
src/botmsg.h

@@ -16,7 +16,7 @@
 void botnet_send_cfg(int idx, struct cfg_entry *entry);
 void botnet_send_cfg_broad(int idx, struct cfg_entry *entry);
 void putbot(char *, char *);
-inline void putallbots(char *);
+void putallbots(char *);
 int add_note(char *, char *, char *, int, int);
 size_t simple_sprintf (char *, ...);
 char *int_to_base10(int);

+ 2 - 2
src/botnet.c

@@ -1655,7 +1655,7 @@ static int get_role(char *bot)
   for (u = userlist; u; u = u->next) {
     if (u->bot && bot_hublevel(u) == 999) {
       if (strcmp(u->handle, bot)) {
-        ba = get_user(&USERENTRY_BOTADDR, u);
+        ba = (struct bot_addr *) get_user(&USERENTRY_BOTADDR, u);
         if ((nextbot(u->handle) >= 0) && (ba) && (ba->roleid > 0) && (ba->roleid < 5))
           r[(ba->roleid - 1)]++;
       }
@@ -1666,7 +1666,7 @@ static int get_role(char *bot)
     if (r[i] < r[rl])
       rl = i;
   rl++;
-  ba = get_user(&USERENTRY_BOTADDR, u2);
+  ba = (struct bot_addr *) get_user(&USERENTRY_BOTADDR, u2);
   if (ba)
     ba->roleid = rl;
   return rl;

+ 1 - 1
src/cfg.c

@@ -899,7 +899,7 @@ void trigger_cfg_changed()
 
   for (i = 0; i < cfg_count; i++) {
     if (cfg[i]->flags & CFGF_LOCAL) {
-      xk = get_user(&USERENTRY_CONFIG, conf.bot->u);
+      xk = (struct xtra_key *) get_user(&USERENTRY_CONFIG, conf.bot->u);
       while (xk && strcmp(xk->key, cfg[i]->name))
 	xk = xk->next;
       if (xk) {

+ 2 - 2
src/chanprog.c

@@ -559,10 +559,10 @@ void chanprog()
     bi->uplink = (char *) calloc(1, 1);
     set_user(&USERENTRY_BOTADDR, conf.bot->u, bi);
   } else {
-    bi = get_user(&USERENTRY_BOTADDR, conf.bot->u);
+    bi = (struct bot_addr *) get_user(&USERENTRY_BOTADDR, conf.bot->u);
   }
 
-  bi = get_user(&USERENTRY_BOTADDR, get_user_by_handle(userlist, conf.bot->nick));
+  bi = (struct bot_addr *) get_user(&USERENTRY_BOTADDR, get_user_by_handle(userlist, conf.bot->nick));
   if (!bi)
     fatal("I'm added to userlist but without a bot record!", 0);
   if (bi->telnet_port != 3333) {

+ 19 - 16
src/cmds.c

@@ -593,7 +593,7 @@ static void cmd_addline(int idx, char *par)
     return;
   }
 
-  q = get_user(&USERENTRY_HOSTS, u);
+  q = (struct list_type *) get_user(&USERENTRY_HOSTS, u);
   
   hostbuf = (char *) calloc(1, 1);
   for (; q; q = q->next) {
@@ -622,23 +622,23 @@ static void cmd_back(int idx, char *par)
 
 static void cmd_newpass(int idx, char *par)
 {
-  char *new = NULL, pass[MAXPASSLEN + 1] = "";
+  char *newpass = NULL, pass[MAXPASSLEN + 1] = "";
 
   putlog(LOG_CMDS, "*", "#%s# newpass...", dcc[idx].nick);
   if (!par[0]) {
     dprintf(idx, "Usage: newpass <newpassword>\n");
     return;
   }
-  new = newsplit(&par);
+  newpass = newsplit(&par);
 
-  if (!strcmp(new, "rand")) {
+  if (!strcmp(newpass, "rand")) {
     make_rand_str(pass, MAXPASSLEN);
   } else {
-    if (strlen(new) < 6) {
+    if (strlen(newpass) < 6) {
       dprintf(idx, "Please use at least 6 characters.\n");
       return;
     } else {
-      egg_snprintf(pass, sizeof pass, "%s", new);
+      egg_snprintf(pass, sizeof pass, "%s", newpass);
     }
   }
   if (strlen(pass) > MAXPASSLEN)
@@ -656,23 +656,23 @@ static void cmd_newpass(int idx, char *par)
 
 static void cmd_secpass(int idx, char *par)
 {
-  char *new = NULL, pass[MAXPASSLEN + 1] = "";
+  char *newpass = NULL, pass[MAXPASSLEN + 1] = "";
 
   putlog(LOG_CMDS, "*", "#%s# secpass...", dcc[idx].nick);
   if (!par[0]) {
     dprintf(idx, "Usage: secpass <newsecpass>\nIf you use \"rand\" as the secpass, a random pass will be chosen.\n");
     return;
   }
-  new = newsplit(&par);
+  newpass = newsplit(&par);
 
-  if (!strcmp(new, "rand")) {
+  if (!strcmp(newpass, "rand")) {
     make_rand_str(pass, MAXPASSLEN);
   } else {
-    if (strlen(new) < 6) {
+    if (strlen(newpass) < 6) {
       dprintf(idx, "Please use at least 6 characters.\n");
       return;
     } else {
-      egg_snprintf(pass, sizeof pass, "%s", new);
+      egg_snprintf(pass, sizeof pass, "%s", newpass);
     }
   }
   if (strlen(pass) > MAXPASSLEN)
@@ -705,8 +705,11 @@ static void cmd_bottree(int idx, char *par)
 }
 #endif /* HUB */
 
-int my_cmp (const mycmds *c1, const mycmds *c2)
+int my_cmp (const void *in1, const void *in2)
 {
+  const mycmds *c1 = (const mycmds *) in1;
+  const mycmds *c2 = (const mycmds *) in2;
+
   return strcmp (c1->name, c2->name);
 }
 
@@ -717,7 +720,7 @@ static void cmd_nohelp(int idx, char *par)
 
   buf = (char *) calloc(1, 1);
 
-  qsort(cmdlist, cmdi, sizeof(mycmds), (int (*)()) &my_cmp);
+  qsort(cmdlist, cmdi, sizeof(mycmds), (int (*)(const void *, const void *)) &my_cmp);
   
   for (i = 0; i < cmdi; i++) {
     int o, found = 0;
@@ -769,7 +772,7 @@ static void cmd_help(int idx, char *par)
   if (!nowild)
     dprintf(idx, "Showing help topics matching '%s' for flags: (%s)\n", match, flg);
 
-  qsort(cmdlist, cmdi, sizeof(mycmds), (int (*)()) &my_cmp);
+  qsort(cmdlist, cmdi, sizeof(mycmds), (int (*)(const void *, const void *)) &my_cmp);
 
   /* even if we have nowild, we loop to conserve code/space */
   while (!done) {
@@ -1904,7 +1907,7 @@ static void cmd_conf(int idx, char *par)
       }
     }
     if (show) {
-      char *ss = set ? "Set: " : "";
+      const char *ss = set ? "Set: " : "";
       
 /*      if (!what || !egg_strcasecmp(what, "uid"))        dprintf(idx, "%suid: %d\n", ss, conffile.uid);
       if (!what || !egg_strcasecmp(what, "uname"))      dprintf(idx, "%suname: %s\n", ss, conffile.uname);
@@ -3496,7 +3499,7 @@ static void cmd_pls_host(int idx, char *par)
     return;
   }
   
-  for (q = get_user(&USERENTRY_HOSTS, dcc[idx].user); q; q = q->next)
+  for (q = (struct list_type *) get_user(&USERENTRY_HOSTS, dcc[idx].user); q; q = q->next)
     if (!egg_strcasecmp(q->extra, host)) {
       dprintf(idx, "That hostmask is already there.\n");
       return;

+ 3 - 1
src/cmds.h

@@ -3,6 +3,7 @@
 
 #include "types.h"
 
+
 typedef struct {
   const char          *name;
   const char          *flags;
@@ -17,7 +18,8 @@ typedef struct {
 
 typedef struct {
   const char *name;
-  Function func;
+//  Function func;
+  void (*func) (int, char *);
 } botcmd_t;
 
 typedef struct cmd_pass {

+ 16 - 45
src/compat/gnu_strftime.c

@@ -153,11 +153,9 @@ extern char *tzname[];
    Similarly for localtime_r.  */
 
 # if ! HAVE_TM_GMTOFF
-static struct tm *my_strftime_gmtime_r __P ((const time_t *, struct tm *));
+//static struct tm *my_strftime_gmtime_r __P ((const time_t *, struct tm *));
 static struct tm *
-my_strftime_gmtime_r (t, tp)
-     const time_t *t;
-     struct tm *tp;
+my_strftime_gmtime_r (const time_t *t, struct tm *tp)
 {
   struct tm *l = gmtime (t);
   if (! l)
@@ -167,11 +165,9 @@ my_strftime_gmtime_r (t, tp)
 }
 # endif /* ! HAVE_TM_GMTOFF */
 
-static struct tm *my_strftime_localtime_r __P ((const time_t *, struct tm *));
+//static struct tm *my_strftime_localtime_r __P ((const time_t *, struct tm *));
 static struct tm *
-my_strftime_localtime_r (t, tp)
-     const time_t *t;
-     struct tm *tp;
+my_strftime_localtime_r (const time_t *t, struct tm *tp)
 {
   struct tm *l = localtime (t);
   if (! l)
@@ -269,26 +265,20 @@ static const char zeroes[16] = /* "0000000000000000" */
    more reliable way to accept other sets of digits.  */
 #define ISDIGIT(Ch) ((unsigned int) (Ch) - '0' <= 9)
 
-static char *memcpy_lowcase __P ((char *dest, const char *src, size_t len));
+//static char *memcpy_lowcase __P ((char *dest, const char *src, size_t len));
 
 static char *
-memcpy_lowcase (dest, src, len)
-     char *dest;
-     const char *src;
-     size_t len;
+memcpy_lowcase (char *dest, const char *src, size_t len)
 {
   while (len-- > 0)
     dest[len] = TOLOWER ((unsigned char) src[len]);
   return dest;
 }
 
-static char *memcpy_uppcase __P ((char *dest, const char *src, size_t len));
+//static char *memcpy_uppcase __P ((char *dest, const char *src, size_t len));
 
 static char *
-memcpy_uppcase (dest, src, len)
-     char *dest;
-     const char *src;
-     size_t len;
+memcpy_uppcase (char *dest, const char *src, size_t len)
 {
   while (len-- > 0)
     dest[len] = TOUPPER ((unsigned char) src[len]);
@@ -300,11 +290,9 @@ memcpy_uppcase (dest, src, len)
 /* Yield the difference between *A and *B,
    measured in seconds, ignoring leap seconds.  */
 # define tm_diff ftime_tm_diff
-static int tm_diff __P ((const struct tm *, const struct tm *));
+//static int tm_diff __P ((const struct tm *, const struct tm *));
 static int
-tm_diff (a, b)
-     const struct tm *a;
-     const struct tm *b;
+tm_diff (const struct tm *a, const struct tm *b)
 {
   /* Compute intervening leap days correctly even if year is negative.
      Take care to avoid int overflow in leap day calculations,
@@ -334,14 +322,12 @@ tm_diff (a, b)
 #define ISO_WEEK_START_WDAY 1 /* Monday */
 #define ISO_WEEK1_WDAY 4 /* Thursday */
 #define YDAY_MINIMUM (-366)
-static int iso_week_days __P ((int, int));
+//static int iso_week_days __P ((int, int));
 #ifdef __GNUC__
 __inline__
 #endif
 static int
-iso_week_days (yday, wday)
-     int yday;
-     int wday;
+iso_week_days (int yday, int wday)
 {
   /* Add enough to the first operand of % to make it nonnegative.  */
   int big_enough_multiple_of_7 = (-YDAY_MINIMUM / 7 + 2) * 7;
@@ -382,15 +368,9 @@ static char const month_name[][10] =
 #if !defined _LIBC && HAVE_TZNAME && HAVE_TZSET
   /* Solaris 2.5 tzset sometimes modifies the storage returned by localtime.
      Work around this bug by copying *tp before it might be munged.  */
-  size_t _strftime_copytm __P ((char *, size_t, const char *,
-			        const struct tm * ut_argument_spec_iso));
+//  size_t _strftime_copytm __P ((char *, size_t, const char *, const struct tm * ut_argument_spec_iso));
   size_t
-  my_strftime (s, maxsize, format, tp ut_argument)
-      char *s;
-      size_t maxsize;
-      const char *format;
-      const struct tm *tp;
-      ut_argument_spec
+  my_strftime (char *s, size_t maxsize, const char *format, const struct tm *tp ut_argument)
   {
     struct tm tmcopy;
     tmcopy = *tp;
@@ -409,12 +389,7 @@ static char const month_name[][10] =
    anywhere, so to determine how many characters would be
    written, use NULL for S and (size_t) UINT_MAX for MAXSIZE.  */
 size_t
-my_strftime (s, maxsize, format, tp ut_argument)
-      char *s;
-      size_t maxsize;
-      const char *format;
-      const struct tm *tp;
-      ut_argument_spec
+my_strftime (char *s, size_t maxsize, const char *format, const struct tm *tp ut_argument)
 {
   int hour12 = tp->tm_hour;
 #ifdef _NL_CURRENT
@@ -1246,11 +1221,7 @@ my_strftime (s, maxsize, format, tp ut_argument)
    strftime function and does not have the extra information whether the
    TP arguments comes from a `gmtime' call or not.  */
 size_t
-emacs_strftime (s, maxsize, format, tp)
-      char *s;
-      size_t maxsize;
-      const char *format;
-      const struct tm *tp;
+emacs_strftime (char *s, size_t maxsize, const char *format, const struct tm *tp)
 {
   return my_strftime (s, maxsize, format, tp, 0);
 }

+ 5 - 15
src/compat/inet_ntop.c

@@ -48,18 +48,14 @@ static const char *egg_inet_ntop6 (const u_char *src, char *dst, socklen_t size)
  *	Paul Vixie, 1996.
  */
 const char *
-egg_inet_ntop(af, src, dst, size)
-	int af;
-	const void *src;
-	char *dst;
-	socklen_t size;
+egg_inet_ntop(int af, const void *src, char *dst, socklen_t size)
 {
 	switch (af) {
 	case AF_INET:
-		return (egg_inet_ntop4(src, dst, size));
+		return (egg_inet_ntop4((const u_char *) src, dst, size));
 #ifdef USE_IPV6
 	case AF_INET6:
-		return (egg_inet_ntop6(src, dst, size));
+		return (egg_inet_ntop6((const u_char *) src, dst, size));
 #endif /* USE_IPV6 */
 	default:
 		return (NULL);
@@ -79,10 +75,7 @@ egg_inet_ntop(af, src, dst, size)
  *	Paul Vixie, 1996.
  */
 static const char *
-egg_inet_ntop4(src, dst, size)
-	const u_char *src;
-	char *dst;
-	socklen_t size;
+egg_inet_ntop4(const u_char *src, char *dst, socklen_t size)
 {
 	static const char fmt[] = "%u.%u.%u.%u";
 	char tmp[sizeof "255.255.255.255"];
@@ -100,10 +93,7 @@ egg_inet_ntop4(src, dst, size)
  *	Paul Vixie, 1996.
  */
 static const char *
-egg_inet_ntop6(src, dst, size)
-	const u_char *src;
-	char *dst;
-	socklen_t size;
+egg_inet_ntop6(const u_char *src, char *dst, socklen_t size)
 {
 	/*
 	 * Note that int32_t and int16_t need only be "at least" large enough

+ 1 - 2
src/compat/strftime.h

@@ -14,8 +14,7 @@
  * use our own.
  */
 #ifndef HAVE_STRFTIME
-size_t egg_strftime(char *s, size_t maxsize, const char *format,
-		    const struct tm *tp);
+size_t egg_strftime(char *s, size_t maxsize, const char *format, const struct tm *tp);
 #else
 #  define egg_strftime strftime
 #endif

+ 4 - 4
src/conf.c

@@ -642,13 +642,13 @@ writeconf(char *filename, FILE * stream, int bits)
 {
   FILE *f = NULL;
   conf_bot *bot = NULL;
-  Function my_write = NULL;
+  int (*my_write) (FILE *, const char *, ... ) = NULL;
   char *p = NULL;
 
   if (bits & CONF_ENC)
-    my_write = (Function) lfprintf;
+    my_write = lfprintf;
   else if (!(bits & CONF_ENC))
-    my_write = (Function) fprintf;
+    my_write = fprintf;
 
 #define comment(text)			\
 	if (bits & CONF_COMMENT)	\
@@ -803,7 +803,7 @@ fillconf(conf_t * inconf)
 }
 
 void
-bin_to_conf(settings_t * in)
+bin_to_conf(void)
 {
 /* printf("Converting binary data to conf struct\n"); */
   conffile.uid = atol(settings.uid);

+ 1 - 1
src/conf.h

@@ -65,7 +65,7 @@ int readconf(char *, int);
 int parseconf();
 int writeconf(char *, FILE *, int);
 void fillconf(conf_t *);
-void bin_to_conf();
+void bin_to_conf(void);
 
 extern char		cfile[DIRMAX];
 #endif /* !_CONF_H */

+ 3 - 3
src/crypt.c

@@ -42,7 +42,7 @@ encrypt_binary(const char *keydata, const unsigned char *in, size_t *inlen)
     char key[CRYPT_KEYSIZE + 1] = "";
 
     strncpyz(key, keydata, sizeof(key));
-    AES_set_encrypt_key(key, CRYPT_KEYBITS, &e_key);
+    AES_set_encrypt_key((const unsigned char *) key, CRYPT_KEYBITS, &e_key);
     /* Now loop through the blocks and crypt them */
     blocks = len / CRYPT_BLOCKSIZE;
     for (block = blocks - 1; block >= 0; block--)
@@ -69,7 +69,7 @@ decrypt_binary(const char *keydata, unsigned char *in, size_t len)
     char key[CRYPT_KEYSIZE + 1] = "";
 
     strncpyz(key, keydata, sizeof(key));
-    AES_set_decrypt_key(key, CRYPT_KEYBITS, &d_key);
+    AES_set_decrypt_key((const unsigned char *) key, CRYPT_KEYBITS, &d_key);
     /* Now loop through the blocks and crypt them */
     blocks = len / CRYPT_BLOCKSIZE;
 
@@ -128,7 +128,7 @@ void encrypt_pass(char *s1, char *s2)
   free(tmp);
 }
 
-int lfprintf (FILE *stream, char *format, ...)
+int lfprintf (FILE *stream, const char *format, ...)
 {
   va_list va;
   char buf[2048], *ln = NULL, *nln = NULL, *tmp = NULL;

+ 1 - 1
src/crypt.h

@@ -21,7 +21,7 @@ char *decrypt_string(const char *, char *);
 void encrypt_pass(char *, char *);
 char *cryptit (char *);
 char *decryptit (char *);
-int lfprintf (FILE *, char *, ...) __attribute__((format(printf, 2, 3)));
+int lfprintf (FILE *, const char *, ...) __attribute__((format(printf, 2, 3)));
 void Encrypt_File(char *, char *);
 void Decrypt_File(char *, char *);
 char *btoh(const unsigned char *, int);

+ 1 - 1
src/crypto/cleanse.c

@@ -4,7 +4,7 @@ unsigned char cleanse_ctr = 0;
 
 void OPENSSL_cleanse(void *ptr, size_t len)
         {
-        unsigned char *p = ptr;
+        unsigned char *p = (unsigned char *) ptr;
         size_t loop = len;
         while(loop--)
                 {

+ 1 - 1
src/crypto/md5.c

@@ -74,7 +74,7 @@ static const void *body(MD5_CTX *ctx, const void *data, unsigned long size)
 	MD5_u32plus a, b, c, d;
 	MD5_u32plus saved_a, saved_b, saved_c, saved_d;
 
-	ptr = data;
+	ptr = (const unsigned char *) data;
 
 	a = ctx->a;
 	b = ctx->b;

+ 3 - 3
src/crypto/sha.c

@@ -75,7 +75,7 @@
 
 void sha1_block_host_order (SHA_CTX *c, const void *d, int num)
         {
-        const SHA_LONG *W=d;
+        const SHA_LONG *W = (const SHA_LONG *) d;
         register unsigned long A,B,C,D,E,T;
 /* #ifndef MD32_XARRAY */
         unsigned long     XX0, XX1, XX2, XX3, XX4, XX5, XX6, XX7,
@@ -200,7 +200,7 @@ void sha1_block_host_order (SHA_CTX *c, const void *d, int num)
 
 void sha1_block_data_order (SHA_CTX *c, const void *p, int num)
         {
-        const unsigned char *data=p;
+        const unsigned char *data = (const unsigned char *) p;
         register unsigned long A,B,C,D,E,T,l;
 /* #ifndef MD32_XARRAY */
         unsigned long     XX0, XX1, XX2, XX3, XX4, XX5, XX6, XX7,
@@ -338,7 +338,7 @@ int SHA1_Init (SHA_CTX *c)
 
 int SHA1_Update (SHA_CTX *c, const void *data_, unsigned long len)
         {
-        const unsigned char *data=data_;
+        const unsigned char *data = (const unsigned char *) data_;
         register SHA_LONG * p;
         register unsigned long l;
         int sw,sc,ew,ec;

+ 63 - 64
src/dcc.c

@@ -695,69 +695,6 @@ dcc_chat_secpass(int idx, char *buf, int atr)
     }
   }
 }
-struct dcc_table DCC_CHAT_SECPASS;
-
-static void
-dcc_chat_pass(int idx, char *buf, int atr)
-{
-  if (!atr)
-    return;
-  strip_telnet(dcc[idx].sock, buf, &atr);
-  atr = dcc[idx].user ? dcc[idx].user->flags : 0;
-  if (dcc[idx].user->bot) {
-    if (!egg_strcasecmp(buf, "elinkdone")) {
-      free(dcc[idx].u.chat);
-      dcc[idx].type = &DCC_BOT_NEW;
-      dcc[idx].u.bot = (struct bot_info *) calloc(1, sizeof(struct bot_info));
-      dcc[idx].status = STAT_CALLED;
-      dprintf(idx, "goodbye!\n");
-      greet_new_bot(idx);
-#ifdef HUB
-      send_timesync(idx);
-#endif /* HUB */
-    } else {
-      /* Invalid password/digest on hub */
-      putlog(LOG_WARN, "*", "%s failed encrypted link handshake.", dcc[idx].nick);
-      killsock(dcc[idx].sock);
-      lostdcc(idx);
-    }
-    return;
-  }
-  if (u_pass_match(dcc[idx].user, buf)) {
-    if (dccauth) { 
-      char randstr[51] = "";
-
-      make_rand_str(randstr, 50);
-      strncpyz(dcc[idx].hash, makehash(dcc[idx].user, randstr), sizeof dcc[idx].hash);
-      dcc[idx].type = &DCC_CHAT_SECPASS;
-      dcc[idx].timeval = now;
-      dprintf(idx, "-Auth %s %s\n", randstr, conf.bot->nick);
-    } else {
-      dcc_chat_secpass(idx, buf, atr);
-    }
-  } else {
-    dprintf(idx, "%s\n", response(RES_BADUSERPASS));
-    putlog(LOG_MISC, "*", DCC_BADLOGIN, dcc[idx].nick, dcc[idx].host, dcc[idx].port);
-    if (dcc[idx].u.chat->away) {        /* su from a dumb user */
-      /* Turn echo back on for telnet sessions (send IAC WON'T ECHO). */
-      if (dcc[idx].status & STAT_TELNET)
-        dprintf(idx, TLN_IAC_C TLN_WONT_C TLN_ECHO_C "\n");
-      dcc[idx].user = get_user_by_handle(userlist, dcc[idx].u.chat->away);
-      strcpy(dcc[idx].nick, dcc[idx].u.chat->away);
-      free(dcc[idx].u.chat->away);
-      free(dcc[idx].u.chat->su_nick);
-      dcc[idx].u.chat->away = NULL;
-      dcc[idx].u.chat->su_nick = NULL;
-      dcc[idx].type = &DCC_CHAT;
-      if (dcc[idx].u.chat->channel < GLOBAL_CHANS)
-        botnet_send_join_idx(idx);
-      chanout_but(-1, dcc[idx].u.chat->channel, DCC_JOIN, dcc[idx].nick);
-    } else {
-      killsock(dcc[idx].sock);
-      lostdcc(idx);
-    }
-  }
-}
 
 static void
 eof_dcc_general(int idx)
@@ -946,7 +883,7 @@ out_dcc_general(int idx, char *buf, void *x)
     tputs(dcc[idx].sock, y, strlen(y));
 }
 
-struct dcc_table DCC_CHAT_SECPASS = {
+static struct dcc_table DCC_CHAT_SECPASS = {
   "CHAT_SECPASS",
   0,
   eof_dcc_general,
@@ -959,6 +896,68 @@ struct dcc_table DCC_CHAT_SECPASS = {
   NULL
 };
 
+static void
+dcc_chat_pass(int idx, char *buf, int atr)
+{
+  if (!atr)
+    return;
+  strip_telnet(dcc[idx].sock, buf, &atr);
+  atr = dcc[idx].user ? dcc[idx].user->flags : 0;
+  if (dcc[idx].user->bot) {
+    if (!egg_strcasecmp(buf, "elinkdone")) {
+      free(dcc[idx].u.chat);
+      dcc[idx].type = &DCC_BOT_NEW;
+      dcc[idx].u.bot = (struct bot_info *) calloc(1, sizeof(struct bot_info));
+      dcc[idx].status = STAT_CALLED;
+      dprintf(idx, "goodbye!\n");
+      greet_new_bot(idx);
+#ifdef HUB
+      send_timesync(idx);
+#endif /* HUB */
+    } else {
+      /* Invalid password/digest on hub */
+      putlog(LOG_WARN, "*", "%s failed encrypted link handshake.", dcc[idx].nick);
+      killsock(dcc[idx].sock);
+      lostdcc(idx);
+    }
+    return;
+  }
+  if (u_pass_match(dcc[idx].user, buf)) {
+    if (dccauth) { 
+      char randstr[51] = "";
+
+      make_rand_str(randstr, 50);
+      strncpyz(dcc[idx].hash, makehash(dcc[idx].user, randstr), sizeof dcc[idx].hash);
+      dcc[idx].type = &DCC_CHAT_SECPASS;
+      dcc[idx].timeval = now;
+      dprintf(idx, "-Auth %s %s\n", randstr, conf.bot->nick);
+    } else {
+      dcc_chat_secpass(idx, buf, atr);
+    }
+  } else {
+    dprintf(idx, "%s\n", response(RES_BADUSERPASS));
+    putlog(LOG_MISC, "*", DCC_BADLOGIN, dcc[idx].nick, dcc[idx].host, dcc[idx].port);
+    if (dcc[idx].u.chat->away) {        /* su from a dumb user */
+      /* Turn echo back on for telnet sessions (send IAC WON'T ECHO). */
+      if (dcc[idx].status & STAT_TELNET)
+        dprintf(idx, TLN_IAC_C TLN_WONT_C TLN_ECHO_C "\n");
+      dcc[idx].user = get_user_by_handle(userlist, dcc[idx].u.chat->away);
+      strcpy(dcc[idx].nick, dcc[idx].u.chat->away);
+      free(dcc[idx].u.chat->away);
+      free(dcc[idx].u.chat->su_nick);
+      dcc[idx].u.chat->away = NULL;
+      dcc[idx].u.chat->su_nick = NULL;
+      dcc[idx].type = &DCC_CHAT;
+      if (dcc[idx].u.chat->channel < GLOBAL_CHANS)
+        botnet_send_join_idx(idx);
+      chanout_but(-1, dcc[idx].u.chat->channel, DCC_JOIN, dcc[idx].nick);
+    } else {
+      killsock(dcc[idx].sock);
+      lostdcc(idx);
+    }
+  }
+}
+
 struct dcc_table DCC_CHAT_PASS = {
   "CHAT_PASS",
   0,

+ 1 - 1
src/dcc.h

@@ -17,7 +17,7 @@ struct dcc_table {
   void (*eof) (int);
   void (*activity) (int, char *, int);
   int *timeout_val;
-  void (*timeout) ();
+  void (*timeout) (int);
   void (*display) (int, char *);
   void (*kill) (int, void *);
   void (*output) (int, char *, void *);

+ 2 - 2
src/egg_timer.c

@@ -12,7 +12,7 @@ typedef struct egg_timer_b {
 	struct egg_timer_b *next;
 	int id;
 	char *name;
-	Function callback;
+	int (*callback) (void *);
 	void *client_data;
 	egg_timeval_t howlong;
 	egg_timeval_t trigger_time;
@@ -186,7 +186,7 @@ int timer_get_shortest(egg_timeval_t *howlong)
 int timer_run()
 {
 	egg_timer_t *timer = NULL;
-	Function callback;
+	int (*callback) (void *);
 	void *client_data = NULL;
 
 	while (timer_list_head) {

+ 0 - 11
src/main.c

@@ -725,14 +725,6 @@ void compress_init();
 void share_init();
 void transfer_init();
 
-#ifndef CYGWIN_HACKS
-int _start();
-int tracecheck_breakpoint() {
-  int *u = _start;
-  return (*u == 0xCC);
-}
-#endif /* !CYGWIN_HACKS */
-
 int main(int argc, char **argv)
 {
 //printf("YAY!\n\n\n\n\n\n\n\n");
@@ -967,9 +959,6 @@ printf("out: %s\n", out);
     int socket_cleanup = 0, i, xx, status = 0;
     char buf[SGRAB + 10] = "";
 
-    if (tracecheck_breakpoint())
-      exit(0);
-
 #ifndef CYGWIN_HACKS
     if (conf.watcher && waitpid(watcher, &status, WNOHANG))
       fatal("watcher PID died/stopped", 0);

+ 8 - 10
src/misc.c

@@ -622,9 +622,9 @@ char *strchr_unescape(char *str, const char divc, register const char esc_char)
 /* As strchr_unescape(), but converts the complete string, without
  * searching for a specific delimiter character.
  */
-inline void str_unescape(char *str, register const char esc_char)
+void str_unescape(char *str, register const char esc_char)
 {
-  (void) strchr_unescape(str, 0, esc_char);
+  strchr_unescape(str, 0, esc_char);
 
   return;
 }
@@ -669,14 +669,9 @@ restart(int idx)
   exit(0);
 }
 
-static void restart_data(int *idx)
-{
-  restart(*idx);
-}
-
 int updatebin(int idx, char *par, int secs)
 {
-  char *path = NULL, *newbin = NULL, buf[DIRMAX] = "", old[DIRMAX] = "", testbuf[DIRMAX] = "";
+  char *path = NULL, *newbin = NULL, old[DIRMAX] = "", testbuf[DIRMAX] = "";
   int i;
 
   path = par;
@@ -765,6 +760,8 @@ int updatebin(int idx, char *par, int secs)
 
 #ifdef LEAF
   if (secs > 0) {
+    char buf[DIRMAX] = "";
+
     /* will exit after run, cron will restart us later */
     egg_snprintf(buf, sizeof buf, "%s -L %s -P %d", binname, conf.bot->nick, getpid());
     putlog(LOG_DEBUG, "*", "Running for update: %s", buf);
@@ -776,7 +773,7 @@ int updatebin(int idx, char *par, int secs)
       egg_timeval_t howlong;
       howlong.sec = secs;
       howlong.usec = 0;
-      timer_create_complex(&howlong, "restarting for update", (Function) restart_data, (void *) &idx, 0);
+      timer_create_complex(&howlong, "restarting for update", (int (*)(int)) restart, (void *) idx, 0);
     } else
       restart(idx);
     return 0;
@@ -1027,7 +1024,8 @@ coloridx(int idx)
   return 0;
 }
 
-char *color(int idx, int type, int which)
+const char *
+color(int idx, int type, int which)
 {
   int ansi = 0;
    

+ 2 - 2
src/misc.h

@@ -15,7 +15,7 @@
 char *wbanner(void);
 void restart(int) __attribute__((noreturn));
 int coloridx(int);
-char *color(int, int, int);
+const char *color(int, int, int);
 void shuffle(char *, char *);
 void showhelp(int, struct flag_record *, char *);
 int listen_all(int, int);
@@ -43,7 +43,7 @@ void show_banner(int);
 void make_rand_str(char *, int);
 char *str_escape(const char *, const char, const char);
 char *strchr_unescape(char *, const char, register const char);
-inline void str_unescape(char *, register const char);
+void str_unescape(char *, register const char);
 int str_isdigit(const char *);
 void kill_bot(char *, char *);
 char *strtolower(char *);

+ 2 - 2
src/mod/notes.mod/notes.c

@@ -198,7 +198,7 @@ int storenote(char *argv1, char *argv2, char *argv3, int idx, char *who, int buf
 
   if (who && bufsize > 0) who[0] = 0;
   ur = get_user_by_handle(userlist, argv2);
-  if (ur && allow_fwd && (f1 = get_user(&USERENTRY_FWD, ur))) {
+  if (ur && allow_fwd && (f1 = (char *) get_user(&USERENTRY_FWD, ur))) {
     char fwd[161] = "", fwd2[161] = "", *f2 = NULL, *p = NULL, *q = NULL, *r = NULL;
     int ok = 1;
 
@@ -216,7 +216,7 @@ int storenote(char *argv1, char *argv2, char *argv3, int idx, char *who, int buf
       ur2 = get_user_by_handle(userlist, fwd2);
       if (!ur2)
 	ok = 0;
-      if ((f2 = get_user(&USERENTRY_FWD, ur2))) {
+      if ((f2 = (char *) get_user(&USERENTRY_FWD, ur2))) {
 	strcpy(fwd2, f2);
 	splitc(fwd2, fwd2, '@');
 	if (!egg_strcasecmp(fwd2, argv2))

+ 2 - 2
src/mod/server.mod/server.h

@@ -35,13 +35,13 @@ enum {
 	NETT_UNDERNET		= 2,	/* Undernet.			  */
 	NETT_DALNET		= 3,	/* Dalnet.			  */
 	NETT_HYBRID_EFNET	= 4	/* new +e/+I Efnet hybrid.	  */
-} nett_t;
+};
 
 #define IRC_CANTCHANGENICK "Can't change nickname on %s.  Is my nickname banned?"
 #endif		/* _EGG_MOD_SERVER_SERVER_H */
 
 void nuke_server(char *);
-extern inline int match_my_nick(char *);
+int match_my_nick(char *);
 
 extern bind_table_t	*BT_ctcp, *BT_ctcr, *BT_msgc;
 extern int 		serv, servidx, cycle_time, newserverport,

+ 1 - 1
src/mod/server.mod/servmsg.c

@@ -159,7 +159,7 @@ int check_bind_ctcpr(char *nick, char *uhost, struct userrec *u,
 }
 
 
-inline int match_my_nick(char *nick)
+int match_my_nick(char *nick)
 {
   return (!rfc_casecmp(nick, botname));
 }

+ 36 - 36
src/mod/share.mod/share.c

@@ -1154,45 +1154,45 @@ share_end(int idx, char *par)
 
 /* Note: these MUST be sorted. */
 static botcmd_t C_share[] = {
-  {"!", (Function) share_endstartup},
-  {"+b", (Function) share_pls_ban},
-  {"+bc", (Function) share_pls_banchan},
-  {"+bh", (Function) share_pls_bothost},
-  {"+cr", (Function) share_pls_chrec},
-  {"+e", (Function) share_pls_exempt},
-  {"+ec", (Function) share_pls_exemptchan},
-  {"+h", (Function) share_pls_host},
-  {"+i", (Function) share_pls_ignore},
-  {"+inv", (Function) share_pls_invite},
-  {"+invc", (Function) share_pls_invitechan},
-  {"-b", (Function) share_mns_ban},
-  {"-bc", (Function) share_mns_banchan},
-  {"-cr", (Function) share_mns_chrec},
-  {"-e", (Function) share_mns_exempt},
-  {"-ec", (Function) share_mns_exemptchan},
-  {"-h", (Function) share_mns_host},
-  {"-i", (Function) share_mns_ignore},
-  {"-inv", (Function) share_mns_invite},
-  {"-invc", (Function) share_mns_invitechan},
-  {"a", (Function) share_chattr},
-  {"c", (Function) share_change},
-  {"chchinfo", (Function) share_chchinfo},
-  {"e", (Function) share_end},
-  {"h", (Function) share_chhand},
-  {"k", (Function) share_killuser},
-  {"n", (Function) share_newuser},
-  {"s", (Function) share_stick_ban},
-  {"se", (Function) share_stick_exempt},
-  {"sInv", (Function) share_stick_invite},
-  {"u?", (Function) share_userfileq},
+  {"!", share_endstartup},
+  {"+b", share_pls_ban},
+  {"+bc", share_pls_banchan},
+  {"+bh", share_pls_bothost},
+  {"+cr", share_pls_chrec},
+  {"+e", share_pls_exempt},
+  {"+ec", share_pls_exemptchan},
+  {"+h", share_pls_host},
+  {"+i", share_pls_ignore},
+  {"+inv", share_pls_invite},
+  {"+invc", share_pls_invitechan},
+  {"-b", share_mns_ban},
+  {"-bc", share_mns_banchan},
+  {"-cr", share_mns_chrec},
+  {"-e", share_mns_exempt},
+  {"-ec", share_mns_exemptchan},
+  {"-h", share_mns_host},
+  {"-i", share_mns_ignore},
+  {"-inv", share_mns_invite},
+  {"-invc", share_mns_invitechan},
+  {"a", share_chattr},
+  {"c", share_change},
+  {"chchinfo", share_chchinfo},
+  {"e", share_end},
+  {"h", share_chhand},
+  {"k", share_killuser},
+  {"n", share_newuser},
+  {"s", share_stick_ban},
+  {"se", share_stick_exempt},
+  {"sInv", share_stick_invite},
+  {"u?", share_userfileq},
 #ifdef HUB
-  {"un", (Function) share_ufno},
+  {"un", share_ufno},
 #endif /* HUB */
-  {"us", (Function) share_ufsend},
+  {"us", share_ufsend},
 #ifdef HUB
-  {"uy", (Function) share_ufyes},
+  {"uy", share_ufyes},
 #endif /* HUB */
-  {"v", (Function) share_version},
+  {"v", share_version},
   {NULL, NULL}
 };
 
@@ -1380,7 +1380,7 @@ finish_share(int idx)
   }
   noshare = 0;
   ou = userlist;                /* Save old user list                   */
-  userlist = (void *) -1;       /* Do this to prevent .user messups     */
+  userlist = (struct userrec *) -1;       /* Do this to prevent .user messups     */
 
   /* Bot user pointers are updated to point to the new list, all others
    * are set to NULL. If our userfile will be overriden, just set _all_

+ 0 - 1
src/mod/transfer.mod/transfer.c

@@ -45,7 +45,6 @@ static int quiet_reject = 1;        /* Quietly reject dcc chat or sends from
 /*
  * Prototypes
  */
-struct dcc_table DCC_SEND;
 #ifdef HUB
 static void wipe_tmp_filename(char *, int);
 static int at_limit(char *);

+ 6 - 6
src/mod/update.mod/update.c

@@ -154,11 +154,11 @@ static void update_version(int idx, char *par)
 /* Note: these MUST be sorted. */
 static botcmd_t C_update[] =
 {
-  {"u?",	(Function) update_fileq},
-  {"un",	(Function) update_ufno},
-  {"us",	(Function) update_ufsend},
-  {"uy",	(Function) update_ufyes},
-  {"v",         (Function) update_version},
+  {"u?",	update_fileq},
+  {"un",	update_ufno},
+  {"us",	update_ufsend},
+  {"uy",	update_ufyes},
+  {"v",         update_version},
   {NULL,	NULL}
 };
 
@@ -186,7 +186,7 @@ static void got_nu(char *botnick, char *code, char *par)
 #ifdef LEAF
      struct bot_addr *bi = NULL, *obi = NULL;
 
-     obi = get_user(&USERENTRY_BOTADDR, conf.bot->u);
+     obi = (struct bot_addr *) get_user(&USERENTRY_BOTADDR, conf.bot->u);
      bi = (struct bot_addr *) calloc(1, sizeof(struct bot_addr));
 
      bi->uplink = strdup(botnick);

+ 2 - 2
src/net.c

@@ -749,7 +749,7 @@ int open_address_listen(IP addr, port_t *port)
 /* Returns a socket number for a listening socket that will accept any
  * connection -- port # is returned in port
  */
-inline int open_listen(port_t *port)
+int open_listen(port_t *port)
 {
 #ifdef USE_IPV6
   return open_address_listen(conf.bot->ip ? getmyip() : INADDR_ANY, AF_INET, port);
@@ -762,7 +762,7 @@ inline int open_listen(port_t *port)
  * the above is being left in for compatibility, and should NOT LONGER BE USED IN THE CORE CODE.
  */
 
-inline int open_listen_by_af(port_t *port, int af_def)
+int open_listen_by_af(port_t *port, int af_def)
 {
 #ifdef USE_IPV6
   return open_address_listen(conf.bot->ip ? getmyip() : INADDR_ANY, af_def, port);

+ 2 - 2
src/net.h

@@ -148,8 +148,8 @@ char *hostnamefromip(IP);
 void real_killsock(int, const char *, int);
 int answer(int, char *, IP *, port_t *, int);
 int findanyidx(register int);
-inline int open_listen(port_t *);
-inline int open_listen_by_af(port_t *, int);
+int open_listen(port_t *);
+int open_listen_by_af(port_t *, int);
 #ifdef USE_IPV6
 int open_address_listen(IP, int, port_t *);
 #else

+ 7 - 8
src/rfc1459.c

@@ -24,14 +24,6 @@ _rfc_casecmp(const char *s1, const char *s2)
   return (res);
 }
 
-unsigned char rfc_touppertab[];
-
-int
-_rfc_toupper(int c)
-{
-  return rfc_touppertab[(unsigned char) (c)];
-}
-
 unsigned char rfc_touppertab[] = { 0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa,
   0xb, 0xc, 0xd, 0xe, 0xf, 0x10, 0x11, 0x12, 0x13, 0x14,
   0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d,
@@ -65,3 +57,10 @@ unsigned char rfc_touppertab[] = { 0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x
   0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9,
   0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
 };
+
+int
+_rfc_toupper(int c)
+{
+  return rfc_touppertab[(unsigned char) (c)];
+}
+

+ 3 - 3
src/tclhash.c

@@ -174,7 +174,7 @@ static bind_entry_t *bind_entry_lookup(bind_table_t *table, int id, const char *
 			if (entry->mask && !strcmp(entry->mask, mask)) hit++;
 			else if (!entry->mask) hit++;
 			if (entry->function_name && !strcmp(entry->function_name, function_name)) hit++;
-			if (entry->callback == callback || !callback) hit++;
+			if (entry->callback == (HashFunc) callback || !callback) hit++;
 			if (hit == 3) break;
 		}
 	}
@@ -249,7 +249,7 @@ int bind_entry_overwrite(bind_table_t *table, int id, const char *mask, const ch
 	entry = bind_entry_lookup(table, id, mask, function_name, NULL);
 	if (!entry) return(-1);
 
-	entry->callback = callback;
+	entry->callback = (HashFunc) callback;
 	entry->client_data = client_data;
 	return(0);
 }
@@ -291,7 +291,7 @@ int bind_entry_add(bind_table_t *table, const char *flags, const char *mask, con
 	}
 	if (mask) entry->mask = strdup(mask);
 	if (function_name) entry->function_name = strdup(function_name);
-	entry->callback = callback;
+	entry->callback = (HashFunc) callback;
 	entry->client_data = client_data;
 	entry->flags = bind_flags;
 

+ 3 - 1
src/tclhash.h

@@ -8,6 +8,8 @@
 
 #include "cmds.h"
 
+typedef int (*HashFunc) (void *, void *, void *, void *, void *, void *, void *, void *, void *, void *);
+
 /* Match type flags for bind tables. */
 #define MATCH_PARTIAL       BIT0
 #define MATCH_EXACT         BIT1
@@ -41,7 +43,7 @@ typedef struct bind_entry_b {
         struct flag_record user_flags;
 	char *mask;
         char *function_name;
-        Function callback;
+        HashFunc callback;
         void *client_data;
 	int nhits;
         int flags;

+ 30 - 28
src/userent.c

@@ -205,42 +205,42 @@ struct user_entry_type USERENTRY_ADDED = {
 
 int config_set(struct userrec *u, struct user_entry *e, void *buf)
 {
-  struct xtra_key *curr = NULL, *old = NULL, *new = buf;
+  struct xtra_key *curr = NULL, *old = NULL, *mynew = (struct xtra_key *) buf;
 
-  for (curr = e->u.extra; curr; curr = curr->next) {
-    if (curr->key && !egg_strcasecmp(curr->key, new->key)) {
+  for (curr = (struct xtra_key *) e->u.extra; curr; curr = curr->next) {
+    if (curr->key && !egg_strcasecmp(curr->key, mynew->key)) {
       old = curr;
       break;
     }
   }
-  if (!old && (!new->data || !new->data[0])) {
+  if (!old && (!mynew->data || !mynew->data[0])) {
     /* delete non-existant entry */
-    free(new->key);
-    if (new->data)
-      free(new->data);
-    free(new);
+    free(mynew->key);
+    if (mynew->data)
+      free(mynew->data);
+    free(mynew);
     return 1;
   }
 
   /* we will possibly free new below, so let's send the information
    * to the botnet now */
   if (!noshare && !cfg_noshare)
-    shareout("c CONFIG %s %s %s\n", u->handle, new->key, new->data ? new->data : "");
-  if ((old && old != new) || !new->data || !new->data[0]) {
+    shareout("c CONFIG %s %s %s\n", u->handle, mynew->key, mynew->data ? mynew->data : "");
+  if ((old && old != mynew) || !mynew->data || !mynew->data[0]) {
     list_delete((struct list_type **) (&e->u.extra), (struct list_type *) old);
 
     free(old->key);
     free(old->data);
     free(old);
   }
-  if (old != new && new->data) {
-    if (new->data[0]) {
-      list_insert((&e->u.extra), new);
+  if (old != mynew && mynew->data) {
+    if (mynew->data[0]) {
+      list_insert((&e->u.extra), mynew);
     } else {
-      if (new->data)
-        free(new->data);
-      free(new->key);
-      free(new);
+      if (mynew->data)
+        free(mynew->data);
+      free(mynew->key);
+      free(mynew);
     }
   }
   return 1;
@@ -346,7 +346,7 @@ int config_kill(struct user_entry *e)
 {
   struct xtra_key *x = NULL, *y = NULL;
 
-  for (x = e->u.extra; x; x = y) {
+  for (x = (struct xtra_key *) e->u.extra; x; x = y) {
     y = x->next;
     free(x->key);
     free(x->data);
@@ -443,7 +443,7 @@ void stats_add(struct userrec *u, int login, int op)
 
   if (!u)
     return;
-  s = get_user(&USERENTRY_STATS, u);
+  s = (char *) get_user(&USERENTRY_STATS, u);
   if (s) {
     strncpyz(s2, s, sizeof(s2));
   } else
@@ -533,8 +533,8 @@ struct user_entry_type USERENTRY_MODIFIED =
 
 int pass_set(struct userrec *u, struct user_entry *e, void *buf)
 {
-  char new[32] = "";
-  register char *pass = buf;
+  char newpass[32] = "";
+  register char *pass = (char *) buf;
 
   if (e->u.extra)
     free(e->u.extra);
@@ -551,10 +551,10 @@ int pass_set(struct userrec *u, struct user_entry *e, void *buf)
       p++;
     }
     if (u->bot || (pass[0] == '+'))
-      strcpy(new, pass);
+      strcpy(newpass, pass);
     else
-      encrypt_pass(pass, new);
-    e->u.extra = strdup(new);
+      encrypt_pass(pass, newpass);
+    e->u.extra = strdup(newpass);
   }
   if (!noshare)
     shareout("c PASS %s %s\n", u->handle, pass ? pass : "");
@@ -659,7 +659,8 @@ static int laston_set(struct userrec *u, struct user_entry *e, void *buf)
       free(li);
     }
 
-    li = e->u.extra = buf;
+    li = (struct laston_info *) buf;
+    e->u.extra = (struct laston_info *) buf;
   }
 
   /* FIXME: laston sharing is disabled until a better solution is found
@@ -788,7 +789,8 @@ static int botaddr_set(struct userrec *u, struct user_entry *e, void *buf)
       free(bi);
     }
     ContextNote("(sharebug) occurred in botaddr_set");
-    bi = e->u.extra = buf;
+    bi = (struct bot_addr *) buf;
+    e->u.extra = (struct bot_addr *) buf;
   }
   Assert(u);
   if (bi && !noshare) {
@@ -924,12 +926,12 @@ static void hosts_display(int idx, struct user_entry *e, struct userrec *u)
 
 static int hosts_set(struct userrec *u, struct user_entry *e, void *buf)
 {
-  if (!buf || !egg_strcasecmp(buf, "none")) {
+  if (!buf || !egg_strcasecmp((const char *) buf, "none")) {
     /* When the bot crashes, it's in this part, not in the 'else' part */
     list_type_kill(e->u.list);
     e->u.list = NULL;
   } else {
-    char *host = buf, *p = strchr(host, ',');
+    char *host = (char *) buf, *p = strchr(host, ',');
     struct list_type **t;
 
     /* Can't have ,'s in hostmasks */

+ 9 - 9
src/userrec.c

@@ -220,7 +220,7 @@ struct userrec *get_user_by_host(char *host)
   strncpyz(host2, host, sizeof host2);
   host = fixfrom(host);
   for (u = userlist; u; u = u->next) {
-    q = get_user(&USERENTRY_HOSTS, u);
+    q = (struct list_type *) get_user(&USERENTRY_HOSTS, u);
     for (; q; q = q->next) {
       i = wild_match(q->extra, host);
       if (i > cnt) {
@@ -241,14 +241,14 @@ struct userrec *get_user_by_host(char *host)
  */
 int u_pass_match(struct userrec *u, char *in)
 {
-  char *cmp = NULL, new[32] = "", pass[MAXPASSLEN + 1] = "";
+  char *cmp = NULL, newpass[32] = "", pass[MAXPASSLEN + 1] = "";
 
   if (!u)
     return 0;
 
   egg_snprintf(pass, sizeof pass, "%s", in);
 
-  cmp = get_user(&USERENTRY_PASS, u);
+  cmp = (char *) get_user(&USERENTRY_PASS, u);
   if (!cmp && (!pass[0] || (pass[0] == '-')))
     return 1;
   if (!cmp || !pass || !pass[0] || (pass[0] == '-'))
@@ -259,8 +259,8 @@ int u_pass_match(struct userrec *u, char *in)
   } else {
     if (strlen(pass) > MAXPASSLEN)
       pass[MAXPASSLEN] = 0;
-    encrypt_pass(pass, new);
-    if (!strcmp(cmp, new))
+    encrypt_pass(pass, newpass);
+    if (!strcmp(cmp, newpass))
       return 1;
   }
   return 0;
@@ -498,7 +498,7 @@ struct userrec *adduser(struct userrec *bu, char *handle, char *host, char *pass
     }
     set_user(&USERENTRY_HOSTS, u, host);
   } else
-    set_user(&USERENTRY_HOSTS, u, "none");
+    set_user(&USERENTRY_HOSTS, u, (void *) "none");
   if (bu == userlist)
     clear_chanlist();
   noshare = oldshare;
@@ -602,7 +602,7 @@ int delhost_by_handle(char *handle, char *host)
   u = get_user_by_handle(userlist, handle);
   if (!u)
     return 0;
-  q = get_user(&USERENTRY_HOSTS, u);
+  q = (struct list_type *) get_user(&USERENTRY_HOSTS, u);
   qprev = q;
   if (q) {
     if (!rfc_casecmp(q->extra, host)) {
@@ -612,7 +612,7 @@ int delhost_by_handle(char *handle, char *host)
       free(q);
       i++;
       qprev = NULL;
-      q = e->u.extra;
+      q = (struct list_type *) e->u.extra;
     } else
       q = q->next;
     while (q) {
@@ -633,7 +633,7 @@ int delhost_by_handle(char *handle, char *host)
     }
   }
   if (!qprev)
-    set_user(&USERENTRY_HOSTS, u, "none");
+    set_user(&USERENTRY_HOSTS, u, (void *) "none");
   if (!noshare && i)
     shareout("-h %s %s\n", handle, host);
   clear_chanlist();

+ 4 - 4
src/users.c

@@ -460,7 +460,7 @@ tell_user(int idx, struct userrec *u)
 
   fr.global = u->flags;
   build_flags(s, &fr, NULL);
-  li = get_user(&USERENTRY_LASTON, u);
+  li = (struct laston_info *) get_user(&USERENTRY_LASTON, u);
   if (!li || !li->laston)
     strcpy(s1, "never");
   else {
@@ -596,7 +596,7 @@ void tell_users_match(int idx, char *mtch, int start, int limit, char *chname, i
 	dprintf(idx, MISC_TRUNCATED, limit);
     } else {
       fnd = 0;
-      for (q = get_user(&USERENTRY_HOSTS, u); q; q = q->next) {
+      for (q = (struct list_type *) get_user(&USERENTRY_HOSTS, u); q; q = q->next) {
 	if ((wild_match(mtch, q->extra)) && (!fnd)) {
 	  cnt++;
 	  fnd = 1;
@@ -1029,7 +1029,7 @@ void link_pref_val(struct userrec *u, char *val)
 
   if (!u->bot)
     return;
-  if (!(ba = get_user(&USERENTRY_BOTADDR, u))) {
+  if (!(ba = (struct bot_addr *) get_user(&USERENTRY_BOTADDR, u))) {
     return;
   }
   if (!ba->hublevel) {
@@ -1174,7 +1174,7 @@ void autolink_cycle(char *start)
   if (!start)
     botlinkcount = 0;
 
-  my_ba = get_user(&USERENTRY_BOTADDR, conf.bot->u);
+  my_ba = (struct bot_addr *) get_user(&USERENTRY_BOTADDR, conf.bot->u);
   if (my_ba && (my_ba->uplink[0])) {
     strncpyz(uplink, my_ba->uplink, sizeof(uplink));
   } else {

+ 2 - 2
src/users.h

@@ -146,8 +146,8 @@ extern struct igrec *global_ign;
 
 struct userrec *get_user_by_handle(struct userrec *, char *);
 struct userrec *get_user_by_host(char *);
-struct userrec *check_chanlist();
-struct userrec *check_chanlist_hand();
+struct userrec *check_chanlist(const char *);
+struct userrec *check_chanlist_hand(const char *);
 
 /* All the default userentry stuff, for code re-use
  */