diff --git a/Changes b/Changes index 72688bb93..ac3e5e030 100644 --- a/Changes +++ b/Changes @@ -1939,3 +1939,4 @@ seen. gmtime warning still there censor several badwords by default. Based on suggestions by Gargo - Fixed two ident bugs (multihomed&connect), both resulted in ident not working. - Added set::options::dont-resolve (=hostnames of incomming clients won't be resolved). +- Code cleanup (gcc 3.2 warnings with -Wall). diff --git a/src/channel.c b/src/channel.c index 2081786b1..fc8d9d105 100644 --- a/src/channel.c +++ b/src/channel.c @@ -1058,7 +1058,6 @@ CMD_FUNC(m_mode) { long unsigned sendts = 0; Ban *ban; - aClient *user; aChannel *chptr; @@ -3932,7 +3931,6 @@ void send_list(aClient *cptr, int numsend) /* All done */ if (hashnum == CH_MAX) { - Link *lp, *next; sendto_one(cptr, rpl_str(RPL_LISTEND), me.name, cptr->name); free_str_list(cptr->user->lopt->yeslist); free_str_list(cptr->user->lopt->nolist); @@ -4031,7 +4029,7 @@ CMD_FUNC(m_list) TS currenttime = TStime(); char *name, *p = NULL; LOpts *lopt = NULL; - Link *lp, *next; + Link *lp; int usermax, usermin, error = 0, doall = 0; TS chantimemin, chantimemax; TS topictimemin, topictimemax; diff --git a/src/list.c b/src/list.c index fad378758..ca9ab5f7e 100644 --- a/src/list.c +++ b/src/list.c @@ -40,6 +40,7 @@ #include "common.h" #include "sys.h" #include "h.h" +#include "proto.h" #include "numeric.h" #ifdef DBMALLOC #include "malloc.h" diff --git a/src/modules.c b/src/modules.c index bb4679184..de9553a32 100644 --- a/src/modules.c +++ b/src/modules.c @@ -674,8 +674,6 @@ int Module_Depend_Resolve(Module *p) int m_module(aClient *cptr, aClient *sptr, int parc, char *parv[]) { - int i; - char *ret; Module *mi; if (!IsAdmin(sptr)) diff --git a/src/modules/l_commands.c b/src/modules/l_commands.c index b8b9ba7e4..a0d034170 100644 --- a/src/modules/l_commands.c +++ b/src/modules/l_commands.c @@ -146,7 +146,9 @@ DLLFUNC int Mod_Test(ModuleInfo *modinfo) int l_commands_Test(ModuleInfo *modinfo) #endif { +#ifdef SCAN_API Module p; +#endif bcopy(modinfo,&ModCmdsInfo,modinfo->size); #ifdef SCAN_API p.header = &scan_socks_Header; diff --git a/src/modules/m_htm.c b/src/modules/m_htm.c index 0415ee24d..ee297066f 100644 --- a/src/modules/m_htm.c +++ b/src/modules/m_htm.c @@ -482,7 +482,6 @@ DLLFUNC int htm_config_test(ConfigFile *cf, ConfigEntry *ce, int type, int *errs DLLFUNC int htm_config_run(ConfigFile *cf, ConfigEntry *ce, int type) { ConfigEntry *cep; - int errors = 0; if (type != CONFIG_SET) return 0; diff --git a/src/modules/m_svslusers.c b/src/modules/m_svslusers.c index 446d4b1cf..904d73855 100644 --- a/src/modules/m_svslusers.c +++ b/src/modules/m_svslusers.c @@ -109,8 +109,6 @@ int m_svslusers_Unload(int module_unload) */ int m_svslusers(aClient *cptr, aClient *sptr, int parc, char *parv[]) { - aClient *acptr; - if (!IsULine(sptr) || parc < 4) return -1; if (hunt_server_token(cptr, sptr, MSG_SVSLUSERS, TOK_SVSLUSERS, "%s %s :%s", 1, parc, diff --git a/src/modules/m_unkline.c b/src/modules/m_unkline.c index fadde4a8f..9ba286edb 100644 --- a/src/modules/m_unkline.c +++ b/src/modules/m_unkline.c @@ -117,11 +117,6 @@ int m_unkline_Unload(int module_unload) DLLFUNC int m_unkline(aClient *cptr, aClient *sptr, int parc, char *parv[]) { - - char *hosttemp = parv[1], host[80], name[80]; - ConfigItem_ban *bconf; - - if (!MyClient(sptr) || !OPCanUnKline(sptr)) { sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]); diff --git a/src/modules/m_unzline.c b/src/modules/m_unzline.c index ede5b399f..a17a96cc2 100644 --- a/src/modules/m_unzline.c +++ b/src/modules/m_unzline.c @@ -118,12 +118,6 @@ int m_unzline_Unload(int module_unload) DLLFUNC int m_unzline(aClient *cptr, aClient *sptr, int parc, char *parv[]) { - char userhost[512 + 2] = "", *in; - int uline = 0, akill = 0; - char *mask, *server = NULL; - ConfigItem_ban *bconf; - uline = IsULine(sptr) ? 1 : 0; - if (!MyClient(sptr) || !OPCanZline(sptr)) { sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]); diff --git a/src/modules/scan.c b/src/modules/scan.c index 0890fb68c..74b3da988 100644 --- a/src/modules/scan.c +++ b/src/modules/scan.c @@ -441,7 +441,6 @@ DLLFUNC int h_config_test(ConfigFile *cf, ConfigEntry *ce, int type, int *errs) DLLFUNC int h_config_run(ConfigFile *cf, ConfigEntry *ce, int type) { ConfigEntry *cep; - int errors = 0; if (type != CONFIG_SET) return 0; diff --git a/src/res.c b/src/res.c index fb52ac3a6..cc7cc2712 100644 --- a/src/res.c +++ b/src/res.c @@ -55,7 +55,9 @@ static ResRQ *last, *first; ** Currently the list is only protected on Windows because we don't use ** threads to access it on Unix */ +#ifdef _WIN32 static MUTEX g_hResMutex; +#endif static int lock_request(); static int unlock_request(); diff --git a/src/s_bsd.c b/src/s_bsd.c index 7a5553683..9d125fcd7 100644 --- a/src/s_bsd.c +++ b/src/s_bsd.c @@ -1035,10 +1035,11 @@ void set_sock_opts(int fd, aClient *cptr) char *s = readbuf, *t = readbuf + sizeof(readbuf) / 2; opt = sizeof(readbuf) / 8; - if (getsockopt(fd, IPPROTO_IP, IP_OPTIONS, (OPT_TYPE *)t, - &opt) < 0) + if (getsockopt(fd, IPPROTO_IP, IP_OPTIONS, (OPT_TYPE *)t, &opt) < 0) + { if (ERRNO != P_ECONNRESET) /* FreeBSD can generate this -- Syzop */ report_error("getsockopt(IP_OPTIONS) %s:%s", cptr); + } else if (opt > 0 && opt != sizeof(readbuf) / 8) { for (*readbuf = '\0'; opt > 0; opt--, s += 3) @@ -2592,7 +2593,7 @@ void do_dns_async(int id) break; case -2: /* Should not happen since hp is not NULL */ - sendto_realops("Hostname %s is unknown for server %s (???).", aconf->hostname, aconf->servername); + sendto_realops("Hostname %s is unknown for server %s (!?).", aconf->hostname, aconf->servername); break; default: sendto_realops("Connection to %s failed: %s", aconf->servername, strerror(n)); diff --git a/src/s_conf.c b/src/s_conf.c index 3d32586f8..67605b207 100644 --- a/src/s_conf.c +++ b/src/s_conf.c @@ -127,10 +127,10 @@ static int _test_set (ConfigFile *conf, ConfigEntry *ce); static int _test_badword (ConfigFile *conf, ConfigEntry *ce); #endif static int _test_deny (ConfigFile *conf, ConfigEntry *ce); -static int _test_deny_dcc (ConfigFile *conf, ConfigEntry *ce); -static int _test_deny_link (ConfigFile *conf, ConfigEntry *ce); -static int _test_deny_channel (ConfigFile *conf, ConfigEntry *ce); -static int _test_deny_version (ConfigFile *conf, ConfigEntry *ce); +/* static int _test_deny_dcc (ConfigFile *conf, ConfigEntry *ce); ** TODO? */ +/* static int _test_deny_link (ConfigFile *conf, ConfigEntry *ce); ** TODO? */ +/* static int _test_deny_channel (ConfigFile *conf, ConfigEntry *ce); ** TODO? */ +/* static int _test_deny_version (ConfigFile *conf, ConfigEntry *ce); ** TODO? */ static int _test_allow_channel (ConfigFile *conf, ConfigEntry *ce); static int _test_loadmodule (ConfigFile *conf, ConfigEntry *ce); static int _test_log (ConfigFile *conf, ConfigEntry *ce); @@ -1236,7 +1236,6 @@ void config_rehash() ConfigItem_deny_version *deny_version_ptr; ConfigItem_log *log_ptr; ConfigItem_alias *alias_ptr; - ConfigItem_include *include_ptr; ConfigItem_help *help_ptr; ListStruct *next, *next2; @@ -2042,13 +2041,13 @@ char *pretty_time_val(long timeval) buf[0] = 0; if (timeval/86400) - sprintf(buf, "%d day%s ", timeval/86400, timeval/86400 != 1 ? "s" : ""); + sprintf(buf, "%ld day%s ", timeval/86400, timeval/86400 != 1 ? "s" : ""); if ((timeval/3600) % 24) - sprintf(buf, "%s%d hour%s ", buf, (timeval/3600)%24, (timeval/3600)%24 != 1 ? "s" : ""); + sprintf(buf, "%s%ld hour%s ", buf, (timeval/3600)%24, (timeval/3600)%24 != 1 ? "s" : ""); if ((timeval/60)%60) - sprintf(buf, "%s%d minute%s ", buf, (timeval/60)%60, (timeval/60)%60 != 1 ? "s" : ""); + sprintf(buf, "%s%ld minute%s ", buf, (timeval/60)%60, (timeval/60)%60 != 1 ? "s" : ""); if ((timeval%60)) - sprintf(buf, "%s%d second%s", buf, timeval%60, timeval%60 != 1 ? "s" : ""); + sprintf(buf, "%s%ld second%s", buf, timeval%60, timeval%60 != 1 ? "s" : ""); return buf; } @@ -2523,10 +2522,6 @@ int _test_oper(ConfigFile *conf, ConfigEntry *ce) { ConfigEntry *cep; ConfigEntry *cepp; - ConfigItem_oper *oper = NULL; - ConfigItem_oper_from *from; - OperFlag *ofp = NULL; - unsigned char isnew = 0; int errors = 0; if (!ce->ce_vardata) { @@ -3153,8 +3148,6 @@ int _test_listen(ConfigFile *conf, ConfigEntry *ce) { ConfigEntry *cep; ConfigEntry *cepp; - ConfigItem_listen *listen = NULL; - OperFlag *ofp; char copy[256]; char *ip; char *port; @@ -3336,8 +3329,6 @@ int _conf_allow(ConfigFile *conf, ConfigEntry *ce) int _test_allow(ConfigFile *conf, ConfigEntry *ce) { ConfigEntry *cep, *cepp; - ConfigItem_allow *allow; - unsigned char isnew = 0; int errors = 0; if (ce->ce_vardata) { @@ -3655,7 +3646,7 @@ int _conf_except(ConfigFile *conf, ConfigEntry *ce) int _test_except(ConfigFile *conf, ConfigEntry *ce) { - ConfigEntry *cep, *cep2, *cep3; + ConfigEntry *cep, *cep3; int errors = 0; if (!ce->ce_vardata) @@ -4244,7 +4235,6 @@ int _conf_log(ConfigFile *conf, ConfigEntry *ce) { ConfigEntry *cep, *cepp; ConfigItem_log *ca; - aMotd *last = NULL, *temp; OperFlag *ofp = NULL; ca = MyMallocEx(sizeof(ConfigItem_log)); @@ -4271,7 +4261,6 @@ int _conf_log(ConfigFile *conf, ConfigEntry *ce) int _test_log(ConfigFile *conf, ConfigEntry *ce) { int errors = 0; ConfigEntry *cep, *flags, *maxsize, *cepp; - OperFlag *ofp = NULL; if (!ce->ce_vardata) { @@ -4352,7 +4341,6 @@ int _conf_link(ConfigFile *conf, ConfigEntry *ce) ConfigEntry *cepp; ConfigItem_link *link = NULL; OperFlag *ofp; - unsigned char isnew = 0; link = (ConfigItem_link *) MyMallocEx(sizeof(ConfigItem_link)); link->servername = strdup(ce->ce_vardata); @@ -4709,7 +4697,6 @@ int _conf_set(ConfigFile *conf, ConfigEntry *ce) ConfigEntry *cep, *cepp, *ceppp; OperFlag *ofl = NULL; char temp[512]; - int i; for (cep = ce->ce_entries; cep; cep = cep->ce_next) { @@ -4940,7 +4927,6 @@ int _test_set(ConfigFile *conf, ConfigEntry *ce) OperFlag *ofl = NULL; long templong, l1, l2,l3; int tempi; - char temp[512]; int i; int errors = 0; #define CheckNull(x) if ((!(x)->ce_vardata) || (!(*((x)->ce_vardata)))) { config_error("%s:%i: missing parameter", (x)->ce_fileptr->cf_filename, (x)->ce_varlinenum); errors++; continue; } diff --git a/src/socket.c b/src/socket.c index 9025616f1..6d97846c2 100644 --- a/src/socket.c +++ b/src/socket.c @@ -234,13 +234,13 @@ char *Inet_ia2p(struct IN_ADDR *ia) char *Inet_ia2pNB(struct IN_ADDR *ia, int compressed) { - static char buf[256]; #ifndef INET6 return ((char *)inet_ntoa(*ia)); #else + static char buf[256]; if (compressed) return ((char *)inet_ntop(AFINET, ia, buf, sizeof(buf))); else return ((char *)inetntop(AFINET, ia, buf, sizeof(buf))); #endif -} \ No newline at end of file +} diff --git a/src/zip.c b/src/zip.c index 79a89902e..c4634266d 100644 --- a/src/zip.c +++ b/src/zip.c @@ -25,6 +25,7 @@ #include "msg.h" #include "channel.h" #include "version.h" +#include "proto.h" #include #include