From: Michael Poole Date: Mon, 15 Feb 2010 22:14:51 +0000 (-0500) Subject: Minor compilation and correctness fixes. X-Git-Url: http://git.pk910.de/?p=srvx.git;a=commitdiff_plain;h=7df2e1c637f99a288f336d314b7118f093b56c87 Minor compilation and correctness fixes. src/heap.c (ulong_comparator): Fix for the case where "a" and "b" are different by more than the (signed) range of the "int" type. src/mod-helpserv.c (cmd_modstats): Fix a signed/unsigned warning. src/proto-p10.c (reg_notice_func): Fix some cut-and-paste errors. --- diff --git a/src/heap.c b/src/heap.c index ad97dac..f78f05f 100644 --- a/src/heap.c +++ b/src/heap.c @@ -213,5 +213,5 @@ heap_size(heap_t heap) int ulong_comparator(const void *a, const void *b) { - return (unsigned long)a-(unsigned long)b; + return (a < b) ? -1 : (a > b) ? 1 : 0; } diff --git a/src/mod-helpserv.c b/src/mod-helpserv.c index 8e1fe1f..fec20c6 100644 --- a/src/mod-helpserv.c +++ b/src/mod-helpserv.c @@ -2962,7 +2962,7 @@ static HELPSERV_FUNC(cmd_modstats) { return 0; } - if (mod < 0 && abs(mod) > field[week]) { + if (mod < 0 && mod < -(int)field[week]) { helpserv_notice(user, "HSMSG_MODSTATS_NEGATIVE"); return 0; } diff --git a/src/proto-p10.c b/src/proto-p10.c index 48b6527..e17442d 100644 --- a/src/proto-p10.c +++ b/src/proto-p10.c @@ -2878,8 +2878,8 @@ reg_notice_func(struct userNode *user, privmsg_func_t handler) if (numeric >= num_notice_funcs) { int newnum = numeric + 8, ii; notice_funcs = realloc(notice_funcs, newnum*sizeof(privmsg_func_t)); - for (ii = num_privmsg_funcs; ii < newnum; ++ii) - privmsg_funcs[ii] = NULL; + for (ii = num_notice_funcs; ii < newnum; ++ii) + notice_funcs[ii] = NULL; num_notice_funcs = newnum; } if (notice_funcs[numeric])