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

- Code cleanup (gcc 3.2 warnings with -Wall).

Compile tests done: Linux, Linux SSL, Linux SSL+ZIP, Windows, Windows ZIP, Windows SSL+ZIP.
This might also have fixed some (or 1) bug(s) :P.
This commit is contained in:
Bram Matthys
2003-02-23 03:41:39 +00:00
parent 8fbb67818b
commit 28d355f649
15 changed files with 23 additions and 48 deletions
+1
View File
@@ -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).
+1 -3
View File
@@ -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;
+1
View File
@@ -40,6 +40,7 @@
#include "common.h"
#include "sys.h"
#include "h.h"
#include "proto.h"
#include "numeric.h"
#ifdef DBMALLOC
#include "malloc.h"
-2
View File
@@ -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))
+2
View File
@@ -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;
-1
View File
@@ -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;
-2
View File
@@ -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,
-5
View File
@@ -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]);
-6
View File
@@ -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]);
-1
View File
@@ -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;
+2
View File
@@ -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();
+4 -3
View File
@@ -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));
+9 -23
View File
@@ -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; }
+2 -2
View File
@@ -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
}
}
+1
View File
@@ -25,6 +25,7 @@
#include "msg.h"
#include "channel.h"
#include "version.h"
#include "proto.h"
#include <string.h>
#include <stdlib.h>