diff options
| author | cyberbotx <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864> | 2008-11-23 19:12:20 +0000 |
|---|---|---|
| committer | cyberbotx <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864> | 2008-11-23 19:12:20 +0000 |
| commit | 8431ac369b2f12ac376798fb01748f52d327164a (patch) | |
| tree | 383144a0a102038cf5fd1aaf780f9594ffb376f1 /src/core | |
| parent | 5950b11a0f4903cd07c0068a428f499dd64bdd2b (diff) | |
Converted many C-style casts to C++-style casts.
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1788 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/bs_badwords.c | 4 | ||||
| -rw-r--r-- | src/core/bs_kick.c | 20 | ||||
| -rw-r--r-- | src/core/cs_access.c | 6 | ||||
| -rw-r--r-- | src/core/cs_akick.c | 4 | ||||
| -rw-r--r-- | src/core/cs_ban.c | 2 | ||||
| -rw-r--r-- | src/core/cs_clear.c | 8 | ||||
| -rw-r--r-- | src/core/cs_set.c | 4 | ||||
| -rw-r--r-- | src/core/cs_xop.c | 6 | ||||
| -rw-r--r-- | src/core/hs_delall.c | 6 | ||||
| -rw-r--r-- | src/core/hs_setall.c | 2 | ||||
| -rw-r--r-- | src/core/ms_set.c | 6 | ||||
| -rw-r--r-- | src/core/ns_access.c | 6 | ||||
| -rw-r--r-- | src/core/ns_group.c | 10 | ||||
| -rw-r--r-- | src/core/ns_identify.c | 2 | ||||
| -rw-r--r-- | src/core/ns_register.c | 12 | ||||
| -rw-r--r-- | src/core/ns_saset.c | 2 | ||||
| -rw-r--r-- | src/core/ns_set.c | 2 | ||||
| -rw-r--r-- | src/core/os_admin.c | 16 | ||||
| -rw-r--r-- | src/core/os_akill.c | 16 | ||||
| -rw-r--r-- | src/core/os_oper.c | 14 | ||||
| -rw-r--r-- | src/core/os_quit.c | 2 | ||||
| -rw-r--r-- | src/core/os_reload.c | 2 | ||||
| -rw-r--r-- | src/core/os_restart.c | 2 | ||||
| -rw-r--r-- | src/core/os_sgline.c | 12 | ||||
| -rw-r--r-- | src/core/os_shutdown.c | 2 | ||||
| -rw-r--r-- | src/core/os_sqline.c | 12 | ||||
| -rw-r--r-- | src/core/os_staff.c | 10 | ||||
| -rw-r--r-- | src/core/os_stats.c | 12 | ||||
| -rw-r--r-- | src/core/os_szline.c | 12 |
29 files changed, 107 insertions, 107 deletions
diff --git a/src/core/bs_badwords.c b/src/core/bs_badwords.c index 15e7c15ef..3fce1698e 100644 --- a/src/core/bs_badwords.c +++ b/src/core/bs_badwords.c @@ -118,7 +118,7 @@ int do_badwords(User * u) if (i < BSBadWordsMax) { ci->bwcount++; ci->badwords = - (BadWord *)srealloc(ci->badwords, sizeof(BadWord) * ci->bwcount); + static_cast<BadWord *>(srealloc(ci->badwords, sizeof(BadWord) * ci->bwcount)); } else { notice_lang(s_BotServ, u, BOT_BADWORDS_REACHED_LIMIT, BSBadWordsMax); @@ -211,7 +211,7 @@ int do_badwords(User * u) ci->bwcount--; } ci->badwords = - (BadWord *)srealloc(ci->badwords,sizeof(BadWord) * ci->bwcount); + static_cast<BadWord *>(srealloc(ci->badwords,sizeof(BadWord) * ci->bwcount)); } } else if (stricmp(cmd, "LIST") == 0) { diff --git a/src/core/bs_kick.c b/src/core/bs_kick.c index 229b4dba2..55d230710 100644 --- a/src/core/bs_kick.c +++ b/src/core/bs_kick.c @@ -6,8 +6,8 @@ * Please read COPYING and README for further details. * * Based on the original code of Epona by Lara. - * Based on the original code of Services by Andy Church. - * + * Based on the original code of Services by Andy Church. + * * $Id$ * */ @@ -95,7 +95,7 @@ int do_kickcmd(User * u) if (!stricmp(value, "ON")) { if (ttb) { ci->ttb[TTB_BADWORDS] = - strtol(ttb, (char **) NULL, 10); + strtol(ttb, NULL, 10); /* Only error if errno returns ERANGE or EINVAL or we are less then 0 - TSL */ if (errno == ERANGE || errno == EINVAL || ci->ttb[TTB_BADWORDS] < 0) { @@ -124,7 +124,7 @@ int do_kickcmd(User * u) } else if (!stricmp(option, "BOLDS")) { if (!stricmp(value, "ON")) { if (ttb) { - ci->ttb[TTB_BOLDS] = strtol(ttb, (char **) NULL, 10); + ci->ttb[TTB_BOLDS] = strtol(ttb, NULL, 10); if (errno == ERANGE || errno == EINVAL || ci->ttb[TTB_BOLDS] < 0) { if (debug) { @@ -152,7 +152,7 @@ int do_kickcmd(User * u) char *percent = strtok(NULL, " "); if (ttb) { - ci->ttb[TTB_CAPS] = strtol(ttb, (char **) NULL, 10); + ci->ttb[TTB_CAPS] = strtol(ttb, NULL, 10); if (errno == ERANGE || errno == EINVAL || ci->ttb[TTB_CAPS] < 0) { if (debug) { @@ -194,7 +194,7 @@ int do_kickcmd(User * u) } else if (!stricmp(option, "COLORS")) { if (!stricmp(value, "ON")) { if (ttb) { - ci->ttb[TTB_COLORS] = strtol(ttb, (char **) NULL, 10); + ci->ttb[TTB_COLORS] = strtol(ttb, NULL, 10); if (errno == ERANGE || errno == EINVAL || ci->ttb[TTB_COLORS] < 0) { if (debug) { @@ -222,7 +222,7 @@ int do_kickcmd(User * u) char *secs = strtok(NULL, " "); if (ttb) { - ci->ttb[TTB_FLOOD] = strtol(ttb, (char **) NULL, 10); + ci->ttb[TTB_FLOOD] = strtol(ttb, NULL, 10); if (errno == ERANGE || errno == EINVAL || ci->ttb[TTB_FLOOD] < 0) { if (debug) { @@ -266,7 +266,7 @@ int do_kickcmd(User * u) char *times = strtok(NULL, " "); if (ttb) { - ci->ttb[TTB_REPEAT] = strtol(ttb, (char **) NULL, 10); + ci->ttb[TTB_REPEAT] = strtol(ttb, NULL, 10); if (errno == ERANGE || errno == EINVAL || ci->ttb[TTB_REPEAT] < 0) { if (debug) { @@ -301,7 +301,7 @@ int do_kickcmd(User * u) if (!stricmp(value, "ON")) { if (ttb) { ci->ttb[TTB_REVERSES] = - strtol(ttb, (char **) NULL, 10); + strtol(ttb, NULL, 10); if (errno == ERANGE || errno == EINVAL || ci->ttb[TTB_REVERSES] < 0) { if (debug) { @@ -327,7 +327,7 @@ int do_kickcmd(User * u) if (!stricmp(value, "ON")) { if (ttb) { ci->ttb[TTB_UNDERLINES] = - strtol(ttb, (char **) NULL, 10); + strtol(ttb, NULL, 10); if (errno == ERANGE || errno == EINVAL || ci->ttb[TTB_UNDERLINES] < 0) { if (debug) { diff --git a/src/core/cs_access.c b/src/core/cs_access.c index 486c482e4..604761d82 100644 --- a/src/core/cs_access.c +++ b/src/core/cs_access.c @@ -232,8 +232,8 @@ int do_access(User * u) if (i < CSAccessMax) { ci->accesscount++; ci->access = - (ChanAccess *)srealloc(ci->access, - sizeof(ChanAccess) * ci->accesscount); + static_cast<ChanAccess *>(srealloc(ci->access, + sizeof(ChanAccess) * ci->accesscount)); } else { notice_lang(s_ChanServ, u, CHAN_ACCESS_REACHED_LIMIT, CSAccessMax); @@ -346,7 +346,7 @@ int do_access(User * u) ci->accesscount--; } ci->access = - (ChanAccess *)srealloc(ci->access,sizeof(ChanAccess) * ci->accesscount); + static_cast<ChanAccess *>(srealloc(ci->access,sizeof(ChanAccess) * ci->accesscount)); /* We don't know the nick if someone used numbers, so we trigger the event without * nick param. We just do this once, even if someone enters a range. -Certus */ diff --git a/src/core/cs_akick.c b/src/core/cs_akick.c index df4bd69f5..cc90381d9 100644 --- a/src/core/cs_akick.c +++ b/src/core/cs_akick.c @@ -299,7 +299,7 @@ int do_akick(User * u) } ci->akickcount++; ci->akick = - (AutoKick *)srealloc(ci->akick, sizeof(AutoKick) * ci->akickcount); + static_cast<AutoKick *>(srealloc(ci->akick, sizeof(AutoKick) * ci->akickcount)); akick = &ci->akick[i]; akick->flags = AK_USED; if (nc) { @@ -518,7 +518,7 @@ int do_akick(User * u) ci->akickcount--; } ci->akick = - (AutoKick *)srealloc(ci->akick,sizeof(AutoKick) * ci->akickcount); + static_cast<AutoKick *>(srealloc(ci->akick,sizeof(AutoKick) * ci->akickcount)); } } else if (stricmp(cmd, "LIST") == 0) { int sent_header = 0; diff --git a/src/core/cs_ban.c b/src/core/cs_ban.c index 4f8db1fd0..77e1b0b9b 100644 --- a/src/core/cs_ban.c +++ b/src/core/cs_ban.c @@ -68,7 +68,7 @@ int do_ban(User * u) int is_same; if (!reason) { - reason = (char *)"Requested"; // XXX unsafe cast -- w00t + reason = const_cast<char *>("Requested"); // XXX unsafe cast -- w00t } else { if (strlen(reason) > 200) reason[200] = '\0'; diff --git a/src/core/cs_clear.c b/src/core/cs_clear.c index 3d2e13fdf..683468f58 100644 --- a/src/core/cs_clear.c +++ b/src/core/cs_clear.c @@ -185,7 +185,7 @@ int do_clear(User * u) ircd->adminunset+1 : ""), (isown ? ircd->ownerunset+1 : "")); if (ircdcap->tsmode) { - snprintf(buf, BUFSIZE - 1, "%ld", (long int) time(NULL)); + snprintf(buf, BUFSIZE - 1, "%ld", static_cast<long>(time(NULL))); av[1] = buf; av[2] = tmp; /* We have to give as much nicks as modes.. - Viper */ @@ -221,7 +221,7 @@ int do_clear(User * u) (isadmin ? cu->user->nick : ""), (isown ? cu->user->nick : "")); if (ircdcap->tsmode) { - snprintf(buf, BUFSIZE - 1, "%ld", (long int) time(NULL)); + snprintf(buf, BUFSIZE - 1, "%ld", static_cast<long>(time(NULL))); av[1] = buf; av[2] = tmp; /* We have to give as much nicks as modes.. - Viper */ @@ -256,7 +256,7 @@ int do_clear(User * u) continue; if (ircdcap->tsmode) { - snprintf(buf, BUFSIZE - 1, "%ld", (long int) time(NULL)); + snprintf(buf, BUFSIZE - 1, "%ld", static_cast<long>(time(NULL))); av[0] = chan; av[1] = buf; av[2] = "-h"; @@ -300,7 +300,7 @@ int do_clear(User * u) continue; if (ircdcap->tsmode) { - snprintf(buf, BUFSIZE - 1, "%ld", (long int) time(NULL)); + snprintf(buf, BUFSIZE - 1, "%ld", static_cast<long int>(time(NULL))); av[0] = chan; av[1] = buf; av[2] = "-v"; diff --git a/src/core/cs_set.c b/src/core/cs_set.c index f6ed8611b..2861222fa 100644 --- a/src/core/cs_set.c +++ b/src/core/cs_set.c @@ -56,7 +56,7 @@ class CSSet : public Module c = createCommand("SET FOUNDER", NULL, NULL, CHAN_HELP_SET_FOUNDER, -1, -1, -1, -1); this->AddCommand(CHANSERV, c, MOD_UNIQUE); c = createCommand("SET SUCCESSOR", NULL, NULL, CHAN_HELP_SET_SUCCESSOR, -1, -1, -1, -1); - c->help_param1 = (char *) (long) CSMaxReg; + c->help_param1 = reinterpret_cast<char *>(static_cast<long>(CSMaxReg)); this->AddCommand(CHANSERV, c, MOD_UNIQUE); c = createCommand("SET PASSWORD", NULL, NULL, CHAN_HELP_SET_PASSWORD, -1, -1, -1, -1); this->AddCommand(CHANSERV, c, MOD_UNIQUE); @@ -470,7 +470,7 @@ int do_set_mlock(User * u, ChannelInfo * ci, char *param) continue; } - if ((int) mode < 128 && (cbm = &cbmodes[(int) mode])->flag != 0) { + if (static_cast<int>(mode) < 128 && (cbm = &cbmodes[static_cast<int>(mode)])->flag != 0) { if ((cbm->flags & CBM_NO_MLOCK) || ((cbm->flags & CBM_NO_USER_MLOCK) && !is_oper(u))) { notice_lang(s_ChanServ, u, CHAN_SET_MLOCK_IMPOSSIBLE_CHAR, diff --git a/src/core/cs_xop.c b/src/core/cs_xop.c index a757f7968..e7d73d5c7 100644 --- a/src/core/cs_xop.c +++ b/src/core/cs_xop.c @@ -301,8 +301,8 @@ int do_xop(User * u, const char *xname, int xlev, int *xmsgs) if (i < CSAccessMax) { ci->accesscount++; ci->access = - (ChanAccess *)srealloc(ci->access, - sizeof(ChanAccess) * ci->accesscount); + static_cast<ChanAccess *>(srealloc(ci->access, + sizeof(ChanAccess) * ci->accesscount)); } else { notice_lang(s_ChanServ, u, CHAN_XOP_REACHED_LIMIT, CSAccessMax); @@ -434,7 +434,7 @@ int do_xop(User * u, const char *xname, int xlev, int *xmsgs) ci->accesscount--; } ci->access = - (ChanAccess *)srealloc(ci->access,sizeof(ChanAccess) * ci->accesscount); + static_cast<ChanAccess *>(srealloc(ci->access,sizeof(ChanAccess) * ci->accesscount)); } } else if (stricmp(cmd, "LIST") == 0) { int sent_header = 0; diff --git a/src/core/hs_delall.c b/src/core/hs_delall.c index c950afe60..ea6b35e62 100644 --- a/src/core/hs_delall.c +++ b/src/core/hs_delall.c @@ -6,8 +6,8 @@ * Please read COPYING and README for further details. * * Based on the original code of Epona by Lara. - * Based on the original code of Services by Andy Church. - * + * Based on the original code of Services by Andy Church. + * * $Id$ * */ @@ -72,7 +72,7 @@ int do_delall(User * u) } nc = na->nc; for (i = 0; i < nc->aliases.count; i++) { - na = (NickAlias *)nc->aliases.list[i]; + na = static_cast<NickAlias *>(nc->aliases.list[i]); delHostCore(na->nick); } alog("vHosts for all nicks in group \002%s\002 deleted by oper \002%s\002", nc->display, u->nick); diff --git a/src/core/hs_setall.c b/src/core/hs_setall.c index 10555d7b7..1e865cb58 100644 --- a/src/core/hs_setall.c +++ b/src/core/hs_setall.c @@ -57,7 +57,7 @@ void myHostServHelp(User * u) **/ int do_setall(User * u) { - char *nick = (char *)strtok(NULL, " "); + char *nick = strtok(NULL, " "); char *rawhostmask = strtok(NULL, " "); char *hostmask = new char[HOSTMAX]; diff --git a/src/core/ms_set.c b/src/core/ms_set.c index a4aebd3e0..f3d00bf8d 100644 --- a/src/core/ms_set.c +++ b/src/core/ms_set.c @@ -6,8 +6,8 @@ * Please read COPYING and README for further details. * * Based on the original code of Epona by Lara. - * Based on the original code of Services by Andy Church. - * + * Based on the original code of Services by Andy Church. + * * $Id$ * */ @@ -38,7 +38,7 @@ class MSSet : public Module this->AddCommand(MEMOSERV, c, MOD_UNIQUE); c = createCommand("SET LIMIT", NULL, NULL, -1, MEMO_HELP_SET_LIMIT, MEMO_SERVADMIN_HELP_SET_LIMIT, MEMO_SERVADMIN_HELP_SET_LIMIT, MEMO_SERVADMIN_HELP_SET_LIMIT); - c->help_param1 = (char *) (long) MSMaxMemos; + c->help_param1 = reinterpret_cast<char *>(static_cast<long>(MSMaxMemos)); this->AddCommand(MEMOSERV, c, MOD_UNIQUE); moduleSetMemoHelp(myMemoServHelp); diff --git a/src/core/ns_access.c b/src/core/ns_access.c index c4409928d..7fb6ab79b 100644 --- a/src/core/ns_access.c +++ b/src/core/ns_access.c @@ -125,7 +125,7 @@ int do_access(User * u) na->nc->accesscount++; na->nc->access = - (char **)srealloc(na->nc->access, sizeof(char *) * na->nc->accesscount); + static_cast<char **>(srealloc(na->nc->access, sizeof(char *) * na->nc->accesscount)); na->nc->access[na->nc->accesscount - 1] = sstrdup(mask); notice_lang(s_NickServ, u, NICK_ACCESS_ADDED, mask); @@ -149,8 +149,8 @@ int do_access(User * u) (na->nc->accesscount - i) * sizeof(char *)); if (na->nc->accesscount) /* if there are any entries left... */ na->nc->access = - (char **)srealloc(na->nc->access, - na->nc->accesscount * sizeof(char *)); + static_cast<char **>(srealloc(na->nc->access, + na->nc->accesscount * sizeof(char *))); else { free(na->nc->access); na->nc->access = NULL; diff --git a/src/core/ns_group.c b/src/core/ns_group.c index c40d961ac..10cb9fee8 100644 --- a/src/core/ns_group.c +++ b/src/core/ns_group.c @@ -104,14 +104,14 @@ int do_group(User * u) return MOD_CONT; } } - for (i = 0; i < servadmins.count && (nc = (NickCore *)servadmins.list[i]); i++) { + for (i = 0; i < servadmins.count && (nc = static_cast<NickCore *>(servadmins.list[i])); i++) { if (stristr(u->nick, nc->display) && !is_oper(u)) { notice_lang(s_NickServ, u, NICK_CANNOT_BE_REGISTERED, u->nick); return MOD_CONT; } } - for (i = 0; i < servopers.count && (nc = (NickCore *)servopers.list[i]); i++) { + for (i = 0; i < servopers.count && (nc = static_cast<NickCore *>(servopers.list[i])); i++) { if (stristr(u->nick, nc->display) && !is_oper(u)) { notice_lang(s_NickServ, u, NICK_CANNOT_BE_REGISTERED, u->nick); @@ -182,7 +182,7 @@ int do_group(User * u) common_get_vhost(u)); na->last_realname = sstrdup(u->realname); na->time_registered = na->last_seen = time(NULL); - na->status = (int16) (NS_IDENTIFIED | NS_RECOGNIZED); + na->status = static_cast<int16>(NS_IDENTIFIED | NS_RECOGNIZED); if (!(na->nc->flags & NI_SERVICES_ROOT)) { for (i = 0; i < RootNumber; i++) { @@ -202,7 +202,7 @@ int do_group(User * u) u->lastnickreg = time(NULL); snprintf(tsbuf, sizeof(tsbuf), "%lu", - (unsigned long int) u->timestamp); + static_cast<unsigned long>(u->timestamp)); if (ircd->modeonreg) { len = strlen(ircd->modeonreg); strncpy(modes,ircd->modeonreg,512); @@ -282,7 +282,7 @@ int do_glist(User * u) nick ? NICK_GLIST_HEADER_X : NICK_GLIST_HEADER, na->nc->display); for (i = 0; i < na->nc->aliases.count; i++) { - na2 = (NickAlias *)na->nc->aliases.list[i]; + na2 = static_cast<NickAlias *>(na->nc->aliases.list[i]); if (na2->nc == na->nc) { if (!(wont_expire = na2->status & NS_NO_EXPIRE)) { expt = na2->last_seen + NSExpire; diff --git a/src/core/ns_identify.c b/src/core/ns_identify.c index ee328ef19..19fc791bf 100644 --- a/src/core/ns_identify.c +++ b/src/core/ns_identify.c @@ -105,7 +105,7 @@ int do_identify(User * u) na->status |= NS_IDENTIFIED; na->last_seen = time(NULL); snprintf(tsbuf, sizeof(tsbuf), "%lu", - (unsigned long int) u->timestamp); + static_cast<unsigned long>(u->timestamp)); if (ircd->modeonreg) { len = strlen(ircd->modeonreg); diff --git a/src/core/ns_register.c b/src/core/ns_register.c index 692c21531..bb2e2d741 100644 --- a/src/core/ns_register.c +++ b/src/core/ns_register.c @@ -133,14 +133,14 @@ int do_register(User * u) return MOD_CONT; } } - for (i = 0; i < servadmins.count && (nc = (NickCore *)servadmins.list[i]); i++) { + for (i = 0; i < servadmins.count && (nc = static_cast<NickCore *>(servadmins.list[i])); i++) { if (stristr(u->nick, nc->display) && !is_oper(u)) { notice_lang(s_NickServ, u, NICK_CANNOT_BE_REGISTERED, u->nick); return MOD_CONT; } } - for (i = 0; i < servopers.count && (nc = (NickCore *)servopers.list[i]); i++) { + for (i = 0; i < servopers.count && (nc = static_cast<NickCore *>(servopers.list[i])); i++) { if (stristr(u->nick, nc->display) && !is_oper(u)) { notice_lang(s_NickServ, u, NICK_CANNOT_BE_REGISTERED, u->nick); @@ -180,7 +180,7 @@ int do_register(User * u) for (idx = 0; idx < 9; idx++) { passcode[idx] = chars[(1 + - (int) (((float) (max - min)) * getrandom16() / + static_cast<int>((static_cast<float>(max - min)) * getrandom16() / (65535 + 1.0)) + min)]; } passcode[idx] = '\0'; nr = makerequest(u->nick); @@ -301,7 +301,7 @@ int do_confirm(User * u) char tmp_pass[PASSMAX]; memcpy(na->nc->pass, nr->password, PASSMAX); - na->status = (int16) (NS_IDENTIFIED | NS_RECOGNIZED); + na->status = static_cast<int16>(NS_IDENTIFIED | NS_RECOGNIZED); /* na->nc->flags |= NI_ENCRYPTEDPW; */ na->nc->flags |= NSDefFlags; @@ -326,7 +326,7 @@ int do_confirm(User * u) na->time_registered = na->last_seen = time(NULL); if (NSAddAccessOnReg) { na->nc->accesscount = 1; - na->nc->access = (char **)scalloc(sizeof(char *), 1); + na->nc->access = static_cast<char **>(scalloc(sizeof(char *), 1)); na->nc->access[0] = create_mask(u); } else { na->nc->accesscount = 0; @@ -365,7 +365,7 @@ int do_confirm(User * u) if (ircd->tsonmode) { snprintf(tsbuf, sizeof(tsbuf), "%lu", - (unsigned long int) u->timestamp); + static_cast<unsigned long>(u->timestamp)); common_svsmode(u, modes, tsbuf); } else { common_svsmode(u, modes, NULL); diff --git a/src/core/ns_saset.c b/src/core/ns_saset.c index 54fb2fc0f..4bc2eab66 100644 --- a/src/core/ns_saset.c +++ b/src/core/ns_saset.c @@ -170,7 +170,7 @@ int do_saset_display(User * u, NickCore * nc, char *param) /* First check whether param is a valid nick of the group */ for (i = 0; i < nc->aliases.count; i++) { - na = (NickAlias *)nc->aliases.list[i]; + na = static_cast<NickAlias *>(nc->aliases.list[i]); if (stricmp(na->nick, param) == 0) { param = na->nick; /* Because case may differ */ break; diff --git a/src/core/ns_set.c b/src/core/ns_set.c index 4267f46b2..221743603 100644 --- a/src/core/ns_set.c +++ b/src/core/ns_set.c @@ -154,7 +154,7 @@ int do_set_display(User * u, NickCore * nc, char *param) /* First check whether param is a valid nick of the group */ for (i = 0; i < nc->aliases.count; i++) { - na = (NickAlias *)nc->aliases.list[i]; + na = static_cast<NickAlias *>(nc->aliases.list[i]); if (!stricmp(na->nick, param)) { param = na->nick; /* Because case may differ */ break; diff --git a/src/core/os_admin.c b/src/core/os_admin.c index d7e8c3c75..21905e3b5 100644 --- a/src/core/os_admin.c +++ b/src/core/os_admin.c @@ -6,8 +6,8 @@ * Please read COPYING and README for further details. * * Based on the original code of Epona by Lara. - * Based on the original code of Services by Andy Church. - * + * Based on the original code of Services by Andy Church. + * * $Id$ * */ @@ -154,7 +154,7 @@ int do_admin(User * u) notice_lang(s_OperServ, u, READ_ONLY_MODE); } else if (!stricmp(cmd, "LIST")) { int sent_header = 0; - + if (servadmins.count == 0) { notice_lang(s_OperServ, u, OPER_ADMIN_LIST_EMPTY); return MOD_CONT; @@ -176,11 +176,11 @@ int do_admin(User * u) for (i = 0; i < servadmins.count; i++) if (!stricmp - (nick, ((NickCore *) servadmins.list[i])->display) + (nick, (static_cast<NickCore *>(servadmins.list[i]))->display) || match_wild_nocase(nick, - ((NickCore *) servadmins. - list[i])->display)) - admin_list(i + 1, (NickCore *)servadmins.list[i], u, &sent_header); + (static_cast<NickCore *>(servadmins. + list[i]))->display)) + admin_list(i + 1, static_cast<NickCore *>(servadmins.list[i]), u, &sent_header); if (!sent_header) notice_lang(s_OperServ, u, OPER_ADMIN_NO_MATCH); @@ -213,7 +213,7 @@ int admin_list_callback(SList * slist, int number, void *item, User *u = va_arg(args, User *); int *sent_header = va_arg(args, int *); - return admin_list(number, (NickCore *)item, u, sent_header); + return admin_list(number, static_cast<NickCore *>(item), u, sent_header); } int admin_list(int number, NickCore * nc, User * u, int *sent_header) diff --git a/src/core/os_akill.c b/src/core/os_akill.c index a85c50cb1..c2c6a2d64 100644 --- a/src/core/os_akill.c +++ b/src/core/os_akill.c @@ -249,11 +249,11 @@ int do_akill(User * u) for (i = 0; i < akills.count; i++) { snprintf(amask, sizeof(amask), "%s@%s", - ((Akill *) akills.list[i])->user, - ((Akill *) akills.list[i])->host); + (static_cast<Akill *>(akills.list[i]))->user, + (static_cast<Akill *>(akills.list[i]))->host); if (!stricmp(mask, amask) || match_wild_nocase(mask, amask)) - akill_list(i + 1, (Akill *)akills.list[i], u, &sent_header); + akill_list(i + 1, static_cast<Akill *>(akills.list[i]), u, &sent_header); } if (!sent_header) @@ -288,11 +288,11 @@ int do_akill(User * u) for (i = 0; i < akills.count; i++) { snprintf(amask, sizeof(amask), "%s@%s", - ((Akill *) akills.list[i])->user, - ((Akill *) akills.list[i])->host); + (static_cast<Akill *>(akills.list[i]))->user, + (static_cast<Akill *>(akills.list[i]))->host); if (!stricmp(mask, amask) || match_wild_nocase(mask, amask)) - akill_view(i + 1, (Akill *)akills.list[i], u, &sent_header); + akill_view(i + 1, static_cast<Akill *>(akills.list[i]), u, &sent_header); } if (!sent_header) @@ -340,7 +340,7 @@ int akill_list_callback(SList * slist, int number, void *item, User *u = va_arg(args, User *); int *sent_header = va_arg(args, int *); - return akill_list(number, (Akill *)item, u, sent_header); + return akill_list(number, static_cast<Akill *>(item), u, sent_header); } /* Callback for enumeration purposes */ @@ -351,7 +351,7 @@ int akill_view_callback(SList * slist, int number, void *item, User *u = va_arg(args, User *); int *sent_header = va_arg(args, int *); - return akill_view(number, (Akill *)item, u, sent_header); + return akill_view(number, static_cast<Akill *>(item), u, sent_header); } /* Lists an AKILL entry, prefixing it with the header if needed */ diff --git a/src/core/os_oper.c b/src/core/os_oper.c index f93dab779..6586ceae7 100644 --- a/src/core/os_oper.c +++ b/src/core/os_oper.c @@ -6,8 +6,8 @@ * Please read COPYING and README for further details. * * Based on the original code of Epona by Lara. - * Based on the original code of Services by Andy Church. - * + * Based on the original code of Services by Andy Church. + * * $Id$ * */ @@ -154,7 +154,7 @@ int do_oper(User * u) notice_lang(s_OperServ, u, PERMISSION_DENIED); return MOD_CONT; } - + if (servopers.count == 0) { notice_lang(s_OperServ, u, OPER_OPER_LIST_EMPTY); return MOD_CONT; @@ -176,11 +176,11 @@ int do_oper(User * u) for (i = 0; i < servopers.count; i++) if (!stricmp - (nick, ((NickCore *) servopers.list[i])->display) + (nick, (static_cast<NickCore *>(servopers.list[i]))->display) || match_wild_nocase(nick, - ((NickCore *) servopers.list[i])-> + (static_cast<NickCore *>(servopers.list[i]))-> display)) - oper_list(i + 1, (NickCore *)servopers.list[i], u, &sent_header); + oper_list(i + 1, static_cast<NickCore *>(servopers.list[i]), u, &sent_header); if (!sent_header) notice_lang(s_OperServ, u, OPER_OPER_NO_MATCH); @@ -230,7 +230,7 @@ int oper_list_callback(SList * slist, int number, void *item, va_list args) User *u = va_arg(args, User *); int *sent_header = va_arg(args, int *); - return oper_list(number, (NickCore *)item, u, sent_header); + return oper_list(number, static_cast<NickCore *>(item), u, sent_header); } MODULE_INIT("os_oper", OSOper) diff --git a/src/core/os_quit.c b/src/core/os_quit.c index a06bb6966..9ae6b05be 100644 --- a/src/core/os_quit.c +++ b/src/core/os_quit.c @@ -59,7 +59,7 @@ int do_os_quit(User * u) if (!quitmsg) quitmsg = "QUIT command received, but out of memory!"; else - sprintf((char *)quitmsg, "QUIT command received from %s", u->nick); // XXX we know this is safe, but.. + sprintf(const_cast<char *>(quitmsg), "QUIT command received from %s", u->nick); // XXX we know this is safe, but.. if (GlobalOnCycle) { oper_global(NULL, "%s", GlobalOnCycleMessage); diff --git a/src/core/os_reload.c b/src/core/os_reload.c index 9e4495ec4..e31c1207c 100644 --- a/src/core/os_reload.c +++ b/src/core/os_reload.c @@ -61,7 +61,7 @@ int do_reload(User * u) quitmsg = "Error during the reload of the configuration file, but out of memory!"; else - sprintf((char *)quitmsg, /* XXX */ + sprintf(const_cast<char *>(quitmsg), /* XXX */ "Error during the reload of the configuration file!"); quitting = 1; } diff --git a/src/core/os_restart.c b/src/core/os_restart.c index fe0f8ddb7..537db5d3a 100644 --- a/src/core/os_restart.c +++ b/src/core/os_restart.c @@ -64,7 +64,7 @@ int do_restart(User * u) if (!quitmsg) quitmsg = "RESTART command received, but out of memory!"; else - sprintf((char *)quitmsg, /* XXX */ "RESTART command received from %s", u->nick); + sprintf(const_cast<char *>(quitmsg), /* XXX */ "RESTART command received from %s", u->nick); if (GlobalOnCycle) { oper_global(NULL, "%s", GlobalOnCycleMessage); diff --git a/src/core/os_sgline.c b/src/core/os_sgline.c index 49aa459fe..934a8abf5 100644 --- a/src/core/os_sgline.c +++ b/src/core/os_sgline.c @@ -229,10 +229,10 @@ int do_sgline(User * u) char *amask; for (i = 0; i < sglines.count; i++) { - amask = ((SXLine *) sglines.list[i])->mask; + amask = (static_cast<SXLine *>(sglines.list[i]))->mask; if (!stricmp(mask, amask) || match_wild_nocase(mask, amask)) - sgline_list(i + 1, (SXLine *)sglines.list[i], u, &sent_header); + sgline_list(i + 1, static_cast<SXLine *>(sglines.list[i]), u, &sent_header); } if (!sent_header) @@ -266,10 +266,10 @@ int do_sgline(User * u) char *amask; for (i = 0; i < sglines.count; i++) { - amask = ((SXLine *) sglines.list[i])->mask; + amask = (static_cast<SXLine *>(sglines.list[i]))->mask; if (!stricmp(mask, amask) || match_wild_nocase(mask, amask)) - sgline_view(i + 1, (SXLine *)sglines.list[i], u, &sent_header); + sgline_view(i + 1, static_cast<SXLine *>(sglines.list[i]), u, &sent_header); } if (!sent_header) @@ -317,7 +317,7 @@ int sgline_view_callback(SList * slist, int number, void *item, User *u = va_arg(args, User *); int *sent_header = va_arg(args, int *); - return sgline_view(number, (SXLine *)item, u, sent_header); + return sgline_view(number, static_cast<SXLine *>(item), u, sent_header); } /* Lists an SGLINE entry, prefixing it with the header if needed */ @@ -346,7 +346,7 @@ int sgline_ |
