Browse Source

* Casted memory allocations, c++ requires it

svn: 1309
Bryan Drewery 22 years ago
parent
commit
3164cd2ac8

+ 2 - 2
src/auth.c

@@ -41,9 +41,9 @@ init_auth_max()
   if (max_auth < 1)
     max_auth = 1;
   if (auth)
-    auth = realloc(auth, sizeof(struct auth_t) * max_auth);
+    auth = (struct auth_t *) realloc(auth, sizeof(struct auth_t) * max_auth);
   else
-    auth = calloc(1, sizeof(struct auth_t) * max_auth);
+    auth = (struct auth_t *) calloc(1, sizeof(struct auth_t) * max_auth);
 }
 
 static void

+ 2 - 2
src/base64.c

@@ -30,7 +30,7 @@ b64enc(const unsigned char *data, int len)
 {
   char *dest = NULL;
 
-  dest = calloc(1, (len << 2) / 3 + 4 + 1);
+  dest = (char *) calloc(1, (len << 2) / 3 + 4 + 1);
   b64enc_buf(data, len, dest);
   return (dest);
 }
@@ -56,7 +56,7 @@ b64dec(const unsigned char *data, int *len)
 {
   char *dest = NULL;
 
-  dest = calloc(1, ((*len * 3) >> 2) + 6 + 1);
+  dest = (char *) calloc(1, ((*len * 3) >> 2) + 6 + 1);
   b64dec_buf(data, len, dest);
   return (dest);
 }

+ 1 - 1
src/binary.c

@@ -74,7 +74,7 @@ bin_md5(const char *fname, int todo, MD5_CTX * ctx)
 
 
     size = strlen(fname) + 2;
-    fname_bak = calloc(1, size);
+    fname_bak = (char *) calloc(1, size);
     egg_snprintf(fname_bak, size, "%s~", fname);
     size = 0;
 

+ 2 - 2
src/botcmd.c

