From fb0802a22bb2ba9264f40ed522ba7d4c40138f08 Mon Sep 17 00:00:00 2001 From: codemastr Date: Thu, 4 Nov 2004 21:42:34 +0000 Subject: [PATCH] Corrected numerous -Wall warnings --- Changes | 2 +- src/channel.c | 6 +++--- src/extbans.c | 1 - src/hash.c | 3 +-- src/modules.c | 3 +-- src/modules/m_chghost.c | 1 - src/modules/m_dccallow.c | 2 +- src/modules/m_message.c | 2 +- src/modules/m_sethost.c | 2 +- src/modules/m_sjoin.c | 5 ++++- src/modules/m_svsmode.c | 2 +- src/modules/m_tkl.c | 6 +----- src/modules/m_who.c | 1 - src/modules/oldcloak.c | 3 +-- src/parse.c | 3 --- src/random.c | 5 ----- src/res.c | 1 - src/s_conf.c | 41 ++++++++++++++++++++-------------------- src/s_kline.c | 2 -- src/s_misc.c | 2 -- src/s_serv.c | 2 +- src/send.c | 1 - 22 files changed, 37 insertions(+), 59 deletions(-) diff --git a/Changes b/Changes index 3ea1e2b1b..d458063f5 100644 --- a/Changes +++ b/Changes @@ -424,4 +424,4 @@ impact on performance. - Added duplicate config entry detection (#0002126) suggested by brain2 - May have a few bugs (easily fixed) - +- Corrected numerous -Wall warnings diff --git a/src/channel.c b/src/channel.c index f525965a4..430be9af6 100644 --- a/src/channel.c +++ b/src/channel.c @@ -567,7 +567,7 @@ char *ban_realhost = NULL, *ban_virthost = NULL, *ban_ip = NULL; Ban *is_banned(aClient *sptr, aChannel *chptr, int type) { Ban *tmp, *tmp2; - char *s, *p; + char *s; static char realhost[NICKLEN + USERLEN + HOSTLEN + 6]; static char virthost[NICKLEN + USERLEN + HOSTLEN + 6]; static char nuip[NICKLEN + USERLEN + HOSTLEN + 6]; @@ -2572,7 +2572,7 @@ int do_mode_char(aChannel *chptr, long modetype, char modechar, char *param, } else { /* NEW +F */ char xbuf[256], c, a, *p, *p2, *x = xbuf+1; - int v, i; + int v; unsigned short warnings = 0, breakit; unsigned char r; @@ -5038,7 +5038,7 @@ RemoveFld *e; */ void chanfloodtimer_add(aChannel *chptr, char mflag, long mbit, time_t when) { -RemoveFld *e; +RemoveFld *e = NULL; unsigned char add=1; if (chptr->mode.floodprot->timer_flags & mbit) diff --git a/src/extbans.c b/src/extbans.c index d4205701d..7a5bc36b2 100644 --- a/src/extbans.c +++ b/src/extbans.c @@ -74,7 +74,6 @@ int i; Extban *ExtbanAdd(Module *module, ExtbanInfo req) { -Extban *tmp; int slot; char tmpbuf[512]; diff --git a/src/hash.c b/src/hash.c index 16ac7df02..a54d07072 100644 --- a/src/hash.c +++ b/src/hash.c @@ -790,7 +790,7 @@ EVENT(e_clean_out_throttling_buckets) { struct ThrottlingBucket *n; int i; - struct ThrottlingBucket z = { NULL, NULL, 0}; + struct ThrottlingBucket z = { NULL, NULL, {0}, 0, 0}; static time_t t = 0; for (i = 0; i < THROTTLING_HASH_SIZE; i++) @@ -804,7 +804,6 @@ EVENT(e_clean_out_throttling_buckets) if (!t || (TStime() - t > 30)) { - int i; extern char serveropts[]; extern Module *Modules; char *p = serveropts + strlen(serveropts); diff --git a/src/modules.c b/src/modules.c index ee4ceda57..d968d4faa 100644 --- a/src/modules.c +++ b/src/modules.c @@ -192,7 +192,6 @@ char *Module_Create(char *path_) ModuleHeader *mod_header; int ret = 0; Module *mod = NULL, **Mod_Handle = NULL; - int *x; int betaversion,tag; char *expectedmodversion = our_mod_version(); Debug((DEBUG_DEBUG, "Attempting to load module from %s", @@ -739,7 +738,7 @@ vFP Module_SymX(char *name, Module **mptr) void module_loadall(int module_load) { #ifndef STATIC_LINKING - iFP fp, fpp; + iFP fp; Module *mi, *next; if (!loop.ircd_booted) diff --git a/src/modules/m_chghost.c b/src/modules/m_chghost.c index 7e655f71a..ed31a6051 100644 --- a/src/modules/m_chghost.c +++ b/src/modules/m_chghost.c @@ -102,7 +102,6 @@ DLLFUNC int MOD_UNLOAD(m_chghost)(int module_unload) DLLFUNC int m_chghost(aClient *cptr, aClient *sptr, int parc, char *parv[]) { aClient *acptr; - char *s; #ifdef DISABLE_USERMOD if (MyClient(sptr)) diff --git a/src/modules/m_dccallow.c b/src/modules/m_dccallow.c index b50cc3a39..b91de821d 100644 --- a/src/modules/m_dccallow.c +++ b/src/modules/m_dccallow.c @@ -82,7 +82,7 @@ DLLFUNC int m_dccallow(aClient *cptr, aClient *sptr, int parc, char *parv[]) { Link *lp; char *p, *s; -aClient *acptr, *lastcptr = NULL; +aClient *acptr; int didlist = 0, didhelp = 0, didanything = 0; char **ptr; static char *dcc_help[] = diff --git a/src/modules/m_message.c b/src/modules/m_message.c index 7fd73975a..e6fb615f1 100644 --- a/src/modules/m_message.c +++ b/src/modules/m_message.c @@ -824,7 +824,7 @@ static int check_dcc_soft(aClient *from, aClient *to, char *text) char *ctcp; ConfigItem_deny_dcc *fl; char *end, realfile[BUFSIZE]; -int size_string, ret; +int size_string; if ((*text != 1) || IsOper(from) || IsOper(to)) return 1; diff --git a/src/modules/m_sethost.c b/src/modules/m_sethost.c index 8b0c45845..d31d25089 100644 --- a/src/modules/m_sethost.c +++ b/src/modules/m_sethost.c @@ -93,7 +93,7 @@ DLLFUNC int MOD_UNLOAD(m_sethost)(int module_unload) */ DLLFUNC int m_sethost(aClient *cptr, aClient *sptr, int parc, char *parv[]) { - char *vhost, *s; + char *vhost; #ifndef DISABLE_USERMOD int permit = 0; /* 0 = opers(glob/locop) 1 = global oper 2 = not MY clients.. */ #else diff --git a/src/modules/m_sjoin.c b/src/modules/m_sjoin.c index 48df6bec6..b191e4155 100644 --- a/src/modules/m_sjoin.c +++ b/src/modules/m_sjoin.c @@ -184,7 +184,10 @@ CMD_FUNC(m_sjoin) unsigned short removetheirs; unsigned short merge; /* same timestamp */ char pvar[MAXMODEPARAMS][MODEBUFLEN + 3]; - char paraback[1024], modeback[1024]; + char paraback[1024]; +#ifndef NEWCHFLOODPROT + char modeback[1024]; +#endif char banbuf[1024]; char exbuf[1024]; char cbuf[1024]; diff --git a/src/modules/m_svsmode.c b/src/modules/m_svsmode.c index e1fffa18f..d4e057712 100644 --- a/src/modules/m_svsmode.c +++ b/src/modules/m_svsmode.c @@ -300,7 +300,7 @@ int channel_svsmode(aClient *cptr, aClient *sptr, int parc, char *parv[]) int do_svsmode(aClient *cptr, aClient *sptr, int parc, char *parv[], int show_change) { int i; -char **p, *m; +char *m; aClient *acptr; int what, setflags; char *xmsg = show_change ? MSG_SVS2MODE : MSG_SVSMODE; diff --git a/src/modules/m_tkl.c b/src/modules/m_tkl.c index eb17c4521..9a87b4c07 100644 --- a/src/modules/m_tkl.c +++ b/src/modules/m_tkl.c @@ -486,11 +486,8 @@ int spamfilter_usage(aClient *sptr) DLLFUNC int m_spamfilter(aClient *cptr, aClient *sptr, int parc, char *parv[]) { int whattodo = 0; /* 0 = add 1 = del */ -int i; -aClient *acptr = NULL; -char *mask = NULL; char mo[32], mo2[32]; -char *p, *usermask, *hostmask; +char *p; char *tkllayer[11] = { me.name, /* 0 server.name */ NULL, /* 1 +|- */ @@ -504,7 +501,6 @@ char *tkllayer[11] = { "", /* 9 tkl reason */ "" /* 10 regex */ }; -struct tm *t; int targets = 0, action = 0; char targetbuf[64], actionbuf[2]; char reason[512]; diff --git a/src/modules/m_who.c b/src/modules/m_who.c index 3704620d3..8c7f4afdf 100644 --- a/src/modules/m_who.c +++ b/src/modules/m_who.c @@ -577,7 +577,6 @@ char has_common_chan = 0; static void do_channel_who(aClient *sptr, aChannel *channel, char *mask) { Member *cm = channel->members; - int i = 0; if (IsMember(sptr, channel) || IsNetAdmin(sptr)) who_flags |= WF_ONCHANNEL; diff --git a/src/modules/oldcloak.c b/src/modules/oldcloak.c index bef848280..c9b83b90b 100644 --- a/src/modules/oldcloak.c +++ b/src/modules/oldcloak.c @@ -173,7 +173,6 @@ int errors = 0; DLLFUNC int oldcloak_config_run(ConfigFile *cf, ConfigEntry *ce, int type) { -ConfigEntry *cep; unsigned long r; char temp[128]; @@ -201,7 +200,7 @@ DLLFUNC char *hidehost(char *host) static char h3[300]; unsigned long l[8]; int i; - char *p, *q; + char *p; /* Find out what kind of host we're dealing with here */ /* IPv6 ? */ diff --git a/src/parse.c b/src/parse.c index 6e7e28230..04a1a53aa 100644 --- a/src/parse.c +++ b/src/parse.c @@ -148,9 +148,6 @@ aClient *find_person(char *name, aClient *cptr) void ban_flooder(aClient *cptr) { - int i; - aClient *acptr; - /* place_host_ban also takes care of removing any other clients with same host/ip */ place_host_ban(cptr, BAN_ACT_ZLINE, "Flood from unknown connection", UNKNOWN_FLOOD_BANTIME); return; diff --git a/src/random.c b/src/random.c index 75c54bdf6..6eb338233 100644 --- a/src/random.c +++ b/src/random.c @@ -62,7 +62,6 @@ struct arc4_stream { u_char s[256]; }; -static int rs_initialized; static struct arc4_stream rs; static void arc4_init(void) @@ -175,16 +174,12 @@ struct { #endif } rdat; -unsigned int seed, egd = 0; -time_t now = TStime(); int n; #ifndef _WIN32 -struct timeval nowt; int fd; #else MEMORYSTATUS mstat; -struct _timeb nowt; #endif arc4_init(); diff --git a/src/res.c b/src/res.c index 7348836ed..f3bedf12d 100644 --- a/src/res.c +++ b/src/res.c @@ -618,7 +618,6 @@ static int do_query_number(Link *lp, struct IN_ADDR *numb, ResRQ *rptr) */ static int query_name(char *name, int class, int type, ResRQ *rptr) { - struct timeval tv; char buf[MAXPACKET]; int r, s; HEADER *hptr; diff --git a/src/s_conf.c b/src/s_conf.c index 11b46e07e..f0442ba8f 100644 --- a/src/s_conf.c +++ b/src/s_conf.c @@ -2920,7 +2920,6 @@ int _test_me(ConfigFile *conf, ConfigEntry *ce) { char has_name = 0, has_info = 0, has_numeric = 0; ConfigEntry *cep; - long l; int errors = 0; if (requiredstuff.conf_me) @@ -2963,7 +2962,7 @@ int _test_me(ConfigFile *conf, ConfigEntry *ce) else if (!strcmp(cep->ce_varname, "info")) { char *p; - char valid; + char valid = 0; if (has_info) { config_warn_duplicate(cep->ce_fileptr->cf_filename, @@ -3230,7 +3229,7 @@ int _test_oper(ConfigFile *conf, ConfigEntry *ce) l = atoi(cep->ce_vardata); if ((l < 0) || (l > 5000)) { - config_error("%s:%i: oper::maxlogins: value out of range (%ld) should be 0-5000", + config_error("%s:%i: oper::maxlogins: value out of range (%d) should be 0-5000", cep->ce_fileptr->cf_filename, cep->ce_varlinenum, l); errors++; continue; @@ -3393,7 +3392,6 @@ int _conf_class(ConfigFile *conf, ConfigEntry *ce) int _test_class(ConfigFile *conf, ConfigEntry *ce) { ConfigEntry *cep; - long l; int errors = 0; char has_pingfreq = 0, has_connfreq = 0, has_maxclients = 0, has_sendq = 0; char has_recvq = 0; @@ -3871,7 +3869,6 @@ int _conf_listen(ConfigFile *conf, ConfigEntry *ce) char *port; int start, end, iport; int tmpflags =0; - unsigned char isnew = 0; strcpy(copy, ce->ce_vardata); /* Seriously cheap hack to make listen work -Stskeeps */ @@ -4491,7 +4488,7 @@ void create_tkl_except(char *mask, char *type) int _conf_except(ConfigFile *conf, ConfigEntry *ce) { - ConfigEntry *cep, *cep2, *cep3; + ConfigEntry *cep; ConfigItem_except *ca; Hook *h; struct irc_netmask tmp; @@ -4538,7 +4535,7 @@ int _conf_except(ConfigFile *conf, ConfigEntry *ce) } #endif else if (!strcmp(ce->ce_vardata, "tkl")) { - ConfigEntry *mask, *type; + ConfigEntry *mask = NULL, *type = NULL; for (cep = ce->ce_entries; cep; cep = cep->ce_next) { if (!strcmp(cep->ce_varname, "mask")) @@ -4569,7 +4566,7 @@ int _conf_except(ConfigFile *conf, ConfigEntry *ce) int _test_except(ConfigFile *conf, ConfigEntry *ce) { - ConfigEntry *cep, *cep3; + ConfigEntry *cep; int errors = 0; Hook *h; char has_mask = 0; @@ -4691,7 +4688,6 @@ int _test_except(ConfigFile *conf, ConfigEntry *ce) } if (cep->ce_vardata) { - OperFlag *opf; if (!strcmp(cep->ce_vardata, "tkline") || !strcmp(cep->ce_vardata, "tzline")) { @@ -4718,7 +4714,6 @@ int _test_except(ConfigFile *conf, ConfigEntry *ce) ConfigEntry *cepp; for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) { - OperFlag *opf; if (!strcmp(cepp->ce_varname, "tkline") || !strcmp(cepp->ce_varname, "tzline")) { @@ -5060,7 +5055,7 @@ static ConfigItem_badword *copy_badword_struct(ConfigItem_badword *ca, int regex int _conf_badword(ConfigFile *conf, ConfigEntry *ce) { - ConfigEntry *cep, *word; + ConfigEntry *cep, *word = NULL; ConfigItem_badword *ca; char *tmp; short regex = 0; @@ -5173,8 +5168,7 @@ int _conf_badword(ConfigFile *conf, ConfigEntry *ce) int _test_badword(ConfigFile *conf, ConfigEntry *ce) { int errors = 0; - ConfigEntry *word, *replace, *cep; - regex_t expr; + ConfigEntry *cep; char has_word = 0, has_replace = 0, has_action = 0, action = 'r'; if (!ce->ce_vardata) @@ -5279,8 +5273,8 @@ int _conf_spamfilter(ConfigFile *conf, ConfigEntry *ce) ConfigEntry *cep; ConfigEntry *cepp; aTKline *nl = MyMallocEx(sizeof(aTKline)); - char *word, *reason, *bantime; - int action, target; + char *word = NULL, *reason = NULL, *bantime = NULL; + int action = 0, target = 0; char has_reason = 0, has_bantime = 0; for (cep = ce->ce_entries; cep; cep = cep->ce_next) @@ -5346,7 +5340,6 @@ int _test_spamfilter(ConfigFile *conf, ConfigEntry *ce) { ConfigEntry *cep, *cepp; int errors = 0; - int got = 0; char *regex = NULL, *reason = NULL; char has_target = 0, has_regex = 0, has_action = 0, has_reason = 0, has_bantime = 0; @@ -5414,8 +5407,16 @@ int _test_spamfilter(ConfigFile *conf, ConfigEntry *ce) continue; } if (!strcmp(cep->ce_varname, "reason")) + { + if (has_reason) + { + config_warn_duplicate(cep->ce_fileptr->cf_filename, + cep->ce_varlinenum, "spamfilter::reason"); + continue; + } + has_reason = 1; reason = cep->ce_vardata; - + } else if (!strcmp(cep->ce_varname, "regex")) { char *errbuf; @@ -5582,7 +5583,7 @@ int _conf_log(ConfigFile *conf, ConfigEntry *ce) int _test_log(ConfigFile *conf, ConfigEntry *ce) { int errors = 0; - ConfigEntry *cep, *flags, *maxsize, *cepp; + ConfigEntry *cep, *cepp; char has_flags = 0, has_maxsize = 0; if (!ce->ce_vardata) @@ -6242,7 +6243,6 @@ int _conf_set(ConfigFile *conf, ConfigEntry *ce) { ConfigEntry *cep, *cepp, *ceppp; OperFlag *ofl = NULL; - char temp[512]; Hook *h; for (cep = ce->ce_entries; cep; cep = cep->ce_next) @@ -6635,9 +6635,8 @@ int _test_set(ConfigFile *conf, ConfigEntry *ce) { ConfigEntry *cep, *cepp, *ceppp; OperFlag *ofl = NULL; - long templong, l1, l2,l3; + long templong; int tempi; - int i; int errors = 0; Hook *h; #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/s_kline.c b/src/s_kline.c index 13151a8d5..24531ea87 100644 --- a/src/s_kline.c +++ b/src/s_kline.c @@ -951,7 +951,6 @@ int m_tkl(aClient *cptr, aClient *sptr, int parc, char *parv[]) char gmt[256], gmt2[256]; char txt[256]; TS expiry_1, setat_1, spamf_tklduration = 0; - int index; char *reason = NULL; if (!IsServer(sptr) && !IsOper(sptr) && !IsMe(sptr)) @@ -1463,7 +1462,6 @@ SpamExcept *e; int dospamfilter(aClient *sptr, char *str_in, int type, char *target) { aTKline *tk; -int n; char *str; if (type == SPAMF_USER) diff --git a/src/s_misc.c b/src/s_misc.c index 71f77cadb..f21759b1f 100644 --- a/src/s_misc.c +++ b/src/s_misc.c @@ -432,7 +432,6 @@ int exit_client(aClient *cptr, aClient *sptr, aClient *from, char *comment) #ifdef FDLIST_DEBUG { int i; - int cnt = 0; if (!IsAnOper(sptr)) { @@ -1004,7 +1003,6 @@ int flags = 0; int spamfilter_getconftargets(char *s) { -int flags = 0; if (!strcmp(s, "channel")) return SPAMF_CHANMSG; if (!strcmp(s, "private")) diff --git a/src/s_serv.c b/src/s_serv.c index 74537b4dc..697231c25 100644 --- a/src/s_serv.c +++ b/src/s_serv.c @@ -1071,7 +1071,7 @@ CMD_FUNC(m_restart) */ int short_motd(aClient *sptr) { ConfigItem_tld *ptr; - aMotd *temp, *temp2; + aMotd *temp; struct tm *tm = &smotd_tm; char userhost[HOSTLEN + USERLEN + 6]; char is_short = 1; diff --git a/src/send.c b/src/send.c index a10d5cb92..622c1cfbd 100644 --- a/src/send.c +++ b/src/send.c @@ -84,7 +84,6 @@ MODVAR int sendanyways = 0; */ static int dead_link(aClient *to, char *notice) { - char *error = NULL; to->flags |= FLAGS_DEADSOCKET; /*