Minor compilation and correctness fixes.
authorMichael Poole <mdpoole@troilus.org>
Mon, 15 Feb 2010 22:14:51 +0000 (17:14 -0500)
committerMichael Poole <mdpoole@troilus.org>
Mon, 15 Feb 2010 22:14:51 +0000 (17:14 -0500)
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.

src/heap.c
src/mod-helpserv.c
src/proto-p10.c

index ad97dacc02448b16e949dc23917980d8df2f15c1..f78f05f54be043a1d6bc199adef9907d854405d6 100644 (file)
@@ -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;
 }
index 8e1fe1fd70c205f4c22a380faefddc038fbb9bfb..fec20c625d30c276488b3737dd98f81cc69f7239 100644 (file)
@@ -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;
     }
index 48b65274fa8f1bc7a350616fb921318e3f8494db..e17442d4eb8f78e66a3b73d48469bbbffb2211b7 100644 (file)
@@ -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])