@@ -1274,11 +1274,11 @@ void bounce_simul(int idx, char *buf)
 static void bot_rsimr(char *botnick, char *code, char *msg)
 {
   if (msg[0]) {
-    char *par = strdup(msg), *parp = par, *prefix = NULL;
+    char * par = strdup(msg), *parp = par, *prefix = NULL;
     int idx = atoi(newsplit(&par));
     size_t size = strlen(botnick) + 4;
 
-    prefix = calloc(1, size);
+    prefix = (char *) calloc(1, size);
     egg_snprintf(prefix, size, "[%s] ", botnick);
     dumplots(idx, prefix, par);
     free(prefix);

+ 1 - 1
src/botmsg.c

@@ -173,7 +173,7 @@ void botnet_send_cmdpass(int idx, char *cmd, char *pass)
   if (tands > 0) {
     char *buf = NULL;
 
-    buf = calloc(1, strlen(cmd) + strlen(pass) + 5 + 1);
+    buf = (char *) calloc(1, strlen(cmd) + strlen(pass) + 5 + 1);
     sprintf(buf, "cp %s %s\n", cmd, pass);
     send_tand_but(idx, buf, strlen(buf));
     free(buf);

+ 6 - 6
src/botnet.c

@@ -61,7 +61,7 @@ void addbot(char *who, char *from, char *next, char flag, int vlocalhub, time_t
       putlog(LOG_BOTS, "*", "!!! Duplicate botnet bot entry!!");
     ptr = &((*ptr)->next);
   }
-  ptr2 = calloc(1, sizeof(tand_t));
+  ptr2 = (tand_t *) calloc(1, sizeof(tand_t));
   strncpy(ptr2->bot, who, HANDLEN);
   ptr2->bot[HANDLEN] = 0;
   ptr2->share = flag;
@@ -957,9 +957,9 @@ int botlink(char *linker, int idx, char *nick)
       strcpy(dcc[i].nick, nick);
       strcpy(dcc[i].host, bi->address);
       dcc[i].u.dns->ibuf = idx;
-      dcc[i].u.dns->cptr = calloc(1, strlen(linker) + 1);
+      dcc[i].u.dns->cptr = (char *) calloc(1, strlen(linker) + 1);
       strcpy(dcc[i].u.dns->cptr, linker);
-      dcc[i].u.dns->host = calloc(1, strlen(dcc[i].host) + 1);
+      dcc[i].u.dns->host = (char *) calloc(1, strlen(dcc[i].host) + 1);
       strcpy(dcc[i].u.dns->host, dcc[i].host);
       dcc[i].u.dns->dns_success = botlink_resolve_success;
       dcc[i].u.dns->dns_failure = botlink_resolve_failure;
@@ -1132,13 +1132,13 @@ void tandem_relay(int idx, char *nick, register int i)
   dprintf(idx, "%s\n", BOT_BYEINFO1);
   dcc[idx].type = &DCC_PRE_RELAY;
   ci = dcc[idx].u.chat;
-  dcc[idx].u.relay = calloc(1, sizeof(struct relay_info));
+  dcc[idx].u.relay = (struct relay_info *) calloc(1, sizeof(struct relay_info));
   dcc[idx].u.relay->chat = ci;
   dcc[idx].u.relay->old_status = dcc[idx].status;
   dcc[idx].u.relay->sock = dcc[i].sock;
   dcc[i].timeval = now;
   dcc[i].u.dns->ibuf = dcc[idx].sock;
-  dcc[i].u.dns->host = calloc(1, strlen(bi->address) + 1);
+  dcc[i].u.dns->host = (char *) calloc(1, strlen(bi->address) + 1);
   strcpy(dcc[i].u.dns->host, bi->address);
   dcc[i].u.dns->dns_success = tandem_relay_resolve_success;
   dcc[i].u.dns->dns_failure = tandem_relay_resolve_failure;
@@ -1186,7 +1186,7 @@ static void tandem_relay_resolve_success(int i)
 
   dcc[i].addr = dcc[i].u.dns->ip;
   changeover_dcc(i, &DCC_FORK_RELAY, sizeof(struct relay_info));
-  dcc[i].u.relay->chat = calloc(1, sizeof(struct chat_info));
+  dcc[i].u.relay->chat = (struct chat_info *) calloc(1, sizeof(struct chat_info));
 
   dcc[i].u.relay->sock = sock;
   dcc[i].u.relay->port = dcc[i].port;

+ 3 - 3
src/cfg.c

@@ -634,7 +634,7 @@ struct cfg_entry CFG_OPREQUESTS = {
 
 void add_cfg(struct cfg_entry *entry)
 {
-  cfg = (void *) realloc(cfg, sizeof(void *) * (cfg_count + 1));
+  cfg = (struct cfg_entry **) realloc(cfg, sizeof(void *) * (cfg_count + 1));
   cfg[cfg_count] = entry;
   cfg_count++;
   entry->ldata = NULL;
@@ -702,7 +702,7 @@ void set_cfg_str(char *target, char *entryname, char *data)
         }
       }
     }
-    xk = calloc(1, sizeof(struct xtra_key));
+    xk = (struct xtra_key *) calloc(1, sizeof(struct xtra_key));
     xk->key = strdup(entry->name);
     if (data) {
       xk->data = strdup(data);
@@ -840,7 +840,7 @@ void set_cmd_pass(char *ln, int shareit)
       free(cp);
   } else if (ln[0]) {
     /* create */
-    cp = calloc(1, sizeof(struct cmd_pass));
+    cp = (struct cmd_pass *) calloc(1, sizeof(struct cmd_pass));
     cp->next = cmdpass;
     cmdpass = cp;
     cp->name = strdup(cmd);

+ 7 - 7
src/chanprog.c

@@ -425,7 +425,7 @@ void load_internal_users()
         hublevel++;		/* We must increment this even if it is already added */
 	if (!get_user_by_handle(userlist, hand)) {
 	  userlist = adduser(userlist, hand, "none", "-", USER_OP, 1);
-	  bi = calloc(1, sizeof(struct bot_addr));
+	  bi = (struct bot_addr *) calloc(1, sizeof(struct bot_addr));
 
           bi->address = strdup(ip);
 	  bi->telnet_port = atoi(port) ? atoi(port) : 0;
@@ -435,7 +435,7 @@ void load_internal_users()
 	  if ((!bi->hublevel) && (!strcmp(hand, conf.bot->nick)))
 	    bi->hublevel = 99;
 #endif /* HUB */
-          bi->uplink = calloc(1, 1);
+          bi->uplink = (char *) calloc(1, 1);
 	  set_user(&USERENTRY_BOTADDR, get_user_by_handle(userlist, hand), bi);
 	  /* set_user(&USERENTRY_PASS, get_user_by_handle(userlist, hand), SALT2); */
 	}
@@ -546,7 +546,7 @@ void chanprog()
     /* I need to be on the userlist... doh. */
     userlist = adduser(userlist, conf.bot->nick, "none", "-", USER_OP, 1);
     conf.bot->u = get_user_by_handle(userlist, conf.bot->nick);
-    bi = calloc(1, sizeof(struct bot_addr));
+    bi = (struct bot_addr *) calloc(1, sizeof(struct bot_addr));
     if (conf.bot->ip)
       bi->address = strdup(conf.bot->ip);
     /* bi->telnet_port = atoi(buf) ? atoi(buf) : 3333; */
@@ -556,7 +556,7 @@ void chanprog()
 #else /* !HUB */
     bi->hublevel = 0;
 #endif /* HUB */
-    bi->uplink = calloc(1, 1);
+    bi->uplink = (char *) calloc(1, 1);
     set_user(&USERENTRY_BOTADDR, conf.bot->u, bi);
   } else {
     bi = get_user(&USERENTRY_BOTADDR, conf.bot->u);
@@ -680,7 +680,7 @@ chans_addbot(const char *bot, struct chanset_t *chan)
     char *buf = NULL;
    
     size = strlen(chans) + strlen(chan->dname) + 2;
-    buf = calloc(1, size);
+    buf = (char *) calloc(1, size);
     egg_snprintf(buf, size, "%s %s", chans, chan->dname);
     set_user(&USERENTRY_CHANS, u, buf);
     free(buf);
@@ -742,9 +742,9 @@ int do_chanset(char *result, struct chanset_t *chan, const char *options, int lo
     char *buf = NULL;
          /* malloc(options,chan,'cset ',' ',+ 1) */
     if (chan)
-      buf = calloc(1, strlen(options) + strlen(chan->dname) + 5 + 1 + 1);
+      buf = (char *) calloc(1, strlen(options) + strlen(chan->dname) + 5 + 1 + 1);
     else
-      buf = calloc(1, strlen(options) + 1 + 5 + 1 + 1);
+      buf = (char *) calloc(1, strlen(options) + 1 + 5 + 1 + 1);
 
     strcat(buf, "cset ");
     if (chan)

+ 26 - 26
src/cmds.c

@@ -252,7 +252,7 @@ static void cmd_config(int idx, char *par)
   if (!par[0]) {
     char *outbuf = NULL;
 
-    outbuf = calloc(1, 1);
+    outbuf = (char *) calloc(1, 1);
 
     dprintf(idx, "Usage: config [name [value|-]]\n");
     dprintf(idx, "Defined config entry names:\n");
@@ -260,10 +260,10 @@ static void cmd_config(int idx, char *par)
     for (i = 0; i < cfg_count; i++) {
       if ((cfg[i]->flags & CFGF_GLOBAL) && (cfg[i]->describe)) {
 	if (!cnt) {
-          outbuf = realloc(outbuf, 2 + 1);
+          outbuf = (char *) realloc(outbuf, 2 + 1);
 	  sprintf(outbuf, "  ");
         }
-        outbuf = realloc(outbuf, strlen(outbuf) + strlen(cfg[i]->name) + 1 + 1);
+        outbuf = (char *) realloc(outbuf, strlen(outbuf) + strlen(cfg[i]->name) + 1 + 1);
 	sprintf(outbuf, "%s%s ", outbuf, cfg[i]->name);
 	cnt++;
 	if (cnt == 10) {
@@ -523,7 +523,7 @@ static void cmd_motd(int idx, char *par)
     size_t size;
   
     size = strlen(par) + 1 + strlen(dcc[idx].nick) + 10 + 1 + 1;
-    s = calloc(1, size); /* +2: ' 'x2 */
+    s = (char *) calloc(1, size); /* +2: ' 'x2 */
 
     egg_snprintf(s, size, "%s %li %s", dcc[idx].nick, now, par);
     set_cfg_str(NULL, "motd", s);
@@ -595,13 +595,13 @@ static void cmd_addline(int idx, char *par)
 
   q = get_user(&USERENTRY_HOSTS, u);
   
-  hostbuf = calloc(1, 1);
+  hostbuf = (char *) calloc(1, 1);
   for (; q; q = q->next) {
-    hostbuf = realloc(hostbuf, strlen(hostbuf) + strlen(q->extra) + 2);
+    hostbuf = (char *) realloc(hostbuf, strlen(hostbuf) + strlen(q->extra) + 2);
     strcat(hostbuf, q->extra);
     strcat(hostbuf, " ");
   }
-  outbuf = calloc(1, strlen(hostbuf) + strlen(u->handle) + 20);
+  outbuf = (char *) calloc(1, strlen(hostbuf) + strlen(u->handle) + 20);
   sprintf(outbuf, "Addline: +user %s %s", u->handle, hostbuf);
   dumplots(idx, "", outbuf);
   free(hostbuf);
@@ -715,7 +715,7 @@ static void cmd_nohelp(int idx, char *par)
   int i;
   char *buf = NULL;
 
-  buf = calloc(1, 1);
+  buf = (char *) calloc(1, 1);
 
   qsort(cmdlist, cmdi, sizeof(mycmds), (int (*)()) &my_cmp);
   
@@ -724,7 +724,7 @@ static void cmd_nohelp(int idx, char *par)
     for (o = 0; (help[o].cmd) && (help[o].desc); o++)
       if (!egg_strcasecmp(help[o].cmd, cmdlist[i].name)) found++;
     if (!found) {
-      buf = realloc(buf, strlen(buf) + 2 + strlen(cmdlist[i].name) + 1);
+      buf = (char *) realloc(buf, strlen(buf) + 2 + strlen(cmdlist[i].name) + 1);
       strcat(buf, cmdlist[i].name);
       strcat(buf, ", ");
     }
@@ -1595,7 +1595,7 @@ static void cmd_hublevel(int idx, char *par)
   }
   dprintf(idx, "Changed bot's hublevel.\n");
   obi = get_user(&USERENTRY_BOTADDR, u1);
-  bi = calloc(1, sizeof(struct bot_addr));
+  bi = (struct bot_addr *) calloc(1, sizeof(struct bot_addr));
 
   bi->uplink = strdup(obi->uplink);
   bi->address = strdup(obi->address);
@@ -1633,7 +1633,7 @@ static void cmd_uplink(int idx, char *par)
   else
     dprintf(idx, "Cleared bot's uplink.\n");
   obi = get_user(&USERENTRY_BOTADDR, u1);
-  bi = calloc(1, sizeof(struct bot_addr));
+  bi = (struct bot_addry *) calloc(1, sizeof(struct bot_addr));
 
   bi->uplink = strdup(uplink);
   bi->address = strdup(obi->address);
@@ -1685,7 +1685,7 @@ static void cmd_chaddr(int idx, char *par)
     relay_port = bi->relay_port;
   }
 
-  bi = calloc(1, sizeof(struct bot_addr));
+  bi = (struct bot_addr *) calloc(1, sizeof(struct bot_addr));
 
   bi->uplink = strdup(obi->uplink);
   bi->hublevel = obi->hublevel;
@@ -1705,13 +1705,13 @@ static void cmd_chaddr(int idx, char *par)
       addr++;					/* lose the '[' */
       r = strchr(addr, ']');			/* pointer to the ending ']' */
 
-      bi->address = calloc(1, r - addr + 1);	/* alloc and copy the addr */
+      bi->address = (char *) calloc(1, r - addr + 1);	/* alloc and copy the addr */
       strncpyz(bi->address, addr, r - addr + 1);
 
       q = r + 1;				/* set q to ':' at addr */
     } else {
 #endif /* !USE_IPV6 */
-      bi->address = calloc(1, q - addr + 1);
+      bi->address = (char *) calloc(1, q - addr + 1);
       strncpyz(bi->address, addr, q - addr + 1);
 #ifdef USE_IPV6
     }
@@ -1780,7 +1780,7 @@ static void cmd_randstring(int idx, char *par)
   if (len < 301) {
     char *randstring = NULL;
 
-    randstring = calloc(1, len + 1);
+    randstring = (char *) calloc(1, len + 1);
     make_rand_str(randstring, len);
     dprintf(idx, "string: %s\n", randstring);
     free(randstring);
@@ -2474,7 +2474,7 @@ static void cmd_chattr(int idx, char *par)
 	return;
       }
     } else if (arg && !strpbrk(chg, "&|")) {
-      tmpchg = calloc(1, strlen(chg) + 2);
+      tmpchg = (char *) calloc(1, strlen(chg) + 2);
       strcpy(tmpchg, "|");
       strcat(tmpchg, chg);
       chg = tmpchg;
@@ -2788,7 +2788,7 @@ static void cmd_ps(int idx, char *par) {
     return;
   }
   size = strlen(par) + 9 + 1;
-  buf = calloc(1, size);
+  buf = (char *) calloc(1, size);
   egg_snprintf(buf, size, "ps %s", par);
   if (!exec_str(idx, buf))
     dprintf(idx, "Exec failed\n");
@@ -3068,9 +3068,9 @@ static void cmd_su(int idx, char *par)
 	 */
 	if (dcc[idx].u.chat->away != NULL)
 	  free(dcc[idx].u.chat->away);
-        dcc[idx].u.chat->away = calloc(1, strlen(dcc[idx].nick) + 1);
+        dcc[idx].u.chat->away = (char *) calloc(1, strlen(dcc[idx].nick) + 1);
 	strcpy(dcc[idx].u.chat->away, dcc[idx].nick);
-        dcc[idx].u.chat->su_nick = calloc(1, strlen(dcc[idx].nick) + 1);
+        dcc[idx].u.chat->su_nick = (char *) calloc(1, strlen(dcc[idx].nick) + 1);
 	strcpy(dcc[idx].u.chat->su_nick, dcc[idx].nick);
 	dcc[idx].user = u;
 	strcpy(dcc[idx].nick, par);
@@ -3087,7 +3087,7 @@ static void cmd_su(int idx, char *par)
 	dprintf(idx, "Setting your username to %s.\n", par);
 	if (atr & USER_MASTER)
 	  dcc[idx].u.chat->con_flags = conmask;
-        dcc[idx].u.chat->su_nick = calloc(1, strlen(dcc[idx].nick) + 1);
+        dcc[idx].u.chat->su_nick = (char *) calloc(1, strlen(dcc[idx].nick) + 1);
 	strcpy(dcc[idx].u.chat->su_nick, dcc[idx].nick);
 	dcc[idx].user = u;
 	strcpy(dcc[idx].nick, par);
@@ -3172,13 +3172,13 @@ static void cmd_newleaf(int idx, char *par)
 
       userlist = adduser(userlist, handle, "none", "-", USER_OP, 1);
       u1 = get_user_by_handle(userlist, handle);
-      bi = calloc(1, sizeof(struct bot_addr));
+      bi = (struct bot_addr *) calloc(1, sizeof(struct bot_addr));
 
-      bi->uplink = calloc(1, strlen(conf.bot->nick) + 1); 
+      bi->uplink = (char *) calloc(1, strlen(conf.bot->nick) + 1); 
 /*      strcpy(bi->uplink, conf.bot->nick); */
       strcpy(bi->uplink, "");
 
-      bi->address = calloc(1, 1);
+      bi->address = (char *) calloc(1, 1);
       bi->telnet_port = 3333;
       bi->relay_port = 3333;
       bi->hublevel = 0;
@@ -3205,7 +3205,7 @@ static void cmd_nopass(int idx, char *par)
   struct userrec *cu = NULL;
   char *users = NULL;
 
-  users = calloc(1, 1);
+  users = (char *) calloc(1, 1);
 
   putlog(LOG_CMDS, "*", "#%s# nopass %s", dcc[idx].nick, (par && par[0]) ? par : "");
 
@@ -3213,7 +3213,7 @@ static void cmd_nopass(int idx, char *par)
     if (!cu->bot) {
       if (u_pass_match(cu, "-")) {
         cnt++;
-        users = realloc(users, strlen(users) + strlen(cu->handle) + 1 + 1);
+        users = (char *) realloc(users, strlen(users) + strlen(cu->handle) + 1 + 1);
         strcat(users, cu->handle);
         strcat(users, " ");
       }
@@ -4073,7 +4073,7 @@ void gotremotereply (char *frombot, char *tohand, char *toidx, char *ln) {
   if ((idx >= 0) && (idx < dcc_total) && (dcc[idx].type == &DCC_CHAT) && (!strcmp(dcc[idx].nick, tohand))) {
     char *buf = NULL;
     
-    buf = calloc(1, strlen(frombot) + 2 + 1);
+    buf = (char *) calloc(1, strlen(frombot) + 2 + 1);
 
     sprintf(buf, "(%s)", frombot);
     dprintf(idx, "%-13s %s\n", buf, ln);

+ 3 - 3
src/conf.c

@@ -79,7 +79,7 @@ spawnbots()
       }
 
       size = strlen(bot->nick) + strlen(binname) + 20;
-      run = calloc(1, size);
+      run = (char *) calloc(1, size);
       egg_snprintf(run, size, "%s -B %s", binname, bot->nick);
       sdprintf("Spawning '%s': %s", bot->nick, run);
       status = system(run);
@@ -179,7 +179,7 @@ confedit()
 
       setgid(getgid());
       setuid(getuid());
-      run = calloc(1, size);
+      run = (char *) calloc(1, size);
       /* child */
       egg_snprintf(run, size, "%s %s", editor, s);
       execlp("/bin/sh", "/bin/sh", "-c", run, NULL);
@@ -506,7 +506,7 @@ readconf(char *fname, int bits)
     fatal("Cannot read config", 0);
 
   free_conf_bots();
-  inbuf = calloc(1, 201);
+  inbuf = (char *) calloc(1, 201);
   while (fgets(inbuf, 201, f) != NULL) {
     char *line = NULL, *temp_ptr = NULL;
 

+ 5 - 5
src/crypt.c

@@ -31,7 +31,7 @@ encrypt_binary(const char *keydata, const unsigned char *in, size_t *inlen)
   if (len % CRYPT_BLOCKSIZE)             /* more than 1 block? */
     len += (CRYPT_BLOCKSIZE - (len % CRYPT_BLOCKSIZE));
 
-  out = calloc(1, len + 1);
+  out = (unsigned char *) calloc(1, len + 1);
   egg_memcpy(out, in, *inlen);
   *inlen = len;
 
@@ -59,7 +59,7 @@ decrypt_binary(const char *keydata, unsigned char *in, size_t len)
   unsigned char *out = NULL;
 
   len -= len % CRYPT_BLOCKSIZE;
-  out = calloc(1, len + 1);
+  out = (unsigned char *) calloc(1, len + 1);
   egg_memcpy(out, in, len);
 
   if (!keydata || !*keydata) {
@@ -109,7 +109,7 @@ char *decrypt_string(const char *keydata, char *in)
     free(buf);
     return res;
   } else {
-    res = calloc(1, len + 1);
+    res = (char *) calloc(1, len + 1);
     strcpy(res, in);
     return res;
   }
@@ -173,7 +173,7 @@ void Encrypt_File(char *infile, char *outfile)
     printf("----------------------------------START----------------------------------\n");
   }
 
-  buf = calloc(1, 1024);
+  buf = (char *) calloc(1, 1024);
   while (fgets(buf, 1024, f) != NULL) {
     remove_crlf(buf);
 
@@ -211,7 +211,7 @@ void Decrypt_File(char *infile, char *outfile)
     printf("----------------------------------START----------------------------------\n");
   }
 
-  buf = calloc(1, 2048);
+  buf = (char *) calloc(1, 2048);
   while (fgets(buf, 2048, f) != NULL) {
     char *temps = NULL;
 

+ 6 - 6
src/dcc.c

@@ -708,7 +708,7 @@ dcc_chat_pass(int idx, char *buf, int atr)
     if (!egg_strcasecmp(buf, "elinkdone")) {
       free(dcc[idx].u.chat);
       dcc[idx].type = &DCC_BOT_NEW;
-      dcc[idx].u.bot = calloc(1, sizeof(struct bot_info));
+      dcc[idx].u.bot = (struct bot_info *) calloc(1, sizeof(struct bot_info));
       dcc[idx].status = STAT_CALLED;
       dprintf(idx, "goodbye!\n");
       greet_new_bot(idx);
@@ -918,10 +918,10 @@ append_line(int idx, char *line)
     else
       for (q = c->buffer; q->next; q = q->next) ;
 
-    p = calloc(1, sizeof(struct msgq));
+    p = (struct msgq *) calloc(1, sizeof(struct msgq));
 
     p->len = l;
-    p->msg = calloc(1, l + 1);
+    p->msg = (char *) calloc(1, l + 1);
     p->next = NULL;
     strcpy(p->msg, line);
     if (q == NULL)
@@ -1518,7 +1518,7 @@ dcc_telnet_id(int idx, char *buf, int atr)
 
       ci = dcc[idx].u.chat;
       dcc[idx].type = &DCC_DUPWAIT;
-      dcc[idx].u.dupwait = calloc(1, sizeof(struct dupwait_info));
+      dcc[idx].u.dupwait = (struct dupwait_info *) calloc(1, sizeof(struct dupwait_info));
       dcc[idx].u.dupwait->chat = ci;
       dcc[idx].u.dupwait->atr = atr;
       return;
@@ -1570,7 +1570,7 @@ dcc_telnet_pass(int idx, int atr)
     struct chat_info *ci;
 
     ci = dcc[idx].u.chat;
-    dcc[idx].u.file = calloc(1, sizeof(struct file_info));
+    dcc[idx].u.file = (struct file_info *) calloc(1, sizeof(struct file_info));
     dcc[idx].u.file->chat = ci;
   }
 
@@ -1877,7 +1877,7 @@ dcc_telnet_got_ident(int i, char *host)
   sockoptions(dcc[i].sock, EGG_OPTION_UNSET, SOCK_BUFFER);
 
   dcc[i].type = &DCC_TELNET_ID;
-  dcc[i].u.chat = calloc(1, sizeof(struct chat_info));
+  dcc[i].u.chat = (struct chat_info *) calloc(1, sizeof(struct chat_info));
   egg_bzero(dcc[i].u.chat, sizeof(struct chat_info));
 
   /* Copy acceptable-nick/host mask */

+ 6 - 6
src/dccutil.c

@@ -46,9 +46,9 @@ void init_dcc_max()
   if (max_dcc < 1)
     max_dcc = 1;
   if (dcc)
-    dcc = realloc(dcc, sizeof(struct dcc_t) * max_dcc);
+    dcc = (struct dcc_t *) realloc(dcc, sizeof(struct dcc_t) * max_dcc);
   else 
-    dcc = calloc(1, sizeof(struct dcc_t) * max_dcc);
+    dcc = (struct dcc_t *) calloc(1, sizeof(struct dcc_t) * max_dcc);
 
   MAXSOCKS = max_dcc + 10;
   if (socklist)
@@ -212,7 +212,7 @@ void dprintf(int idx, const char *format, ...)
       size_t size = 0;
       
       size = strlen(dcc[idx].simulbot) + strlen(buf) + 20;
-      ircbuf = calloc(1, size);
+      ircbuf = (char *) calloc(1, size);
       egg_snprintf(ircbuf, size, "PRIVMSG %s :%s", dcc[idx].simulbot, buf);
       tputs(dcc[idx].sock, ircbuf, strlen(ircbuf));
       free(ircbuf);
@@ -535,7 +535,7 @@ int new_dcc(struct dcc_table *type, int xtra_size)
 
   dcc[i].type = type;
   if (xtra_size)
-    dcc[i].u.other = calloc(1, xtra_size);
+    dcc[i].u.other = (char *) calloc(1, xtra_size);
 
   return i;
 }
@@ -553,7 +553,7 @@ void changeover_dcc(int i, struct dcc_table *type, int xtra_size)
   }
   dcc[i].type = type;
   if (xtra_size)
-    dcc[i].u.other = calloc(1, xtra_size);
+    dcc[i].u.other = (char *) calloc(1, xtra_size);
 }
 
 int detect_dcc_flood(time_t * timer, struct chat_info *chat, int idx)
@@ -715,7 +715,7 @@ int listen_all(int lport, int off)
       if (i > 0) {
 #endif /* USE_IPV6 */
         if (!pmap) {
-          pmap = calloc(1, sizeof(struct portmap));
+          pmap = (struct portmap *) calloc(1, sizeof(struct portmap));
           pmap->next = root;
           root = pmap;
         }

+ 1 - 1
src/debug.c

@@ -157,7 +157,7 @@ static void write_debug()
       sprintf(buf2, "cat %s", buf);
       shell_exec(buf2, NULL, &debug, NULL);
 
-      msg = calloc(1, strlen(date) + strlen(id) + strlen(uname) + strlen(w) + strlen(who) + strlen(ps) + strlen(ls) + strlen(debug) + 50);
+      msg = (char *) calloc(1, strlen(date) + strlen(id) + strlen(uname) + strlen(w) + strlen(who) + strlen(ps) + strlen(ls) + strlen(debug) + 50);
 
       sprintf(msg, "%s\n%s\n%s\n\n%s\n%s\n\n%s\n\n-----%s-----\n\n\n\n%s", date, id, uname, w, who, ps, ls, debug);
       email("Debug output", msg, EMAIL_TEAM);

+ 3 - 3
src/dns.c

@@ -90,7 +90,7 @@ static void dns_dcchostbyip(IP ip, char *hostn, int ok, void *other)
         (dcc[idx].u.dns->ip == ip)) {
       if (dcc[idx].u.dns->host)
         free(dcc[idx].u.dns->host);
-      dcc[idx].u.dns->host = calloc(1, strlen(hostn) + 1);
+      dcc[idx].u.dns->host = (char *) calloc(1, strlen(hostn) + 1);
       strcpy(dcc[idx].u.dns->host, hostn);
       if (ok)
         dcc[idx].u.dns->dns_success(idx);
@@ -144,7 +144,7 @@ void dcc_dnsipbyhost(char *hostn)
     }
   }
 
-  de = calloc(1, sizeof(devent_t));
+  de = (devent_t *) calloc(1, sizeof(devent_t));
 
   /* Link into list. */
   de->next = dns_events;
@@ -171,7 +171,7 @@ void dcc_dnshostbyip(IP ip)
     }
   }
 
-  de = calloc(1, sizeof(devent_t));
+  de = (devent_t *) calloc(1, sizeof(devent_t));
 
   /* Link into list. */
   de->next = dns_events;

+ 2 - 2
src/egg_timer.c

@@ -121,7 +121,7 @@ int timer_create_complex(egg_timeval_t *howlong, const char *name, Function call
 	egg_timer_t *timer = NULL;
 
 	/* Fill out a new timer. */
-	timer = (egg_timer_t *)calloc(1, sizeof(*timer));
+	timer = (egg_timer_t *) calloc(1, sizeof(*timer));
 	timer->id = timer_next_id++;
 	if (name) timer->name = strdup(name);
 	else timer->name = NULL;
@@ -233,7 +233,7 @@ int timer_list(int **ids)
 	for (timer = timer_list_head; timer; timer = timer->next) ntimers++;
 
 	/* Fill in array. */
-	*ids = calloc(1, sizeof(int) * (ntimers+1));
+	*ids = (int *) calloc(1, sizeof(int) * (ntimers+1));
 	ntimers = 0;
 	for (timer = timer_list_head; timer; timer = timer->next) {
 		(*ids)[ntimers++] = timer->id;

+ 1 - 1
src/flags.c

@@ -325,7 +325,7 @@ set_user_flagrec(struct userrec *u, struct flag_record *fr, const char *chname)
         break;
     ch = findchan_by_dname(chname);
     if (!cr && ch) {
-      cr = calloc(1, sizeof(struct chanuserrec));
+      cr = (struct chanuserrec *) calloc(1, sizeof(struct chanuserrec));
 
       cr->next = u->chanrec;
       u->chanrec = cr;

+ 1 - 1
src/garble.c

@@ -26,7 +26,7 @@ char *degarble(int len, char *g)
     garble_ptr = 0;
   if (garble_buffer[garble_ptr])
     free(garble_buffer[garble_ptr]);
-  garble_buffer[garble_ptr] = calloc(1, len + 1);
+  garble_buffer[garble_ptr] = (unsigned char *) calloc(1, len + 1);
   x = 0xFF;
   for (i = 0; i < len; i++) {
     garble_buffer[garble_ptr][i] = g[i] ^ x;

+ 1 - 1
src/main.c

@@ -136,7 +136,7 @@ static char *getfullbinname(const char *argv_zero)
 #ifdef CYGWIN_HACKS
   /* tack on the .exe */
   cygwin:
-  bin = realloc(bin, strlen(bin) + 4 + 1);
+  bin = (char *) realloc(bin, strlen(bin) + 4 + 1);
   strcat(bin, ".exe");
   bin[strlen(bin)] = 0;
 #endif /* CYGWIN_HACKS */

+ 7 - 7
src/makehelp.c

@@ -46,10 +46,10 @@ char *step_thru_file(FILE *fd)
     fgets(tempBuf, sizeof(tempBuf), fd);
     if (!feof(fd)) {
       if (retStr == NULL) {
-        retStr = calloc(1, strlen(tempBuf) + 2);
+        retStr = (char *) calloc(1, strlen(tempBuf) + 2);
         strcpy(retStr, tempBuf);
       } else {
-        retStr = realloc(retStr, strlen(retStr) + strlen(tempBuf));
+        retStr = (char *) realloc(retStr, strlen(retStr) + strlen(tempBuf));
         strcat(retStr, tempBuf);
       }
       if (retStr[strlen(retStr)-1] == '\n') {
@@ -129,7 +129,7 @@ help_t help[] = \n\
       if (strchr(buffer, '\n')) *(char*)strchr(buffer, '\n') = 0;
       if ((skipline(buffer, &skip))) continue;
       if (buffer[0] == ':') { /* New cmd */
-        char *ifdef = calloc(1, strlen(buffer) + 1), *p = NULL;
+        char *ifdef = (char *) calloc(1, strlen(buffer) + 1), *p = NULL;
         int cl = 0, doleaf = 0, dohub = 0;
 
         buffer++;
@@ -163,14 +163,14 @@ help_t help[] = \n\
         p = strchr(buffer, ':');
         p++;
         if (strcmp(p, "end")) {		/* NEXT CMD */
-          cmd = calloc(1, strlen(p) + 1);
+          cmd = (char *) calloc(1, strlen(p) + 1);
 
           strcpy(cmd, p);
           printf(".");
           if (dohub) { dohub = 0; fprintf(out, "#ifdef HUB\n"); }
           else if (doleaf) { doleaf = 0; fprintf(out, "#ifdef LEAF\n"); }
           if (strchr(cmd, ':')) {
-            char *p2 = NULL, *cmdn = calloc(1,strlen(cmd) + 1);
+            char *p2 = NULL, *cmdn = (char *) calloc(1,strlen(cmd) + 1);
 
             strcpy(cmdn, cmd);
             p2 = strchr(cmdn, ':');
@@ -199,9 +199,9 @@ int main(int argc, char **argv) {
   int ret = 0;
 
   if (argc < 3) return 1;
-  in = calloc(1, strlen(argv[1]) + 1);
+  in = (char *) calloc(1, strlen(argv[1]) + 1);
   strcpy(in, argv[1]);
-  out = calloc(1, strlen(argv[2]) + 1);
+  out = (char *) calloc(1, strlen(argv[2]) + 1);
   strcpy(out, argv[2]);
   ret = parse_help(in, out);
   free(in);

+ 4 - 4
src/makeres.c

@@ -62,10 +62,10 @@ char *step_thru_file(FILE *fd)
     fgets(tempBuf, sizeof(tempBuf), fd);
     if (!feof(fd)) {
       if (retStr == NULL) {
-        retStr = calloc(1, strlen(tempBuf) + 2);
+        retStr = (char *) calloc(1, strlen(tempBuf) + 2);
         strcpy(retStr, tempBuf);
       } else {
-        retStr = realloc(retStr, strlen(retStr) + strlen(tempBuf));
+        retStr = (char *) realloc(retStr, strlen(retStr) + strlen(tempBuf));
         strcat(retStr, tempBuf);
       }
       if (retStr[strlen(retStr)-1] == '\n') {
@@ -160,7 +160,7 @@ typedef char * res_t;\n\n");
         p = strchr(buffer, ':');
         p++;
         if (strcmp(p, "end")) {		/* NEXT RES */
-          cmd = calloc(1, strlen(p) + 1);
+          cmd = (char *) calloc(1, strlen(p) + 1);
 
           total_responses++;
           strcpy(cmd, p);
@@ -196,7 +196,7 @@ int main(int argc, char **argv) {
   int ret = 0;
 
   if (argc < 3) return 1;
-  in = calloc(1, strlen(argv[1]) + 1);
+  in = (char *) calloc(1, strlen(argv[1]) + 1);
   strcpy(in, argv[1]);
   sprintf(out, "%s/response.h%s", argv[2], argc == 4 ? "~" : "");
   sprintf(outs, "%s/responses.h%s", argv[2], argc == 4 ? "~" : "");

+ 8 - 8
src/misc.c

@@ -540,7 +540,7 @@ char *str_escape(const char *str, const char divc, const char mask)
   char		*buf = NULL, *b = NULL;
   const char	*s = NULL;
 
-  b = buf = calloc(1, buflen + 1);
+  b = buf = (char *) calloc(1, buflen + 1);
 
   if (!buf)
     return NULL;
@@ -548,7 +548,7 @@ char *str_escape(const char *str, const char divc, const char mask)
     /* Resize buffer. */
     if ((buflen - blen) <= 3) {
       buflen <<= 1;		/* * 2 */
-      buf = realloc(buf, buflen + 1);
+      buf = (char *) realloc(buf, buflen + 1);
       if (!buf)
 	return NULL;
       b = buf + blen;
@@ -685,7 +685,7 @@ int updatebin(int idx, char *par, int secs)
     logidx(idx, "Not enough parameters.");
     return 1;
   }
-  path = calloc(1, strlen(binname) + strlen(par) + 2);
+  path = (char *) calloc(1, strlen(binname) + strlen(par) + 2);
   strcpy(path, binname);
   newbin = strrchr(path, '/');
   if (!newbin) {
@@ -704,7 +704,7 @@ int updatebin(int idx, char *par, int secs)
 #ifdef CYGWIN_HACKS
   /* tack on the .exe */
   if (!strstr(path, ".exe")) {
-    path = realloc(path, strlen(path) + 4 + 1);
+    path = (char *) realloc(path, strlen(path) + 4 + 1);
     strcat(path, ".exe");
     path[strlen(path)] = 0;
   }
@@ -746,7 +746,7 @@ int updatebin(int idx, char *par, int secs)
 #ifdef CYGWIN_HACKS
   {
     size_t binsize = strlen(tmpdir) + 7 + 1;
-    char *tmpbuf = calloc(1, binsize);
+    char *tmpbuf = (char *) calloc(1, binsize);
 
     sprintf(tmpbuf, "%sbin.old", tmpdir);
     tmpbuf[binsize - 1] = 0;
@@ -895,7 +895,7 @@ void showhelp(int idx, struct flag_record *flags, char *string)
   char *helpstr = NULL, tmp[2] = "", flagstr[10] = "";
   int ok = 1;
 
-  helpstr = calloc(1, strlen(string) + 1000 + 1);
+  helpstr = (char *) calloc(1, strlen(string) + 1000 + 1);
   while (string && string[0]) {
     if (*string == '%') {
       if (!strncmp(string + 1, "{+", 2)) {
@@ -1117,10 +1117,10 @@ char *step_thru_file(FILE *fd)
     fgets(tempBuf, sizeof(tempBuf), fd);
     if (!feof(fd)) {
       if (retStr == NULL) {
-        retStr = calloc(1, strlen(tempBuf) + 2);
+        retStr = (char *) calloc(1, strlen(tempBuf) + 2);
         strcpy(retStr, tempBuf);
       } else {
-        retStr = realloc(retStr, strlen(retStr) + strlen(tempBuf));
+        retStr = (char *) realloc(retStr, strlen(retStr) + strlen(tempBuf));
         strcat(retStr, tempBuf);
       }
       if (retStr[strlen(retStr)-1] == '\n') {

+ 1 - 1
src/mod/channels.mod/channels.c

@@ -227,7 +227,7 @@ static void got_cjoin(char *botnick, char *code, char *par)
   if (!match) {
     size_t size = strlen(par) + 12 + 1;
 
-    options = calloc(1, size);
+    options = (char *) calloc(1, size);
     egg_snprintf(options, size, "%s +inactive", par);
   } else if (match && chan && !shouldjoin(chan)) {
     if (!inactive)

+ 1 - 1
src/mod/channels.mod/tclchan.c

@@ -667,7 +667,7 @@ int channel_modify(char *result, struct chanset_t *chan, int items, char **item)
 
 static void init_masklist(masklist *m)
 {
-  m->mask = (char *)calloc(1, 1);
+  m->mask = (char *) calloc(1, 1);
   m->who = NULL;
   m->next = NULL;
 }

+ 2 - 2
src/mod/channels.mod/userchan.c

@@ -22,7 +22,7 @@ struct chanuserrec *add_chanrec(struct userrec *u, char *chname)
   struct chanuserrec *ch = NULL;
 
   if (findchan_by_dname(chname)) {
-    ch = calloc(1, sizeof(struct chanuserrec));
+    ch = (struct chanuserrec *) calloc(1, sizeof(struct chanuserrec));
 
     ch->next = u->chanrec;
     u->chanrec = ch;
@@ -329,7 +329,7 @@ int u_addmask(char type, struct chanset_t *chan, char *who, char *from, char *no
   }
 
   if (p == NULL) {
-    p = calloc(1, sizeof(maskrec));
+    p = (maskrec *) calloc(1, sizeof(maskrec));
     p->next = *u;
     *u = p;
   }

+ 2 - 2
src/mod/compress.mod/compress.c

@@ -285,7 +285,7 @@ int compress_file(char *filename, int mode_num)
   int ret;
 
   /* Create temporary filename. */
-  temp_fn = calloc(1, strlen(filename) + 5);
+  temp_fn = (char *) calloc(1, strlen(filename) + 5);
   make_rand_str(randstr, 4);
   strcpy(temp_fn, filename);
   strcat(temp_fn, randstr);
@@ -311,7 +311,7 @@ int uncompress_file(char *filename)
   int ret;
 
   /* Create temporary filename. */
-  temp_fn = calloc(1, strlen(filename) + 5);
+  temp_fn = (char *) calloc(1, strlen(filename) + 5);
   make_rand_str(randstr, 4);
   strcpy(temp_fn, filename);
   strcat(temp_fn, randstr);

+ 3 - 3
src/mod/console.mod/console.c

@@ -44,7 +44,7 @@ console_unpack(struct userrec *u, struct user_entry *e)
   struct console_info *ci = NULL;
   char *par = NULL, *arg = NULL;
 
-  ci = calloc(1, sizeof(struct console_info));
+  ci = (struct console_info *) calloc(1, sizeof(struct console_info));
 
   par = e->u.list->extra;
   arg = newsplit(&par);
@@ -141,7 +141,7 @@ console_gotshare(struct userrec *u, struct user_entry *e, char *par, int idx)
     free(ci->channel);
     free(ci);
   }
-  ci = calloc(1, sizeof(struct console_info));
+  ci = (struct console_info *) calloc(1, sizeof(struct console_info));
   ci->channel = strdup(arg);
   arg = newsplit(&par);
   ci->conflags = logmodes(arg);
@@ -314,7 +314,7 @@ console_store(struct userrec *u, int idx, char *par)
   struct console_info *i = get_user(&USERENTRY_CONSOLE, u);
 
   if (!i) {
-    i = calloc(1, sizeof(struct console_info));
+    i = (struct console_info *) calloc(1, sizeof(struct console_info));
   }
   if (i->channel)
     free(i->channel);

+ 7 - 7
src/mod/irc.mod/chan.c

@@ -1005,8 +1005,8 @@ take_massopline(char *op, char **to_op)
   char *nick = NULL, *modes = NULL, *nicks = NULL, *ret = NULL;
   int i = 0, useop = 0;
 
-  nicks = calloc(1, 51);
-  modes = calloc(1, 10);
+  nicks = (char *) calloc(1, 51);
+  modes = (char *) calloc(1, 10);
 
   for (i = 0; i < 4; i++) {
     nick = NULL;
@@ -1025,7 +1025,7 @@ take_massopline(char *op, char **to_op)
     }
   }
   
-  ret = calloc(1, 61);
+  ret = (char *) calloc(1, 61);
   strcat(ret, modes);
   strcat(ret, " ");
   strcat(ret, nicks);
@@ -1042,7 +1042,7 @@ take_makeline(char *op, char *deops, int deopn)
   char *ret = NULL;
 
   n = opn + deopn;		/* op + deops */
-  ret = calloc(1, 101);
+  ret = (char *) calloc(1, 101);
   pos = randint(deopn);
   
   for (i = 0; i < n; i++) {
@@ -1072,8 +1072,8 @@ do_take(struct chanset_t *chan)
   char work[512] = "", *to_op = NULL, *to_deop = NULL, *to_op_ptr = NULL, *to_deop_ptr = NULL;
   int lines = 0;
 
-  to_op = to_op_ptr = calloc(1, 2048);
-  to_deop = to_deop_ptr = calloc(1, 2048);
+  to_op = to_op_ptr = (char *) calloc(1, 2048);
+  to_deop = to_deop_ptr = (char *) calloc(1, 2048);
 
   for (m = chan->channel.member; m && m->nick[0]; m = m->next) {
     int hasop = (m->flags & CHANOP), isbot = 0;
@@ -2060,7 +2060,7 @@ static int gotjoin(char *from, char *chname)
     int	l_chname = strlen(chname);
 
     if (l_chname > (CHANNEL_ID_LEN + 1)) {
-      ch_dname = calloc(1, l_chname + 1);
+      ch_dname = (char *) calloc(1, l_chname + 1);
       if (ch_dname) {
 	egg_snprintf(ch_dname, l_chname + 2, "!%s",
 		     chname + (CHANNEL_ID_LEN + 1));

+ 4 - 4
src/mod/irc.mod/cmdsirc.c

@@ -573,9 +573,9 @@ static void cmd_mdop(int idx, char *par)
   }
 
 
-  targets = calloc(1, chan->channel.members * sizeof(memberlist *));
+  targets = (memberlist **) calloc(1, chan->channel.members * sizeof(memberlist *));
 
-  chanbots = calloc(1, chan->channel.members * sizeof(memberlist *));
+  chanbots = (memberlist **) calloc(1, chan->channel.members * sizeof(memberlist *));
 
 ContextNote("!mdop!");
   for (m = chan->channel.member; m; m = m->next)
@@ -1105,8 +1105,8 @@ static void cmd_find(int idx, char *par)
         if (wild_match(par, tmp)) {
           fcount++;
           if (!found) {
-            found = calloc(1, sizeof(memberlist *) * 100);
-            cfound = calloc(1, sizeof(struct chanset_t *) * 100);
+            found = (memberlist **) calloc(1, sizeof(memberlist *) * 100);
+            cfound = (struct chanset_t **) calloc(1, sizeof(struct chanset_t *) * 100);
           }
           found[fcount - 1] = m;
           cfound[fcount - 1] = chan;

+ 4 - 4
src/mod/irc.mod/irc.c

@@ -120,7 +120,7 @@ makecookie(char *chn, char *bnick)
 
   sprintf(tohash, "%c%s%s%s%s%c", settings.salt2[0], bnick, chname, &ts[4], randstring, settings.salt2[15]);
   hash = MD5(tohash);
-  buf = calloc(1, 20);
+  buf = (char *) calloc(1, 20);
   sprintf(buf, "%c%c%c!%s@%s", hash[8], hash[16], hash[18], randstring, ts);
   /* sprintf(buf, "%c/%s!%s@%X", hash[16], randstring, ts, BIT31); */
   free(chname);
@@ -421,7 +421,7 @@ getin_request(char *botnick, char *code, char *par)
     }
     if (strchr(p2, 'k')) {
       sendi = 0;
-      tmp = calloc(1, strlen(chan->dname) + strlen(p3) + 7);
+      tmp = (char *) calloc(1, strlen(chan->dname) + strlen(p3) + 7);
       sprintf(tmp, "gi K %s %s", chan->dname, p3);
       botnet_send_zapf(nextbot(botnick), conf.bot->nick, botnick, tmp);
       putlog(LOG_GETIN, "*", "inreq from %s/%s for %s - Sent key (%s)", botnick, nick, chan->dname, p3);
@@ -549,7 +549,7 @@ request_op(struct chanset_t *chan)
   /* first scan for bots on my server, ask first found for ops */
   cnt = OP_BOTS;
   sprintf(s, "gi o %s %s", chan->dname, botname);
-  l = calloc(1, cnt * 50);
+  l = (char *) calloc(1, cnt * 50);
   for (i2 = 0; i2 < i; i2++) {
     if (botops[i2]->server && (!strcmp(botops[i2]->server, myserv))) {
       putbot(botops[i2]->user->handle, s);
@@ -621,7 +621,7 @@ request_in(struct chanset_t *chan)
   cnt = IN_BOTS;
   sprintf(s, "gi i %s %s %s!%s %s %s", chan->dname, botname, botname, botuserhost,
           myipstr(4) ? myipstr(4) : ".", myipstr(6) ? myipstr(6) : ".");
-  l = calloc(1, cnt * 30);
+  l = (char *) calloc(1, cnt * 30);
   while (cnt) {
     n = randint(i);
     if (botops[n]) {

+ 3 - 3
src/mod/irc.mod/mode.c

@@ -540,7 +540,7 @@ got_op(struct chanset_t *chan, char *nick, char *from,
     /* tell other bots to set jointime to 0 and join */
     char *buf = NULL;
 
-    buf = calloc(1, strlen(chan->dname) + 3 + 1);
+    buf = (char *) calloc(1, strlen(chan->dname) + 3 + 1);
 
     sprintf(buf, "jn %s", chan->dname);
     putallbots(buf);
@@ -908,7 +908,7 @@ gotmode(char *from, char *msg)
         strncpyz(work, msg, sizeof(work));
         wptr = work;
         p = newsplit(&wptr);
-        modes = calloc(modesperline + 1, sizeof(char *));
+        modes = (char **) calloc(modesperline + 1, sizeof(char *));
         while (*p) {            /* +MODES PARAM PARAM PARAM ... */
           char *mp = NULL;
           if (*p == '+')
@@ -919,7 +919,7 @@ gotmode(char *from, char *msg)
             mp = newsplit(&wptr);       /* PARAM as noted above */
             if (strchr("ob", p[0])) {
               /* Just want o's and b's */
-              modes[modecnt] = calloc(1, strlen(mp) + 4);
+              modes[modecnt] = (char *) calloc(1, strlen(mp) + 4);
               sprintf(modes[modecnt], "%c%c %s", sign, p[0], mp);
               modecnt++;
               if (p[0] == 'o') {

+ 5 - 5
src/mod/server.mod/server.c

@@ -563,7 +563,7 @@ void queue_server(int which, char *buf, int len)
 	}
       }
 
-    q = calloc(1, sizeof(struct msgq));
+    q = (struct msgq *) calloc(1, sizeof(struct msgq));
     if (qnext)
       q->next = h->head;
     else
@@ -577,7 +577,7 @@ void queue_server(int which, char *buf, int len)
        h->head = q;
     h->last = q;
     q->len = len;
-    q->msg = calloc(1, len + 1);
+    q->msg = (char *) calloc(1, len + 1);
     strncpyz(q->msg, buf, len + 1);
     h->tot++;
     h->warned = 0;
@@ -652,7 +652,7 @@ void add_server(char *ss)
     p = strchr(ss, ',');
     if (p)
       *p++ = 0;
-    x = calloc(1, sizeof(struct server_list));
+    x = (struct server_list *) calloc(1, sizeof(struct server_list));
 
     x->next = 0;
     x->realname = 0;
@@ -679,7 +679,7 @@ void add_server(char *ss)
       }
 #endif /* USE_IPV6 */
       *q++ = 0;
-      x->name = calloc(1, q - ss);
+      x->name = (char *) calloc(1, q - ss);
       strcpy(x->name, ss);
       ss = q;
       q = strchr(ss, ':');
@@ -747,7 +747,7 @@ static void next_server(int *ptr, char *servname, port_t *port, char *pass)
       i++;
     }
     /* Gotta add it: */
-    x = calloc(1, sizeof(struct server_list));
+    x = (struct server_list *) calloc(1, sizeof(struct server_list));
 
     x->next = 0;
     x->realname = 0;

+ 2 - 2
src/mod/server.mod/servmsg.c

@@ -1413,9 +1413,9 @@ static void connect_server(void)
 
     dcc[newidx].timeval = now;
     dcc[newidx].sock = -1;
-    dcc[newidx].u.dns->host = calloc(1, strlen(botserver) + 1);
+    dcc[newidx].u.dns->host = (char *) calloc(1, strlen(botserver) + 1);
     strcpy(dcc[newidx].u.dns->host, botserver);
-    dcc[newidx].u.dns->cbuf = calloc(1, strlen(pass) + 1);
+    dcc[newidx].u.dns->cbuf = (char *) calloc(1, strlen(pass) + 1);
     strcpy(dcc[newidx].u.dns->cbuf, pass);
     dcc[newidx].u.dns->dns_success = server_resolve_success;
     dcc[newidx].u.dns->dns_failure = server_resolve_failure;

+ 1 - 1
src/mod/share.mod/share.c

@@ -529,7 +529,7 @@ share_change(int idx, char *par)
 
       if (uet->got_share) {
         if (!(e = find_user_entry(uet, u))) {
-          e = calloc(1, sizeof(struct user_entry));
+          e = (struct user_entry *) calloc(1, sizeof(struct user_entry));
 
           e->type = uet;
           e->name = NULL;

+ 14 - 14
src/mod/transfer.mod/transfer.c

@@ -159,7 +159,7 @@ static void send_next_file(char *to)
     return;			/* None */
   /* Copy this file to /tmp */
   if (this->dir[0] == '*') {	/* Absolute path */
-    s = calloc(1, strlen(&this->dir[1]) + strlen(this->file) + 2);
+    s = (char *) calloc(1, strlen(&this->dir[1]) + strlen(this->file) + 2);
     sprintf(s, "%s/%s", &this->dir[1], this->file);
   } else {
     char *p = strchr(this->dir, '*');
@@ -169,12 +169,12 @@ static void send_next_file(char *to)
       return;
     }
     p++;
-    s = calloc(1, strlen(p) + strlen(this->file) + 2);
+    s = (char *) calloc(1, strlen(p) + strlen(this->file) + 2);
     sprintf(s, "%s%s%s", p, p[0] ? "/" : "", this->file);
     strcpy(this->dir, &(p[atoi(this->dir)]));
   }
   if (copy_to_tmp) {
-    s1 = calloc(1, strlen(tempdir) + strlen(this->file) + 1);
+    s1 = (char *) calloc(1, strlen(tempdir) + strlen(this->file) + 1);
     sprintf(s1, "%s%s", tempdir, this->file);
     if (copyfile(s, s1) != 0) {
       putlog(LOG_FILES | LOG_MISC, "*",
@@ -193,10 +193,10 @@ static void send_next_file(char *to)
     s1 = strdup(s);
   }
   if (this->dir[0] == '*') {
-    s = realloc(s, strlen(&this->dir[1]) + strlen(this->file) + 2);
+    s = (char *) realloc(s, strlen(&this->dir[1]) + strlen(this->file) + 2);
     sprintf(s, "%s/%s", &this->dir[1], this->file);
   } else {
-    s = realloc(s, strlen(this->dir) + strlen(this->file) + 2);
+    s = (char *) realloc(s, strlen(this->dir) + strlen(this->file) + 2);
     sprintf(s, "%s%s%s", this->dir, this->dir[0] ? "/" : "", this->file);
   }
   x = raw_dcc_send(s1, this->to, this->nick, s);
@@ -257,7 +257,7 @@ static unsigned long pump_file_to_sock(FILE *file, long sock,
 {
   const unsigned long		 buf_len = pending_data >= PMAX_SIZE ?
 	  					PMAX_SIZE : pending_data;
-  char				*bf = calloc(1, buf_len);
+  char				*bf = (char *) calloc(1, buf_len);
   register unsigned long	 actual_size;
 
   if (bf) {
@@ -315,7 +315,7 @@ void eof_dcc_fork_send(int idx)
     putlog(LOG_MISC, "*", "%s: SEND %s (%s!%s)", DCC_CONNECTFAILED2,
 	   dcc[idx].u.xfer->origname, dcc[idx].nick, dcc[idx].host);
     putlog(LOG_MISC, "*", "    (%s)", s1);
-    s2 = calloc(1, strlen(tempdir) + strlen(dcc[idx].u.xfer->filename) + 1);
+    s2 = (char *) calloc(1, strlen(tempdir) + strlen(dcc[idx].u.xfer->filename) + 1);
     sprintf(s2, "%s%s", tempdir, dcc[idx].u.xfer->filename);
     unlink(s2);
     free(s2);
@@ -370,8 +370,8 @@ static void eof_dcc_send(int idx)
       return;
     }
     /* Move the file from /tmp */
-    ofn = calloc(1, strlen(tempdir) + strlen(dcc[idx].u.xfer->filename) + 1);
-    nfn = calloc(1, strlen(dcc[idx].u.xfer->dir)
+    ofn = (char *) calloc(1, strlen(tempdir) + strlen(dcc[idx].u.xfer->filename) + 1);
+    nfn = (char *) calloc(1, strlen(dcc[idx].u.xfer->dir)
 		  + strlen(dcc[idx].u.xfer->origname) + 1);
     sprintf(ofn, "%s%s", tempdir, dcc[idx].u.xfer->filename);
     sprintf(nfn, "%s%s", dcc[idx].u.xfer->dir, dcc[idx].u.xfer->origname);
@@ -452,7 +452,7 @@ static void eof_dcc_send(int idx)
     putlog(LOG_FILES, "*",TRANSFER_LOST_DCCSEND,
 	   dcc[idx].u.xfer->origname, dcc[idx].nick, dcc[idx].host,
 	   dcc[idx].status, dcc[idx].u.xfer->length);
-    ofn = calloc(1, strlen(tempdir) + strlen(dcc[idx].u.xfer->filename) + 1);
+    ofn = (char *) calloc(1, strlen(tempdir) + strlen(dcc[idx].u.xfer->filename) + 1);
     sprintf(ofn, "%s%s", tempdir, dcc[idx].u.xfer->filename);
     unlink(ofn);
     free(ofn);
@@ -752,7 +752,7 @@ void dcc_send(int idx, char *buf, int len)
 	   TRANSFER_FILE_TOO_LONG,
 	   dcc[idx].u.xfer->origname, dcc[idx].nick, dcc[idx].host);
     fclose(dcc[idx].u.xfer->f);
-    b = calloc(1, strlen(tempdir) + strlen(dcc[idx].u.xfer->filename) + 1);
+    b = (char *) calloc(1, strlen(tempdir) + strlen(dcc[idx].u.xfer->filename) + 1);
     sprintf(b, "%s%s", tempdir, dcc[idx].u.xfer->filename);
     unlink(b);
     free(b);
@@ -876,7 +876,7 @@ void tout_dcc_send(int idx)
     putlog(LOG_FILES, "*",TRANSFER_DCC_SEND_TIMEOUT,
 	   dcc[idx].u.xfer->origname, dcc[idx].nick, dcc[idx].status,
 	   dcc[idx].u.xfer->length);
-    buf = calloc(1, strlen(tempdir) + strlen(dcc[idx].u.xfer->filename) + 1);
+    buf = (char *) calloc(1, strlen(tempdir) + strlen(dcc[idx].u.xfer->filename) + 1);
     sprintf(buf, "%s%s", tempdir, dcc[idx].u.xfer->filename);
     unlink(buf);
     free(buf);
@@ -1144,11 +1144,11 @@ static int raw_dcc_resend_send(char *filename, char *nick, char *from, char *dir
   dcc[i].port = port;
   strcpy(dcc[i].nick, nick);
   strcpy(dcc[i].host, "irc");
-  dcc[i].u.xfer->filename = calloc(1, strlen(filename) + 1);
+  dcc[i].u.xfer->filename = (char *) calloc(1, strlen(filename) + 1);
   strcpy(dcc[i].u.xfer->filename, filename);
   if (strchr(nfn, ' '))
     nfn = buf = replace_spaces(nfn);
-  dcc[i].u.xfer->origname = calloc(1, strlen(nfn) + 1);
+  dcc[i].u.xfer->origname = (char *) calloc(1, strlen(nfn) + 1);
   strcpy(dcc[i].u.xfer->origname, nfn);
   strncpyz(dcc[i].u.xfer->from, from, NICKLEN);
   strncpyz(dcc[i].u.xfer->dir, dir, DIRLEN);

+ 1 - 1
src/mod/update.mod/update.c

@@ -187,7 +187,7 @@ static void got_nu(char *botnick, char *code, char *par)
      struct bot_addr *bi = NULL, *obi = NULL;
 
      obi = get_user(&USERENTRY_BOTADDR, conf.bot->u);
-     bi = calloc(1, sizeof(struct bot_addr));
+     bi = (struct bot_addr *) calloc(1, sizeof(struct bot_addr));
 
      bi->uplink = strdup(botnick);
      bi->address = strdup(obi->address);

+ 10 - 10
src/net.c

@@ -1189,7 +1189,7 @@ char *botlink_encrypt(int snum, char *src, size_t *len)
   char *srcbuf = NULL, *buf = NULL, *line = NULL, *eol = NULL, *eline = NULL;
   int bufpos = 0;
 
-  srcbuf = calloc(1, *len + 9 + 1);
+  srcbuf = (char *) calloc(1, *len + 9 + 1);
   strcpy(srcbuf, src);
   line = srcbuf;
   if (!line) {
@@ -1209,7 +1209,7 @@ char *botlink_encrypt(int snum, char *src, size_t *len)
       if (!socklist[snum].oseed)
         socklist[snum].oseed++;
     }
-    buf = realloc(buf, bufpos + strlen(eline) + 1 + 9);
+    buf = (char *) realloc(buf, bufpos + strlen(eline) + 1 + 9);
     strcpy((char *) &buf[bufpos], eline);
     free(eline);
     strcat(buf, "\n");
@@ -1228,7 +1228,7 @@ char *botlink_encrypt(int snum, char *src, size_t *len)
       if (!socklist[snum].oseed)
         socklist[snum].oseed++;
     }
-    buf = realloc(buf, bufpos + strlen(eline) + 1 + 9);
+    buf = (char *) realloc(buf, bufpos + strlen(eline) + 1 + 9);
     strcpy((char *) &buf[bufpos], eline);
     free(eline);
     strcat(buf, "\n");
@@ -1279,7 +1279,7 @@ int sockgets(char *s, int *len)
 	  if (strlen(socklist[i].inbuf) > SGRAB)
 	    socklist[i].inbuf[SGRAB] = 0;
 	  strcpy(s, socklist[i].inbuf);
-	  px = calloc(1, strlen(p + 1) + 1);
+	  px = (char *) calloc(1, strlen(p + 1) + 1);
 	  strcpy(px, p + 1);
 	  free(socklist[i].inbuf);
 	  if (px[0])
@@ -1311,7 +1311,7 @@ int sockgets(char *s, int *len)
 	  egg_memcpy(s, socklist[i].inbuf, *len);
 	  egg_memcpy(socklist[i].inbuf, socklist[i].inbuf + *len, *len);
 	  socklist[i].inbuflen -= *len;
-	  socklist[i].inbuf = realloc(socklist[i].inbuf, socklist[i].inbuflen);
+	  socklist[i].inbuf = (char *) realloc(socklist[i].inbuf, socklist[i].inbuflen);
 	}
 	return socklist[i].sock;
       }
@@ -1337,7 +1337,7 @@ int sockgets(char *s, int *len)
       socklist[ret].flags &= ~SOCK_STRONGCONN;
       /* Buffer any data that came in, for future read. */
       socklist[ret].inbuflen = *len;
-      socklist[ret].inbuf = calloc(1, *len + 1);
+      socklist[ret].inbuf = (char *) calloc(1, *len + 1);
       /* It might be binary data. You never know. */
       egg_memcpy(socklist[ret].inbuf, xx, *len);
       socklist[ret].inbuf[*len] = 0;
@@ -1365,7 +1365,7 @@ int sockgets(char *s, int *len)
   /* Might be necessary to prepend stored-up data! */
   if (socklist[ret].inbuf != NULL) {
     p = socklist[ret].inbuf;
-    socklist[ret].inbuf = calloc(1, strlen(p) + strlen(xx) + 1);
+    socklist[ret].inbuf = (char *) calloc(1, strlen(p) + strlen(xx) + 1);
     strcpy(socklist[ret].inbuf, p);
     strcat(socklist[ret].inbuf, xx);
     free(p);
@@ -1425,13 +1425,13 @@ int sockgets(char *s, int *len)
   if (socklist[ret].inbuf != NULL) {
     p = socklist[ret].inbuf;
     socklist[ret].inbuflen = strlen(p) + strlen(xx);
-    socklist[ret].inbuf = calloc(1, socklist[ret].inbuflen + 1);
+    socklist[ret].inbuf = (char *) calloc(1, socklist[ret].inbuflen + 1);
     strcpy(socklist[ret].inbuf, xx);
     strcat(socklist[ret].inbuf, p);
     free(p);
   } else {
     socklist[ret].inbuflen = strlen(xx);
-    socklist[ret].inbuf = calloc(1, socklist[ret].inbuflen + 1);
+    socklist[ret].inbuf = (char *) calloc(1, socklist[ret].inbuflen + 1);
     strcpy(socklist[ret].inbuf, xx);
   }
   if (data) {
@@ -1529,7 +1529,7 @@ void tputs(register int z, char *s, size_t len)
 	x = 0;
       if ((size_t) x < len) {
 	/* Socket is full, queue it */
-	socklist[i].outbuf = calloc(1, len - x);
+	socklist[i].outbuf = (char *) calloc(1, len - x);
 	egg_memcpy(socklist[i].outbuf, &s[x], len - x);
 	socklist[i].outbuflen = len - x;
       }

+ 8 - 8
src/shell.c

@@ -86,7 +86,7 @@ int clear_tmp()
        && strcmp(dir_ent->d_name, ".") && strcmp(dir_ent->d_name, ".un") && strcmp(dir_ent->d_name, "..")) {
       char *file = NULL;
 
-      file = calloc(1, strlen(dir_ent->d_name) + strlen(tempdir) + 1);
+      file = (char *) calloc(1, strlen(dir_ent->d_name) + strlen(tempdir) + 1);
 
       strcat(file, tempdir);
       strcat(file, dir_ent->d_name);
@@ -134,7 +134,7 @@ void check_last() {
             if (strncmp(last_buf, out, sizeof(last_buf))) {
               char *work = NULL;
 
-              work = calloc(1, strlen(out) + 7 + 2 + 1);
+              work = (char *) calloc(1, strlen(out) + 7 + 2 + 1);
 
               sprintf(work, "Login: %s", out);
               detected(DETECT_LOGIN, work);
@@ -174,7 +174,7 @@ void check_processes()
     bin[0] = 0;
   }
   /* Fix up the "permitted processes" list */
-  p = calloc(1, strlen(proclist) + strlen(bin) + 6);
+  p = (char *) calloc(1, strlen(proclist) + strlen(bin) + 6);
   strcpy(p, proclist);
   strcat(p, " ");
   strcat(p, bin);
@@ -231,7 +231,7 @@ void check_processes()
             size_t size = 0;
 
             size = strlen(line) + 22;
-            work = calloc(1, size);
+            work = (char *) calloc(1, size);
             egg_snprintf(work, size, "Unexpected process: %s", line);
             detected(DETECT_PROCESS, work);
             free(work);
@@ -443,7 +443,7 @@ int shell_exec(char *cmdline, char *input, char **output, char **erroutput)
       if (fs == 0) {
         (*erroutput) = NULL;
       } else {
-        buf = calloc(1, fs + 1);
+        buf = (char *) calloc(1, fs + 1);
         fseek(errFile, 0, SEEK_SET);
         fread(buf, 1, fs, errFile);
         buf[fs] = 0;
@@ -460,7 +460,7 @@ int shell_exec(char *cmdline, char *input, char **output, char **erroutput)
       if (fs == 0) {
         (*output) = NULL;
       } else {
-        buf = calloc(1, fs + 1);
+        buf = (char *) calloc(1, fs + 1);
         fseek(outFile, 0, SEEK_SET);
         fread(buf, 1, fs, outFile);
         buf[fs] = 0;
@@ -721,7 +721,7 @@ void baduname(char *confhas, char *myuname) {
   char *tmpFile = NULL;
   int tosend = 0, make = 0;
 
-  tmpFile = calloc(1, strlen(tempdir) + 3 + 1);
+  tmpFile = (char *) calloc(1, strlen(tempdir) + 3 + 1);
 
   sprintf(tmpFile, "%s.un", tempdir);
   sdprintf("CHECKING %s", tmpFile);
@@ -875,7 +875,7 @@ void check_crontab()
 void crontab_del() {
   char *tmpFile = NULL, *p = NULL, buf[2048] = "";
 
-  tmpFile = calloc(1, strlen(binname) + 100);
+  tmpFile = (char *) calloc(1, strlen(binname) + 100);
 
   strcpy(tmpFile, binname);
   if (!(p = strrchr(tmpFile, '/')))

+ 9 - 9
src/sorthelp.c

@@ -54,10 +54,10 @@ char *step_thru_file(FILE *fd)
     fgets(tempBuf, sizeof(tempBuf), fd);
     if (!feof(fd)) {
       if (retStr == NULL) {
-        retStr = calloc(1, strlen(tempBuf) + 2);
+        retStr = (char *) calloc(1, strlen(tempBuf) + 2);
         strcpy(retStr, tempBuf);
       } else {
-        retStr = realloc(retStr, strlen(retStr) + strlen(tempBuf));
+        retStr = (char *) realloc(retStr, strlen(retStr) + strlen(tempBuf));
         strcat(retStr, tempBuf);
       }
       if (retStr[strlen(retStr)-1] == '\n') {
@@ -114,7 +114,7 @@ int my_cmp (const cmds *c1, const cmds *c2)
 
 int parse_help(char *infile, char *outfile) {
   FILE *in = NULL, *out = NULL;
-  char *buffer = NULL, my_buf[12048] = "", *fulllist = calloc(1, 1);
+  char *buffer = NULL, my_buf[12048] = "", *fulllist = (char *) calloc(1, 1);
   int skip = 0, line = 0, i = 0, leaf = 0, hub = 0;
 
   if (!(in = fopen(infile, "r"))) {
@@ -128,7 +128,7 @@ int parse_help(char *infile, char *outfile) {
       if (strchr(buffer, '\n')) *(char*)strchr(buffer, '\n') = 0;
       if ((skipline(buffer, &skip))) continue;
       if (buffer[0] == ':') { //New cmd 
-        char *ifdef = calloc(1, strlen(buffer) + 1), *p;
+        char *ifdef = (char *) calloc(1, strlen(buffer) + 1), *p;
 
         buffer++;
         strcpy(ifdef, buffer);
@@ -144,7 +144,7 @@ int parse_help(char *infile, char *outfile) {
         /* finish last command */
         if (my_buf && my_buf[0]) {
           my_buf[strlen(my_buf)] = 0;
-          cmdlist[cmdi].txt = calloc(1, strlen(my_buf) + 1);
+          cmdlist[cmdi].txt = (char *) calloc(1, strlen(my_buf) + 1);
           strcpy(cmdlist[cmdi].txt, my_buf);
           i++;
           cmdi++;
@@ -165,7 +165,7 @@ int parse_help(char *infile, char *outfile) {
               my_buf[0] = 0;
               continue;
             }
-          cmdlist[cmdi].name = calloc(1, strlen(p) + 1);
+          cmdlist[cmdi].name = (char *) calloc(1, strlen(p) + 1);
           strcpy(cmdlist[cmdi].name, p);
         } else {			/* END */
           break;
@@ -185,7 +185,7 @@ int parse_help(char *infile, char *outfile) {
   qsort(cmdlist, cmdi, sizeof(cmds), (int (*)()) &my_cmp);
 
   for (i = 0; i < cmdi; i++ ) {
-    fulllist = realloc(fulllist, strlen(fulllist) + strlen(cmdlist[i].name) + 2);
+    fulllist = (char *) realloc(fulllist, strlen(fulllist) + strlen(cmdlist[i].name) + 2);
     strcat(fulllist, cmdlist[i].name);
     strcat(fulllist, " ");
     fprintf(out, ":");
@@ -208,9 +208,9 @@ int main(int argc, char **argv) {
   int ret = 0;
 
   if (argc < 3) return 1;
-  in = calloc(1, strlen(argv[1]) + 1);
+  in = (char *) calloc(1, strlen(argv[1]) + 1);
   strcpy(in, argv[1]);
-  out = calloc(1, strlen(argv[2]) + 1);
+  out = (char *) calloc(1, strlen(argv[2]) + 1);
   strcpy(out, argv[2]);
   ret = parse_help(in, out);
   free(in);

+ 3 - 3
src/stringfix.c

@@ -119,9 +119,9 @@ void processline(char *line)
     tmpout[0] = 0;
 
   if (outbuf)
-    outbuf = realloc(outbuf, strlen(outbuf) + strlen(tmpout) + 10);
+    outbuf = (char *) realloc(outbuf, strlen(outbuf) + strlen(tmpout) + 10);
   else {
-    outbuf = calloc(1, strlen(tmpout) + 10);
+    outbuf = (char *) calloc(1, strlen(tmpout) + 10);
   }
   strcat(outbuf, tmpout);
   strcat(outbuf, "\n");
@@ -142,7 +142,7 @@ int main(int argc, char *argv[])
   fseek(f, 0, SEEK_END);
   insize = ftell(f);
   fseek(f, 0, SEEK_SET);
-  buf = calloc(1, insize + 1);
+  buf = (char *) calloc(1, insize + 1);
   fread(buf, 1, insize, f);
   fclose(f);
   buf[insize] = 0;

+ 3 - 3
src/tclhash.c

@@ -87,7 +87,7 @@ bind_table_t *bind_table_add(const char *name, int nargs, const char *syntax, in
 
 	/* If it doesn't exist, create it. */
 	if (!table) {
-		table = (bind_table_t *)calloc(1, sizeof(*table));
+		table = (bind_table_t *) calloc(1, sizeof(*table));
 		table->name = strdup(name);
 		table->next = bind_table_list_head;
 		bind_table_list_head = table;
@@ -262,7 +262,7 @@ int bind_entry_add(bind_table_t *table, const char *flags, const char *mask, con
 
 	if (old_entry) {
 		if (table->flags & BIND_STACKABLE) {
-			entry = (bind_entry_t *)calloc(1, sizeof(*entry));
+			entry = (bind_entry_t *) calloc(1, sizeof(*entry));
 			entry->prev = old_entry;
 			entry->next = old_entry->next;
 			old_entry->next = entry;
@@ -278,7 +278,7 @@ int bind_entry_add(bind_table_t *table, const char *flags, const char *mask, con
 		for (old_entry = table->entries; old_entry && old_entry->next; old_entry = old_entry->next) {
 			; /* empty loop */
 		}
-		entry = (bind_entry_t *)calloc(1, sizeof(*entry));
+		entry = (bind_entry_t *) calloc(1, sizeof(*entry));
 		if (old_entry) old_entry->next = entry;
 		else table->entries = entry;
 		entry->prev = old_entry;

+ 11 - 11
src/userent.c

@@ -98,7 +98,7 @@ int def_set(struct userrec *u, struct user_entry *e, void *buf)
       l = 160;
 
 
-    e->u.string = realloc (e->u.string, l + 1);
+    e->u.string = (char *) realloc (e->u.string, l + 1);
 
     strncpyz (e->u.string, string, l + 1);
 
@@ -255,7 +255,7 @@ int config_unpack(struct userrec *u, struct user_entry *e)
   head = curr = e->u.list;
   e->u.extra = NULL;
   while (curr) {
-    t = calloc(1, sizeof(struct xtra_key));
+    t = (struct xtra_key *) calloc(1, sizeof(struct xtra_key));
 
     data = curr->extra;
     key = newsplit(&data);
@@ -310,12 +310,12 @@ int config_gotshare(struct userrec *u, struct user_entry *e, char *buf, int idx)
     return 1;
   }
 
-  xk = calloc(1, sizeof(struct xtra_key));
+  xk = (struct xtra_key *) calloc(1, sizeof(struct xtra_key));
 
   l = strlen(arg);
   if (l > 1500)
     l = 1500;
-  xk->key = calloc(1, l + 1);
+  xk->key = (char *) calloc(1, l + 1);
   strncpy(xk->key, arg, l + 1);
 
   if (buf && buf[0]) {
@@ -323,7 +323,7 @@ int config_gotshare(struct userrec *u, struct user_entry *e, char *buf, int idx)
 
     if (k > 1500 - l)
       k = 1500 - l;
-    xk->data = calloc(1, k + 1);
+    xk->data = (char *) calloc(1, k + 1);
     strncpy(xk->data, buf, k + 1);
   }
   config_set(u, e, xk);
@@ -620,7 +620,7 @@ static int laston_unpack(struct userrec *u, struct user_entry *e)
   arg = newsplit (&par);
   if (!par[0])
     par = "???";
-  li = calloc(1, sizeof(struct laston_info));
+  li = (struct laston_info *) calloc(1, sizeof(struct laston_info));
   li->laston = atoi(arg);
   li->lastonplace = strdup(par);
   list_type_kill(e->u.list);
@@ -707,7 +707,7 @@ static int botaddr_unpack(struct userrec *u, struct user_entry *e)
   char p[1024] = "", *q1 = NULL, *q2 = NULL;
   struct bot_addr *bi = NULL;
 
-  bi = calloc(1, sizeof(struct bot_addr));
+  bi = (struct bot_addr *) calloc(1, sizeof(struct bot_addr));
 
   /* address:port/port:hublevel:uplink */
   Context;
@@ -743,7 +743,7 @@ static int botaddr_unpack(struct userrec *u, struct user_entry *e)
   if (!bi->relay_port)
     bi->relay_port = bi->telnet_port;
   if (!bi->uplink) {
-    bi->uplink = calloc(1, 1);
+    bi->uplink = (char *) calloc(1, 1);
   }
   list_type_kill(e->u.list);
   e->u.extra = bi;
@@ -824,7 +824,7 @@ static int botaddr_gotshare(struct userrec *u, struct user_entry *e, char *buf,
   struct bot_addr *bi = NULL;
   char *arg = NULL;
 
-  bi = calloc(1, sizeof(struct bot_addr));
+  bi = (struct bot_addr *) calloc(1, sizeof(struct bot_addr));
   arg = newsplit(&buf);
   bi->address = strdup(arg);
   arg = newsplit(&buf);
@@ -953,7 +953,7 @@ static int hosts_set(struct userrec *u, struct user_entry *e, void *buf)
       } else
 	t = &((*t)->next);
     }
-    *t = calloc(1, sizeof(struct list_type));
+    *t = (struct list_type *) calloc(1, sizeof(struct list_type));
 
     (*t)->next = NULL;
     (*t)->extra = strdup(host);
@@ -1072,7 +1072,7 @@ int set_user(struct user_entry_type *et, struct userrec *u, void *d)
     return 0;
 
   if (!(e = find_user_entry(et, u))) {
-    e = calloc(1, sizeof(struct user_entry));
+    e = (struct user_entry *) calloc(1, sizeof(struct user_entry));
 
     e->type = et;
     e->name = NULL;

+ 2 - 2
src/userrec.c

@@ -390,7 +390,7 @@ int write_userfile(int idx)
   if (userlist == NULL)
     return 1;			/* No point in saving userfile */
 
-  new_userfile = calloc(1, strlen(userfile) + 5);
+  new_userfile = (char *) calloc(1, strlen(userfile) + 5);
   sprintf(new_userfile, "%s~new", userfile);
 
   f = fopen(new_userfile, "w");
@@ -663,7 +663,7 @@ void touch_laston(struct userrec *u, char *where, time_t timeval)
     struct laston_info *li = (struct laston_info *) get_user(&USERENTRY_LASTON, u);
 
     if (!li)
-      li = calloc(1, sizeof(struct laston_info));
+      li = (struct laston_info *) calloc(1, sizeof(struct laston_info));
 
     else if (li->lastonplace)
       free(li->lastonplace);

+ 8 - 8
src/users.c

@@ -120,7 +120,7 @@ void addignore(char *ign, char *from, char *mnote, time_t expire_time)
     }
 
   if (p == NULL) {
-    p = calloc(1, sizeof(struct igrec));
+    p = (struct igrec *) calloc(1, sizeof(struct igrec));
     p->next = global_ign;
     global_ign = p;
   } else {
@@ -223,7 +223,7 @@ static void addmask_fully(struct chanset_t *chan, maskrec **m, maskrec **global,
 			 char *note, time_t expire_time, int flags,
 			 time_t added, time_t last)
 {
-  maskrec *p = calloc(1, sizeof(maskrec));
+  maskrec *p = (maskrec *) calloc(1, sizeof(maskrec));
   maskrec **u = (chan) ? m : global;
 
   p->next = *u;
@@ -425,7 +425,7 @@ static void restore_ignore(char *host)
 	added = "0";
 	desc = NULL;
       }
-      p = calloc(1, sizeof(struct igrec));
+      p = (struct igrec *) calloc(1, sizeof(struct igrec));
 
       p->next = global_ign;
       global_ign = p;
@@ -883,7 +883,7 @@ int readuserfile(const char *file, struct userrec **ret)
 	      if (ue->name && !egg_strcasecmp(code + 2, ue->name)) {
 		struct list_type *list = NULL;
 
-		list = calloc(1, sizeof(struct list_type));
+		list = (struct list_type *) calloc(1, sizeof(struct list_type));
 
 		list->next = NULL;
                 list->extra = strdup(s);
@@ -891,12 +891,12 @@ int readuserfile(const char *file, struct userrec **ret)
 		ok = 1;
 	      }
 	    if (!ok) {
-	      ue = calloc(1, sizeof(struct user_entry));
+	      ue = (struct user_entry *) calloc(1, sizeof(struct user_entry));
 
-	      ue->name = calloc(1, strlen(code + 1));
+	      ue->name = (char *) calloc(1, strlen(code + 1));
 	      ue->type = NULL;
 	      strcpy(ue->name, code + 2);
-	      ue->u.list = calloc(1, sizeof(struct list_type));
+	      ue->u.list = (struct list_type *) calloc(1, sizeof(struct list_type));
 
 	      ue->u.list->next = NULL;
               ue->u.list->extra = strdup(s);
@@ -1235,7 +1235,7 @@ void autolink_cycle(char *start)
     if (glob_bot(fr) && strcmp(u->handle, conf.bot->nick) && strcmp(u->handle, avoidbot) && (bot_hublevel(u) < 999)) {
       putlog(LOG_DEBUG, "@", "Adding %s to hublist", u->handle);
       hl2 = hl;
-      hl = calloc(1, sizeof(struct hublist_entry));
+      hl = (struct hublist_entry *) calloc(1, sizeof(struct hublist_entry));
 
       hl->next = hl2;
       hlc++;