diff options
-rw-r--r-- | src/base64.c | 8 | ||||
-rw-r--r-- | src/config.c | 12 | ||||
-rw-r--r-- | src/core/cs_akick.c | 11 | ||||
-rw-r--r-- | src/core/enc_old.c | 2 | ||||
-rw-r--r-- | src/core/enc_sha1.c | 8 | ||||
-rw-r--r-- | src/core/os_ignore.c | 2 | ||||
-rw-r--r-- | src/language.c | 2 | ||||
-rw-r--r-- | src/misc.c | 6 | ||||
-rw-r--r-- | src/modules.c | 64 | ||||
-rw-r--r-- | src/modules/os_info.c | 16 | ||||
-rw-r--r-- | src/protocol/solidircd.c | 6 | ||||
-rw-r--r-- | version.log | 2 |
12 files changed, 69 insertions, 70 deletions
diff --git a/src/base64.c b/src/base64.c index 6296c03fb..2793f124d 100644 --- a/src/base64.c +++ b/src/base64.c @@ -295,7 +295,7 @@ char *encode_ip(unsigned char *ip) } else { s_ip = str_signed(ip); ia.s_addr = inet_addr(s_ip); - cp = (unsigned char *) ia.s_addr; + cp = (unsigned char *) &ia.s_addr; b64_encode((char *) &cp, sizeof(struct in_addr), buf, 25); } return buf; @@ -305,14 +305,14 @@ int decode_ip(char *buf) { int len = strlen(buf); char targ[25]; - struct in_addr ia; + struct in_addr *ia; b64_decode(buf, targ, 25); - ia = *(struct in_addr *) targ; + ia = (struct in_addr *) targ; if (len == 24) { /* IPv6 */ return 0; } else if (len == 8) /* IPv4 */ - return ia.s_addr; + return ia->s_addr; else /* Error?? */ return 0; } diff --git a/src/config.c b/src/config.c index ad3a51fbe..5c745a8c6 100644 --- a/src/config.c +++ b/src/config.c @@ -708,10 +708,16 @@ int parse_directive(Directive * d, char *dir, int ac, char *av[MAXPARAMS], /* Should we remove PARAM_DEPRECATED because it's * useless right now? -GD */ if (d->params[i].type == PARAM_DEPRECATED) { - void (*func) (void); + union func_union + { + void *ptr; + void (*func)(void); + } u; + error(linenum, "Deprecated directive `%s' used", d->name); - func = (void (*)(void)) (d->params[i].ptr); - func(); /* For clarity */ + + u.ptr = d->params[i].ptr; + u.func(); continue; } if (optind >= ac) { diff --git a/src/core/cs_akick.c b/src/core/cs_akick.c index 36ca62e60..b312ec1b5 100644 --- a/src/core/cs_akick.c +++ b/src/core/cs_akick.c @@ -368,8 +368,6 @@ static int do_akick(User * u) free(mask); } else if (stricmp(cmd, "STICK") == 0) { - NickAlias *na; - NickCore *nc; if (readonly) { notice_lang(s_ChanServ, u, CHAN_AKICK_DISABLED); @@ -381,9 +379,6 @@ static int do_akick(User * u) return MOD_CONT; } - na = findnick(mask); - nc = (na ? na->nc : NULL); - for (akick = ci->akick, i = 0; i < ci->akickcount; akick++, i++) { if (!(akick->flags & AK_USED) || (akick->flags & AK_ISNICK)) continue; @@ -406,9 +401,6 @@ static int do_akick(User * u) if (ci->c) stick_mask(ci, akick); } else if (stricmp(cmd, "UNSTICK") == 0) { - NickAlias *na; - NickCore *nc; - if (readonly) { notice_lang(s_ChanServ, u, CHAN_AKICK_DISABLED); return MOD_CONT; @@ -419,9 +411,6 @@ static int do_akick(User * u) return MOD_CONT; } - na = findnick(mask); - nc = (na ? na->nc : NULL); - for (akick = ci->akick, i = 0; i < ci->akickcount; akick++, i++) { if (!(akick->flags & AK_USED) || (akick->flags & AK_ISNICK)) continue; diff --git a/src/core/enc_old.c b/src/core/enc_old.c index e4c113d70..3efcc26c7 100644 --- a/src/core/enc_old.c +++ b/src/core/enc_old.c @@ -380,7 +380,7 @@ static int old_encrypt(const char *src, int len, char *dest, int size) if(debug) { memset(tmp,0,33); - my_binary_to_hex(dest,tmp,16); + my_binary_to_hex((unsigned char *) dest,tmp,16); alog("enc_old: Converted [%s] to [%s]",src,tmp); } diff --git a/src/core/enc_sha1.c b/src/core/enc_sha1.c index 1ed47ee90..332e2c902 100644 --- a/src/core/enc_sha1.c +++ b/src/core/enc_sha1.c @@ -178,7 +178,7 @@ static void SHA1Final(unsigned char digest[20], SHA1_CTX* context) static int sha1_encrypt(const char *src, int len, char *dest, int size) { SHA1_CTX context; - unsigned char tmp[41]; + char tmp[41]; if (size < 20) return -1; @@ -186,12 +186,12 @@ static int sha1_encrypt(const char *src, int len, char *dest, int size) memset(dest,0,size); SHA1Init(&context); - SHA1Update(&context, src, len); - SHA1Final(dest, &context); + SHA1Update(&context, (const unsigned char *) src, len); + SHA1Final((unsigned char *) dest, &context); if(debug) { memset(tmp,0,41); - binary_to_hex(dest,tmp,20); + binary_to_hex((unsigned char *) dest,tmp,20); /* Dont log source if we were encrypting in place :) */ if (memcmp(src, dest, 20) != 0) { alog("enc_sha1: hashed from [%s] to [%s]",src,tmp); diff --git a/src/core/os_ignore.c b/src/core/os_ignore.c index 8ebb8132f..b981c2b56 100644 --- a/src/core/os_ignore.c +++ b/src/core/os_ignore.c @@ -78,7 +78,6 @@ static int do_ignoreuser(User * u) if (!stricmp(cmd, "ADD")) { char *time = strtok(NULL, " "); char *nick = strtok(NULL, " "); - char *rest = strtok(NULL, ""); if (!nick) { syntax_error(s_OperServ, u, "IGNORE", OPER_IGNORE_SYNTAX); @@ -88,7 +87,6 @@ static int do_ignoreuser(User * u) return MOD_CONT; } else { t = dotime(time); - rest = NULL; if (t <= -1) { notice_lang(s_OperServ, u, OPER_IGNORE_VALID_TIME); diff --git a/src/language.c b/src/language.c index b7d8709b3..e48d8e4c6 100644 --- a/src/language.c +++ b/src/language.c @@ -152,13 +152,11 @@ static void load_lang(int index, const char *filename) void lang_sanitize() { int i = 0, j = 0; - int len = 0; char tmp[2000]; char *newstr = NULL; for (i = 0; i < NUM_LANGS; i++) { for (j = 0; j < NUM_STRINGS; j++) { if (strstr(langtexts[i][j], "%R")) { - len = strlen(langtexts[i][j]); strscpy(tmp, langtexts[i][j], sizeof(tmp)); if (UseStrictPrivMsg) { strnrepl(tmp, sizeof(tmp), "%R", "/"); diff --git a/src/misc.c b/src/misc.c index e8c9b2b1d..d7946465e 100644 --- a/src/misc.c +++ b/src/misc.c @@ -976,7 +976,6 @@ static void arc4_addrandom(void *dat, int datlen) */ void rand_init(void) { - int n; #ifndef _WIN32 int fd; #endif @@ -1007,7 +1006,7 @@ void rand_init(void) /* unix/bsd: /dev/urandom */ fd = open("/dev/urandom", O_RDONLY); if (fd) { - n = read(fd, &rdat.rnd, sizeof(rdat.rnd)); + read(fd, &rdat.rnd, sizeof(rdat.rnd)); close(fd); } #else @@ -1112,14 +1111,13 @@ char *send_token(char *token1, char *token2) */ int myNumToken(const char *str, const char dilim) { - int len, idx, counter = 0, start_pos = 0; + int len, idx, counter = 0; if (!str) { return 0; } len = strlen(str); for (idx = 0; idx <= len; idx++) { if ((str[idx] == dilim) || (idx == len)) { - start_pos = idx + 1; counter++; } } diff --git a/src/modules.c b/src/modules.c index b239085c0..3ddeaf33a 100644 --- a/src/modules.c +++ b/src/modules.c @@ -278,7 +278,6 @@ void modules_unload_all(boolean fini, boolean unload_proto) #ifdef USE_MODULES int idx; ModuleHash *mh, *next; - void (*func) (void); for (idx = 0; idx < MAX_CMD_HASH; idx++) { mh = MODULE_HASH[idx]; @@ -288,10 +287,14 @@ void modules_unload_all(boolean fini, boolean unload_proto) mod_current_module = mh->m; mod_current_module_name = mh->m->name; if(fini) { - func = (void (*)(void))ano_modsym(mh->m->handle, "AnopeFini"); - if (func) { - func(); /* exec AnopeFini */ - } + union fini_union + { + void *ptr; + void (*func)(void); + } u; + u.ptr = ano_modsym(mh->m->handle, "AnopeFini"); + if (u.ptr) + u.func(); /* exec AnopeFini */ if (prepForUnload(mh->m) != MOD_ERR_OK) { mh = next; @@ -599,12 +602,22 @@ int loadModule(Module * m, User * u) char buf[4096]; int len; const char *err; - int (*func) (int, char **); - int (*version)(); int ret = 0; char *argv[1]; int argc = 0; + union init_func_union + { + void *ptr; + int (*func)(int, char **); + } init_union; + + union version_func_union + { + void *ptr; + int (*func)(); + } version_union; + Module *m2; if (!m || !m->name) { return MOD_ERR_PARAMS; @@ -647,20 +660,22 @@ int loadModule(Module * m, User * u) return MOD_ERR_NOLOAD; } ano_modclearerr(); - func = (int (*)(int, char **))ano_modsym(m->handle, "AnopeInit"); - if ( func == NULL && (err = ano_moderr()) != NULL) { + + init_union.ptr = ano_modsym(m->handle, "AnopeInit"); + + if ( init_union.ptr == NULL && (err = ano_moderr()) != NULL) { ano_modclose(m->handle); /* If no AnopeInit - it isnt an Anope Module, close it */ return MOD_ERR_NOLOAD; } - if (func) { - version = (int (*)())ano_modsym(m->handle,"getAnopeBuildVersion"); - if (version) { - if (version() >= VERSION_BUILD ) { + if (init_union.ptr) { + version_union.ptr = ano_modsym(m->handle,"getAnopeBuildVersion"); + if (version_union.ptr) { + if (version_union.func() >= VERSION_BUILD ) { if(debug) { - alog("Module %s compiled against current or newer anope revision %d, this is %d",m->name,version(),VERSION_BUILD); + alog("Module %s compiled against current or newer anope revision %d, this is %d",m->name,version_union.func(),VERSION_BUILD); } } else { - alog("Module %s is compiled against an old version of anope (%d) current is %d", m->name, version(), VERSION_BUILD); + alog("Module %s is compiled against an old version of anope (%d) current is %d", m->name, version_union.func(), VERSION_BUILD); alog("Rebuild module %s against the current version to resolve this error", m->name); ano_modclose(m->handle); ano_modclearerr(); @@ -684,7 +699,7 @@ int loadModule(Module * m, User * u) } argc++; - ret = func(argc, argv); /* exec AnopeInit */ + init_union.func(argc, argv); /* exec AnopeInit */ if (u) { free(argv[0]); } @@ -733,7 +748,11 @@ int loadModule(Module * m, User * u) int unloadModule(Module * m, User * u) { #ifdef USE_MODULES - void (*func) (void); + union fini_union + { + void *ptr; + void (*func)(void); + } un; if (!m || !m->handle) { if (u) { @@ -754,11 +773,11 @@ int unloadModule(Module * m, User * u) return MOD_ERR_NOUNLOAD; } - func = (void (*)(void))ano_modsym(m->handle, "AnopeFini"); - if (func) { + un.ptr = ano_modsym(m->handle, "AnopeFini"); + if (un.ptr) { mod_current_module = m; mod_current_module_name = m->name; - func(); /* exec AnopeFini */ + un.func(); /* exec AnopeFini */ } if (prepForUnload(m) != MOD_ERR_OK) { @@ -821,7 +840,6 @@ int prepForUnload(Module * m) Message *msg; EvtMessage *eMsg; EvtHook *eHook; - int status = 0; if (!m) { return MOD_ERR_PARAMS; @@ -906,7 +924,7 @@ int prepForUnload(Module * m) for (eMsg = ecurrent->evm; eMsg; eMsg = eMsg->next) { if ((eMsg->mod_name) && (stricmp(eMsg->mod_name, m->name) == 0)) { - status = delEventHandler(EVENT, eMsg, m->name); + delEventHandler(EVENT, eMsg, m->name); } } } @@ -915,7 +933,7 @@ int prepForUnload(Module * m) for (eHook = ehcurrent->evh; eHook; eHook = eHook->next) { if ((eHook->mod_name) && (stricmp(eHook->mod_name, m->name) == 0)) { - status = delEventHook(EVENTHOOKS, eHook, m->name); + delEventHook(EVENTHOOKS, eHook, m->name); } } } diff --git a/src/modules/os_info.c b/src/modules/os_info.c index 7d131daea..73a2b7c50 100644 --- a/src/modules/os_info.c +++ b/src/modules/os_info.c @@ -72,8 +72,6 @@ int AnopeInit(int argc, char **argv) Command *c; EvtHook *hook = NULL; - int status; - moduleAddAuthor(AUTHOR); moduleAddVersion(VERSION); moduleSetType(SUPPORTED); @@ -85,26 +83,26 @@ int AnopeInit(int argc, char **argv) c = createCommand("oInfo", myAddNickInfo, is_oper, -1, -1, -1, -1, -1); moduleAddHelp(c, mNickHelp); - status = moduleAddCommand(NICKSERV, c, MOD_HEAD); + moduleAddCommand(NICKSERV, c, MOD_HEAD); c = createCommand("Info", myNickInfo, NULL, -1, -1, -1, -1, -1); - status = moduleAddCommand(NICKSERV, c, MOD_TAIL); + moduleAddCommand(NICKSERV, c, MOD_TAIL); c = createCommand("oInfo", myAddChanInfo, is_oper, -1, -1, -1, -1, -1); moduleAddHelp(c, mChanHelp); - status = moduleAddCommand(CHANSERV, c, MOD_HEAD); + moduleAddCommand(CHANSERV, c, MOD_HEAD); c = createCommand("Info", myChanInfo, NULL, -1, -1, -1, -1, -1); - status = moduleAddCommand(CHANSERV, c, MOD_TAIL); + moduleAddCommand(CHANSERV, c, MOD_TAIL); hook = createEventHook(EVENT_DB_SAVING, mSaveData); - status = moduleAddEventHook(hook); + moduleAddEventHook(hook); hook = createEventHook(EVENT_DB_BACKUP, mBackupData); - status = moduleAddEventHook(hook); + moduleAddEventHook(hook); hook = createEventHook(EVENT_RELOAD, mEventReload); - status = moduleAddEventHook(hook); + moduleAddEventHook(hook); moduleSetNickHelp(mMainNickHelp); moduleSetChanHelp(mMainChanHelp); diff --git a/src/protocol/solidircd.c b/src/protocol/solidircd.c index 16ee25b39..885f4caed 100644 --- a/src/protocol/solidircd.c +++ b/src/protocol/solidircd.c @@ -939,12 +939,6 @@ void solidircd_cmd_connect(int servernum) /* EVENT : SERVER */ int anope_event_server(char *source, int ac, char **av) { - char *uplink; - - if (!stricmp(av[1], "1")) { - uplink = sstrdup(av[0]); - } - do_server(source, av[0], av[1], av[2], NULL); return MOD_CONT; } diff --git a/version.log b/version.log index f7a4e77d5..9a0f9650a 100644 --- a/version.log +++ b/version.log @@ -8,7 +8,7 @@ VERSION_MAJOR="1" VERSION_MINOR="8" VERSION_PATCH="8" VERSION_EXTRA="-git" -VERSION_BUILD="3101" +VERSION_BUILD="3102" # Changes since 1.8.7 Release #Revision 3101 - Use base 10 for strtol() in the config parser to prevent numbers beginning with 0 from confusing it |