1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-06 20:23:13 +02:00

Corrected numerous -Wall warnings

This commit is contained in:
codemastr
2004-11-04 21:42:34 +00:00
parent e72b29f81c
commit fb0802a22b
22 changed files with 37 additions and 59 deletions
+1 -1
View File
@@ -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
+3 -3
View File
@@ -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)
-1
View File
@@ -74,7 +74,6 @@ int i;
Extban *ExtbanAdd(Module *module, ExtbanInfo req)
{
Extban *tmp;
int slot;
char tmpbuf[512];
+1 -2
View File
@@ -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);
+1 -2
View File
@@ -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)
-1
View File
@@ -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))
+1 -1
View File
@@ -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[] =
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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
+4 -1
View File
@@ -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];
+1 -1
View File
@@ -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;
+1 -5
View File
@@ -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];
-1
View File
@@ -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;
+1 -2
View File
@@ -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 ? */
-3
View File
@@ -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;
-5
View File
@@ -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();
-1
View File
@@ -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;
+20 -21
View File
@@ -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 <port> 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; }
-2
View File
@@ -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)
-2
View File
@@ -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"))
+1 -1
View File
@@ -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;
-1
View File
@@ -84,7 +84,6 @@ MODVAR int sendanyways = 0;
*/
static int dead_link(aClient *to, char *notice)
{
char *error = NULL;
to->flags |= FLAGS_DEADSOCKET;
/*