summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNaram Qashat <cyberbotx@cyberbotx.com>2010-07-28 00:28:59 -0400
committerNaram Qashat <cyberbotx@cyberbotx.com>2010-07-28 00:28:59 -0400
commitaa9610a56ff18edd0703a3f391c90e1f8a761476 (patch)
tree5fceef5b811ffcb28bcea093b59604b94a2a89c1
parent4700c9626861b193798b3cf3d53fb89a913c5819 (diff)
parenta2573a2c3067343ebf46292691671ba4bad855a8 (diff)
Merge branch '1.9' of ssh://anope.git.sf.net/gitroot/anope/anope into 1.9
-rw-r--r--CMakeLists.txt5
-rw-r--r--docs/C++CASTING5
-rw-r--r--include/extensible.h6
-rw-r--r--include/services.h18
-rw-r--r--include/sysconf.h.cmake2
-rw-r--r--modules/core/cs_saset_noexpire.cpp3
-rw-r--r--modules/core/cs_set_bantype.cpp3
-rw-r--r--modules/core/cs_set_description.cpp3
-rw-r--r--modules/core/cs_set_entrymsg.cpp3
-rw-r--r--modules/core/cs_set_founder.cpp3
-rw-r--r--modules/core/cs_set_keeptopic.cpp3
-rw-r--r--modules/core/cs_set_mlock.cpp5
-rw-r--r--modules/core/cs_set_opnotice.cpp3
-rw-r--r--modules/core/cs_set_peace.cpp3
-rw-r--r--modules/core/cs_set_persist.cpp3
-rw-r--r--modules/core/cs_set_private.cpp3
-rw-r--r--modules/core/cs_set_restricted.cpp3
-rw-r--r--modules/core/cs_set_secure.cpp3
-rw-r--r--modules/core/cs_set_securefounder.cpp3
-rw-r--r--modules/core/cs_set_secureops.cpp3
-rw-r--r--modules/core/cs_set_signkick.cpp3
-rw-r--r--modules/core/cs_set_successor.cpp3
-rw-r--r--modules/core/cs_set_topiclock.cpp3
-rw-r--r--modules/core/cs_set_xop.cpp3
-rw-r--r--modules/core/db_plain.cpp6
-rw-r--r--modules/core/ns_saset.cpp6
-rw-r--r--modules/core/ns_saset_noexpire.cpp3
-rw-r--r--modules/core/ns_set_autoop.cpp3
-rw-r--r--modules/core/ns_set_email.cpp3
-rw-r--r--modules/core/ns_set_greet.cpp3
-rw-r--r--modules/core/ns_set_hide.cpp3
-rw-r--r--modules/core/ns_set_kill.cpp3
-rw-r--r--modules/core/ns_set_language.cpp3
-rw-r--r--modules/core/ns_set_message.cpp3
-rw-r--r--modules/core/ns_set_private.cpp3
-rw-r--r--modules/core/ns_set_secure.cpp3
-rw-r--r--modules/core/os_defcon.cpp2
-rw-r--r--modules/extra/cs_set_misc.cpp3
-rw-r--r--modules/extra/mysql/db_mysql_write.cpp4
-rw-r--r--modules/extra/ns_set_misc.cpp3
-rw-r--r--modules/protocol/bahamut.cpp2
-rw-r--r--modules/protocol/inspircd11.cpp2
-rw-r--r--modules/protocol/inspircd12.cpp2
-rw-r--r--modules/protocol/inspircd20.cpp2
-rw-r--r--modules/protocol/ratbox.cpp8
-rw-r--r--modules/protocol/unreal32.cpp8
-rw-r--r--src/channels.cpp26
-rw-r--r--src/chanserv.cpp4
-rw-r--r--src/config.cpp24
-rw-r--r--src/modes.cpp4
-rw-r--r--src/regchannel.cpp6
51 files changed, 149 insertions, 88 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 795d04b09..81be03bd3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -309,6 +309,11 @@ if(NOT DEFUMASK)
endif(RUNGROUP)
endif(NOT DEFUMASK)
+# Set the DEBUG_BUILD for sysconf.h
+if(CMAKE_BUILD_TYPE STREQUAL "DEBUG" OR CMAKE_BUILD_TYPE STREQUAL "RELWITHDEBINFO")
+ set(DEBUG_BUILD TRUE)
+endif(CMAKE_BUILD_TYPE STREQUAL "DEBUG" OR CMAKE_BUILD_TYPE STREQUAL "RELWITHDEBINFO")
+
# Check for the existance of the following include files
check_include_file(sys/types.h HAVE_SYS_TYPES_H)
check_include_file(strings.h HAVE_STRINGS_H)
diff --git a/docs/C++CASTING b/docs/C++CASTING
index 5a121a5d1..bae24a24c 100644
--- a/docs/C++CASTING
+++ b/docs/C++CASTING
@@ -78,6 +78,11 @@ This is safer than C-style casting in that an invalid pointer conversion will
return a NULL pointer, and an invalid reference conversion will throw a
Bad_cast exception.
+Note that in Anope we prefer if Anope::debug_cast is used.
+This uses dynamic_cast (and checks for a NULL pointer return) on debug builds
+and static_cast on release builds, to speed up the program beacuse of dynamic_cast's
+reliance on RTTI.
+
reinterpret_cast
----------------
diff --git a/include/extensible.h b/include/extensible.h
index 523a25b6d..5ab32c6eb 100644
--- a/include/extensible.h
+++ b/include/extensible.h
@@ -153,7 +153,7 @@ class CoreExport Extensible
if (it != this->Extension_Items.end())
{
- p = dynamic_cast<ExtensibleItemRegular<T> *>(it->second)->GetItem();
+ p = debug_cast<ExtensibleItemRegular<T> *>(it->second)->GetItem();
return true;
}
@@ -172,7 +172,7 @@ class CoreExport Extensible
if (it != this->Extension_Items.end())
{
- p = dynamic_cast<ExtensibleItemPointer<T> *>(it->second)->GetItem();
+ p = debug_cast<ExtensibleItemPointer<T> *>(it->second)->GetItem();
return true;
}
@@ -192,7 +192,7 @@ class CoreExport Extensible
if (it != this->Extension_Items.end())
{
- p = dynamic_cast<ExtensibleItemPointerArray<T> *>(it->second)->GetItem();
+ p = debug_cast<ExtensibleItemPointerArray<T> *>(it->second)->GetItem();
return true;
}
diff --git a/include/services.h b/include/services.h
index 16f365a09..fdbaccbfc 100644
--- a/include/services.h
+++ b/include/services.h
@@ -39,8 +39,8 @@
#include <sys/stat.h> /* for umask() on some systems */
#include <sys/types.h>
-#include <assert.h>
#include <fcntl.h>
+#include <typeinfo>
#ifndef _WIN32
# include <unistd.h>
@@ -268,6 +268,22 @@ class DatabaseException : public CoreException
virtual ~DatabaseException() throw() { }
};
+/** Debug cast to be used instead of dynamic_cast, this uses dynamic_cast
+ * for debug builds and static_cast on releass builds to speed up the program
+ * because dynamic_cast relies on RTTI.
+ */
+template<typename T, typename O> inline T debug_cast(O ptr)
+{
+#ifdef DEBUG_BUILD
+ T ret = dynamic_cast<T>(ptr);
+ if (ret == NULL)
+ throw CoreException(Anope::string("debug_cast<") + typeid(T).name() + ">(" + typeid(O).name() + ") fail");
+ return ret;
+#else
+ return static_cast<T>(ptr);
+#endif
+}
+
/*************************************************************************/
/** Class with the ability to keep flags on items, they should extend from this
diff --git a/include/sysconf.h.cmake b/include/sysconf.h.cmake
index 5884a3284..0184c5359 100644
--- a/include/sysconf.h.cmake
+++ b/include/sysconf.h.cmake
@@ -1,6 +1,8 @@
#ifndef _SYSCONF_H_
#define _SYSCONF_H_
+#cmakedefine DEBUG_BUILD
+
#cmakedefine DEFUMASK @DEFUMASK@
#cmakedefine HAVE_SYS_TYPES_H 1
#cmakedefine HAVE_STDINT_H 1
diff --git a/modules/core/cs_saset_noexpire.cpp b/modules/core/cs_saset_noexpire.cpp
index dd485bb40..a89f30c36 100644
--- a/modules/core/cs_saset_noexpire.cpp
+++ b/modules/core/cs_saset_noexpire.cpp
@@ -23,7 +23,8 @@ class CommandCSSASetNoexpire : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
ChannelInfo *ci = cs_findchan(params[0]);
- assert(ci);
+ if (!ci)
+ throw CoreException("NULL ci in CommandCSSASetNoexpire");
if (params[1].equals_ci("ON"))
{
diff --git a/modules/core/cs_set_bantype.cpp b/modules/core/cs_set_bantype.cpp
index 3c7e1c11a..90041c7e6 100644
--- a/modules/core/cs_set_bantype.cpp
+++ b/modules/core/cs_set_bantype.cpp
@@ -23,7 +23,8 @@ class CommandCSSetBanType : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
ChannelInfo *ci = cs_findchan(params[0]);
- assert(ci);
+ if (!ci)
+ throw CoreException("NULL ci in CommandCSSetBanType");
Anope::string end;
diff --git a/modules/core/cs_set_description.cpp b/modules/core/cs_set_description.cpp
index 82260df63..9186b55ab 100644
--- a/modules/core/cs_set_description.cpp
+++ b/modules/core/cs_set_description.cpp
@@ -23,7 +23,8 @@ class CommandCSSetDescription : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
ChannelInfo *ci = cs_findchan(params[0]);
- assert(ci);
+ if (!ci)
+ throw CoreException("NULL ci in CommandCSSetDescription");
ci->desc = params[1];
diff --git a/modules/core/cs_set_entrymsg.cpp b/modules/core/cs_set_entrymsg.cpp
index 9784773e4..362a5eea3 100644
--- a/modules/core/cs_set_entrymsg.cpp
+++ b/modules/core/cs_set_entrymsg.cpp
@@ -23,7 +23,8 @@ class CommandCSSetEntryMsg : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
ChannelInfo *ci = cs_findchan(params[0]);
- assert(ci);
+ if (!ci)
+ throw CoreException("NULL ci in CommandCSSetEntryMsg");
if (params.size() > 1)
{
diff --git a/modules/core/cs_set_founder.cpp b/modules/core/cs_set_founder.cpp
index 3982764cc..4fb83a9ec 100644
--- a/modules/core/cs_set_founder.cpp
+++ b/modules/core/cs_set_founder.cpp
@@ -23,7 +23,8 @@ class CommandCSSetFounder : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
ChannelInfo *ci = cs_findchan(params[0]);
- assert(ci);
+ if (!ci)
+ throw CoreException("NULL ci in CommandCSSetFounder");
if (this->permission.empty() && (ci->HasFlag(CI_SECUREFOUNDER) ? !IsFounder(u, ci) : !check_access(u, ci, CA_FOUNDER)))
{
diff --git a/modules/core/cs_set_keeptopic.cpp b/modules/core/cs_set_keeptopic.cpp
index 5eb907dbd..28a6cd550 100644
--- a/modules/core/cs_set_keeptopic.cpp
+++ b/modules/core/cs_set_keeptopic.cpp
@@ -23,7 +23,8 @@ class CommandCSSetKeepTopic : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
ChannelInfo *ci = cs_findchan(params[0]);
- assert(ci);
+ if (!ci)
+ throw CoreException("NULL ci in CommandCSSetKeepTopic");
if (params[1].equals_ci("ON"))
{
diff --git a/modules/core/cs_set_mlock.cpp b/modules/core/cs_set_mlock.cpp
index 2dc1ef2a7..ec41913b9 100644
--- a/modules/core/cs_set_mlock.cpp
+++ b/modules/core/cs_set_mlock.cpp
@@ -23,7 +23,8 @@ class CommandCSSetMLock : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
ChannelInfo *ci = cs_findchan(params[0]);
- assert(ci);
+ if (!ci)
+ throw CoreException("NULL ci in CommandCSSetMLock");
int add = -1; /* 1 if adding, 0 if deleting, -1 if neither */
ChannelMode *cm;
@@ -66,7 +67,7 @@ class CommandCSSetMLock : public Command
Anope::string param = params[paramcount];
- ChannelModeParam *cmp = dynamic_cast<ChannelModeParam *>(cm);
+ ChannelModeParam *cmp = debug_cast<ChannelModeParam *>(cm);
if (!cmp || !cmp->IsValid(param))
continue;
diff --git a/modules/core/cs_set_opnotice.cpp b/modules/core/cs_set_opnotice.cpp
index a0d0a2ec8..2b835451c 100644
--- a/modules/core/cs_set_opnotice.cpp
+++ b/modules/core/cs_set_opnotice.cpp
@@ -23,7 +23,8 @@ class CommandCSSetOpNotice : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
ChannelInfo *ci = cs_findchan(params[0]);
- assert(ci);
+ if (!ci)
+ throw CoreException("NULL ci in CommandCSSetOpNotice");
if (params[1].equals_ci("ON"))
{
diff --git a/modules/core/cs_set_peace.cpp b/modules/core/cs_set_peace.cpp
index b00bf26d5..aa058b416 100644
--- a/modules/core/cs_set_peace.cpp
+++ b/modules/core/cs_set_peace.cpp
@@ -23,7 +23,8 @@ class CommandCSSetPeace : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
ChannelInfo *ci = cs_findchan(params[0]);
- assert(ci);
+ if (!ci)
+ throw CoreException("NULL ci in CommandCSSetPeace");
if (params[1].equals_ci("ON"))
{
diff --git a/modules/core/cs_set_persist.cpp b/modules/core/cs_set_persist.cpp
index b2876d476..2ab310f2a 100644
--- a/modules/core/cs_set_persist.cpp
+++ b/modules/core/cs_set_persist.cpp
@@ -23,7 +23,8 @@ class CommandCSSetPersist : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
ChannelInfo *ci = cs_findchan(params[0]);
- assert(ci);
+ if (!ci)
+ throw CoreException("NULL ci in CommandCSSetPersist");
ChannelMode *cm = ModeManager::FindChannelModeByName(CMODE_PERM);
diff --git a/modules/core/cs_set_private.cpp b/modules/core/cs_set_private.cpp
index 8ade236c8..7d1cd0d82 100644
--- a/modules/core/cs_set_private.cpp
+++ b/modules/core/cs_set_private.cpp
@@ -23,7 +23,8 @@ class CommandCSSetPrivate : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
ChannelInfo *ci = cs_findchan(params[0]);
- assert(ci);
+ if (!ci)
+ throw CoreException("NULL ci in CommandCSSetPrivate");
if (params[1].equals_ci("ON"))
{
diff --git a/modules/core/cs_set_restricted.cpp b/modules/core/cs_set_restricted.cpp
index 82520bbcc..e51024baa 100644
--- a/modules/core/cs_set_restricted.cpp
+++ b/modules/core/cs_set_restricted.cpp
@@ -22,7 +22,8 @@ class CommandCSSetRestricted : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
ChannelInfo *ci = cs_findchan(params[0]);
- assert(ci);
+ if (!ci)
+ throw CoreException("NULL ci in CommandCSSetRestricted");
if (params[1].equals_ci("ON"))
{
diff --git a/modules/core/cs_set_secure.cpp b/modules/core/cs_set_secure.cpp
index 817608987..98babf1d7 100644
--- a/modules/core/cs_set_secure.cpp
+++ b/modules/core/cs_set_secure.cpp
@@ -23,7 +23,8 @@ class CommandCSSetSecure : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
ChannelInfo *ci = cs_findchan(params[0]);
- assert(ci);
+ if (!ci)
+ throw CoreException("NULL ci in CommandCSSetSecure");
if (params[1].equals_ci("ON"))
{
diff --git a/modules/core/cs_set_securefounder.cpp b/modules/core/cs_set_securefounder.cpp
index 7c2e310d9..d6ef6aef8 100644
--- a/modules/core/cs_set_securefounder.cpp
+++ b/modules/core/cs_set_securefounder.cpp
@@ -23,7 +23,8 @@ class CommandCSSetSecureFounder : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
ChannelInfo *ci = cs_findchan(params[0]);
- assert(ci);
+ if (!ci)
+ throw CoreException("NULL ci in CommandCSSetSecureFounder");
if (this->permission.empty() && ci->HasFlag(CI_SECUREFOUNDER) ? !IsFounder(u, ci) : !check_access(u, ci, CA_FOUNDER))
{
diff --git a/modules/core/cs_set_secureops.cpp b/modules/core/cs_set_secureops.cpp
index 6d705dd6a..c9367dae7 100644
--- a/modules/core/cs_set_secureops.cpp
+++ b/modules/core/cs_set_secureops.cpp
@@ -23,7 +23,8 @@ class CommandCSSetSecureOps : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
ChannelInfo *ci = cs_findchan(params[0]);
- assert(ci);
+ if (!ci)
+ throw CoreException("NULL ci in CommandCSSetSecureIos");
if (params[1].equals_ci("ON"))
{
diff --git a/modules/core/cs_set_signkick.cpp b/modules/core/cs_set_signkick.cpp
index 93e5c287a..d62a5eec4 100644
--- a/modules/core/cs_set_signkick.cpp
+++ b/modules/core/cs_set_signkick.cpp
@@ -23,7 +23,8 @@ class CommandCSSetSignKick : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
ChannelInfo *ci = cs_findchan(params[0]);
- assert(ci);
+ if (!ci)
+ throw CoreException("NULL ci in CommandCSSetSignKick");
if (params[1].equals_ci("ON"))
{
diff --git a/modules/core/cs_set_successor.cpp b/modules/core/cs_set_successor.cpp
index 4ba445300..c0c913487 100644
--- a/modules/core/cs_set_successor.cpp
+++ b/modules/core/cs_set_successor.cpp
@@ -23,7 +23,8 @@ class CommandCSSetSuccessor : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
ChannelInfo *ci = cs_findchan(params[0]);
- assert(ci);
+ if (!ci)
+ throw CoreException("NULL ci in CommandCSSetSuccessor");
if (this->permission.empty() && ci->HasFlag(CI_SECUREFOUNDER) ? !IsFounder(u, ci) : !check_access(u, ci, CA_FOUNDER))
{
diff --git a/modules/core/cs_set_topiclock.cpp b/modules/core/cs_set_topiclock.cpp
index 26f053b69..b60a687b4 100644
--- a/modules/core/cs_set_topiclock.cpp
+++ b/modules/core/cs_set_topiclock.cpp
@@ -23,7 +23,8 @@ class CommandCSSetTopicLock : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
ChannelInfo *ci = cs_findchan(params[0]);
- assert(ci);
+ if (!ci)
+ throw CoreException("NULL ci in CommandCSSetTopicLock");
if (params[1].equals_ci("ON"))
{
diff --git a/modules/core/cs_set_xop.cpp b/modules/core/cs_set_xop.cpp
index 37247f394..c7d4017b0 100644
--- a/modules/core/cs_set_xop.cpp
+++ b/modules/core/cs_set_xop.cpp
@@ -30,7 +30,8 @@ class CommandCSSetXOP : public Command
}
ChannelInfo *ci = cs_findchan(params[0]);
- assert(ci);
+ if (!ci)
+ throw CoreException("NULL ci in CommandCSSetXOP");
if (params[1].equals_ci("ON"))
{
diff --git a/modules/core/db_plain.cpp b/modules/core/db_plain.cpp
index 331901f86..a9d87fab7 100644
--- a/modules/core/db_plain.cpp
+++ b/modules/core/db_plain.cpp
@@ -1014,7 +1014,7 @@ class DBPlain : public Module
{
if ((*it)->Class == MC_CHANNEL)
{
- ChannelMode *cm = dynamic_cast<ChannelMode *>(*it);
+ ChannelMode *cm = debug_cast<ChannelMode *>(*it);
if (ci->HasMLock(cm->Name, true))
db << " " << cm->NameAsString;
@@ -1029,7 +1029,7 @@ class DBPlain : public Module
{
if ((*it)->Class == MC_CHANNEL)
{
- ChannelMode *cm = dynamic_cast<ChannelMode *>(*it);
+ ChannelMode *cm = debug_cast<ChannelMode *>(*it);
if (ci->HasMLock(cm->Name, false))
db << " " << cm->NameAsString;
@@ -1042,7 +1042,7 @@ class DBPlain : public Module
{
if ((*it)->Class == MC_CHANNEL)
{
- ChannelMode *cm = dynamic_cast<ChannelMode *>(*it);
+ ChannelMode *cm = debug_cast<ChannelMode *>(*it);
if (ci->GetParam(cm->Name, Param))
db << "MD MLP " << cm->NameAsString << " " << Param << endl;
diff --git a/modules/core/ns_saset.cpp b/modules/core/ns_saset.cpp
index 4beccbcad..081e1d466 100644
--- a/modules/core/ns_saset.cpp
+++ b/modules/core/ns_saset.cpp
@@ -128,7 +128,8 @@ class CommandNSSASetDisplay : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
NickCore *nc = findcore(params[0]);
- assert(nc);
+ if (!nc)
+ throw CoreException("NULL nc in CommandNSSASetDisplay");
NickAlias *na = findnick(params[1]);
if (!na || na->nc != nc)
@@ -170,7 +171,8 @@ class CommandNSSASetPassword : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
NickCore *nc = findcore(params[0]);
- assert(nc);
+ if (!nc)
+ throw CoreException("NULL nc in CommandNSSASetPassword");
size_t len = params[1].length();
diff --git a/modules/core/ns_saset_noexpire.cpp b/modules/core/ns_saset_noexpire.cpp
index 2c8f93243..62b93d7e9 100644
--- a/modules/core/ns_saset_noexpire.cpp
+++ b/modules/core/ns_saset_noexpire.cpp
@@ -23,7 +23,8 @@ class CommandNSSASetNoexpire : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
NickAlias *na = findnick(params[0]);
- assert(na);
+ if (!na)
+ throw CoreException("NULL na in CommandNSSASsetNoexpire");
Anope::string param = params.size() > 1 ? params[1] : "";
diff --git a/modules/core/ns_set_autoop.cpp b/modules/core/ns_set_autoop.cpp
index 2c8c8b1c4..da8b8ccb9 100644
--- a/modules/core/ns_set_autoop.cpp
+++ b/modules/core/ns_set_autoop.cpp
@@ -65,7 +65,8 @@ class CommandNSSASetAutoOp : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
NickCore *nc = findcore(params[0]);
- assert(nc);
+ if (!nc)
+ throw CoreException("NULL nc in CommandNSSASetAutoOp");
Anope::string param = params[1];
diff --git a/modules/core/ns_set_email.cpp b/modules/core/ns_set_email.cpp
index bf3162611..070e93026 100644
--- a/modules/core/ns_set_email.cpp
+++ b/modules/core/ns_set_email.cpp
@@ -71,7 +71,8 @@ class CommandNSSASetEmail : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
NickCore *nc = findcore(params[0]);
- assert(nc);
+ if (!nc)
+ throw CoreException("NULL nc in CommandNSSASetEmail");
Anope::string param = params.size() > 1 ? params[1] : "";
diff --git a/modules/core/ns_set_greet.cpp b/modules/core/ns_set_greet.cpp
index 128257924..4704bf1ca 100644
--- a/modules/core/ns_set_greet.cpp
+++ b/modules/core/ns_set_greet.cpp
@@ -58,7 +58,8 @@ class CommandNSSASetGreet : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
NickCore *nc = findcore(params[0]);
- assert(nc);
+ if (!nc)
+ throw CoreException("NULL nc in CommandNSSASetGreet");
Anope::string param = params.size() > 1 ? params[1] : "";
diff --git a/modules/core/ns_set_hide.cpp b/modules/core/ns_set_hide.cpp
index 5eaa1f39c..8432794ff 100644
--- a/modules/core/ns_set_hide.cpp
+++ b/modules/core/ns_set_hide.cpp
@@ -98,7 +98,8 @@ class CommandNSSASetHide : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
NickCore *nc = findcore(params[0]);
- assert(nc);
+ if (!nc)
+ throw CoreException("NULL nc in CommandNSSASetHide");
Anope::string param = params[1];
diff --git a/modules/core/ns_set_kill.cpp b/modules/core/ns_set_kill.cpp
index f7312710f..cad473543 100644
--- a/modules/core/ns_set_kill.cpp
+++ b/modules/core/ns_set_kill.cpp
@@ -88,7 +88,8 @@ class CommandNSSASetKill : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
NickCore *nc = findcore(params[0]);
- assert(nc);
+ if (!nc)
+ throw CoreException("NULL nc in CommandNSSASetKill");
Anope::string param = params[1];
diff --git a/modules/core/ns_set_language.cpp b/modules/core/ns_set_language.cpp
index 06f29ae48..c76bf0fef 100644
--- a/modules/core/ns_set_language.cpp
+++ b/modules/core/ns_set_language.cpp
@@ -70,7 +70,8 @@ class CommandNSSASetLanguage : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
NickCore *nc = findcore(params[0]);
- assert(nc);
+ if (!nc)
+ throw CoreException("NULL nc in CommandNSSASetLanguage");
Anope::string param = params[1];
diff --git a/modules/core/ns_set_message.cpp b/modules/core/ns_set_message.cpp
index 25ad660d7..f31d4aebe 100644
--- a/modules/core/ns_set_message.cpp
+++ b/modules/core/ns_set_message.cpp
@@ -71,7 +71,8 @@ class CommandNSSASetMessage : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
NickCore *nc = findcore(params[0]);
- assert(nc);
+ if (!nc)
+ throw CoreException("NULL nc in CommandNSSASetMessage");
Anope::string param = params[1];
diff --git a/modules/core/ns_set_private.cpp b/modules/core/ns_set_private.cpp
index 5e8aff432..c3ce5c8eb 100644
--- a/modules/core/ns_set_private.cpp
+++ b/modules/core/ns_set_private.cpp
@@ -65,7 +65,8 @@ class CommandNSSASetPrivate : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
NickCore *nc = findcore(params[0]);
- assert(nc);
+ if (!nc)
+ throw CoreException("NULL nc in CommandNSSASetPrivate");
Anope::string param = params[1];
diff --git a/modules/core/ns_set_secure.cpp b/modules/core/ns_set_secure.cpp
index 66990f423..872829924 100644
--- a/modules/core/ns_set_secure.cpp
+++ b/modules/core/ns_set_secure.cpp
@@ -65,7 +65,8 @@ class CommandNSSASetSecure : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
NickCore *nc = findcore(params[0]);
- assert(nc);
+ if (!nc)
+ throw CoreException("NULL nc in CommandNSSASetSecure");
Anope::string param = params[1];
diff --git a/modules/core/os_defcon.cpp b/modules/core/os_defcon.cpp
index 155937753..cb25b50bf 100644
--- a/modules/core/os_defcon.cpp
+++ b/modules/core/os_defcon.cpp
@@ -428,7 +428,7 @@ void defconParseModeString(const Anope::string &str)
if (cm->Type == MODE_PARAM)
{
- cmp = dynamic_cast<ChannelModeParam *>(cm);
+ cmp = debug_cast<ChannelModeParam *>(cm);
if (!ss.GetToken(param))
{
diff --git a/modules/extra/cs_set_misc.cpp b/modules/extra/cs_set_misc.cpp
index 7cffe6866..d287a24c1 100644
--- a/modules/extra/cs_set_misc.cpp
+++ b/modules/extra/cs_set_misc.cpp
@@ -23,7 +23,8 @@ class CommandCSSetMisc : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
ChannelInfo *ci = cs_findchan(params[0]);
- assert(ci);
+ if (!ci)
+ throw CoreException("NULL ci in CommandCSSetMisc");
ci->Shrink("chanserv:" + this->name);
if (params.size() > 1)
diff --git a/modules/extra/mysql/db_mysql_write.cpp b/modules/extra/mysql/db_mysql_write.cpp
index 2d44450c1..5d2ef2a78 100644
--- a/modules/extra/mysql/db_mysql_write.cpp
+++ b/modules/extra/mysql/db_mysql_write.cpp
@@ -66,7 +66,7 @@ static std::string MakeMLock(ChannelInfo *ci, bool status)
{
if ((*it)->Class == MC_CHANNEL)
{
- ChannelMode *cm = dynamic_cast<ChannelMode *>(*it);
+ ChannelMode *cm = debug_cast<ChannelMode *>(*it);
if (ci->HasMLock(cm->Name, status))
ret += " " + cm->NameAsString;
@@ -97,7 +97,7 @@ static std::string GetMLockParams(ChannelInfo *ci)
{
if ((*it)->Class == MC_CHANNEL)
{
- ChannelMode *cm = dynamic_cast<ChannelMode *>(*it);
+ ChannelMode *cm = debug_cast<ChannelMode *>(*it);
std::string param;
if (ci->GetParam(cm->Name, param))
diff --git a/modules/extra/ns_set_misc.cpp b/modules/extra/ns_set_misc.cpp
index 9e0f23eb0..8ab54fd05 100644
--- a/modules/extra/ns_set_misc.cpp
+++ b/modules/extra/ns_set_misc.cpp
@@ -22,7 +22,8 @@ class CommandNSSetMisc : public Command
CommandReturn RealExecute(User *u, const std::vector<Anope::string> &params)
{
NickCore *nc = findcore(params[0]);
- assert(nc);
+ if (!nc)
+ throw CoreException("NULL nc in CommandNSSetMisc");
nc->Shrink("nickserv:" + this->name);
if (params.size() > 1)
diff --git a/modules/protocol/bahamut.cpp b/modules/protocol/bahamut.cpp
index d80fb953b..9e28b1f9f 100644
--- a/modules/protocol/bahamut.cpp
+++ b/modules/protocol/bahamut.cpp
@@ -319,7 +319,7 @@ int anope_event_sjoin(const Anope::string &source, int ac, const char **av)
if (m->Type != MODE_STATUS)
continue;
- ChannelMode *cm = dynamic_cast<ChannelMode *>(m);
+ ChannelMode *cm = debug_cast<ChannelMode *>(m);
for (CUserList::const_iterator uit = c->users.begin(), uit_end = c->users.end(); uit != uit_end; ++uit)
{
diff --git a/modules/protocol/inspircd11.cpp b/modules/protocol/inspircd11.cpp
index c58c011c9..3234ae81e 100644
--- a/modules/protocol/inspircd11.cpp
+++ b/modules/protocol/inspircd11.cpp
@@ -413,7 +413,7 @@ int anope_event_fjoin(const Anope::string &source, int ac, const char **av)
if (m->Type != MODE_STATUS)
continue;
- ChannelMode *cm = dynamic_cast<ChannelMode *>(m);
+ ChannelMode *cm = debug_cast<ChannelMode *>(m);
for (CUserList::const_iterator uit = c->users.begin(), uit_end = c->users.end(); uit != uit_end; ++uit)
{
diff --git a/modules/protocol/inspircd12.cpp b/modules/protocol/inspircd12.cpp
index 4c1a5407e..f8d0c1563 100644
--- a/modules/protocol/inspircd12.cpp
+++ b/modules/protocol/inspircd12.cpp
@@ -454,7 +454,7 @@ int anope_event_fjoin(const Anope::string &source, int ac, const char **av)
if (m->Type != MODE_STATUS)
continue;
- ChannelMode *cm = dynamic_cast<ChannelMode *>(m);
+ ChannelMode *cm = debug_cast<ChannelMode *>(m);
for (CUserList::const_iterator uit = c->users.begin(), uit_end = c->users.end(); uit != uit_end; ++uit)
{
diff --git a/modules/protocol/inspircd20.cpp b/modules/protocol/inspircd20.cpp
index 5097f24b8..043e3d256 100644
--- a/modules/protocol/inspircd20.cpp
+++ b/modules/protocol/inspircd20.cpp
@@ -452,7 +452,7 @@ int anope_event_fjoin(const Anope::string &source, int ac, const char **av)
if (m->Type != MODE_STATUS)
continue;
- ChannelMode *cm = dynamic_cast<ChannelMode *>(m);
+ ChannelMode *cm = debug_cast<ChannelMode *>(m);
for (CUserList::const_iterator uit = c->users.begin(), uit_end = c->users.end(); uit != uit_end; ++uit)
{
diff --git a/modules/protocol/ratbox.cpp b/modules/protocol/ratbox.cpp
index a01207a5d..df241e3fc 100644
--- a/modules/protocol/ratbox.cpp
+++ b/modules/protocol/ratbox.cpp
@@ -302,7 +302,7 @@ int anope_event_sjoin(const Anope::string &source, int ac, const char **av)
if (m->Type != MODE_STATUS)
continue;
- ChannelMode *cm = dynamic_cast<ChannelMode *>(m);
+ ChannelMode *cm = debug_cast<ChannelMode *>(m);
for (CUserList::const_iterator uit = c->users.begin(), uit_end = c->users.end(); uit != uit_end; ++uit)
{
@@ -726,17 +726,17 @@ int anope_event_bmask(const Anope::string &source, int ac, const char **av)
Anope::string b = myStrGetToken(bans, ' ', i);
if (!stricmp(av[2], "b"))
{
- cms = dynamic_cast<ChannelModeList *>(ModeManager::FindChannelModeByChar('b'));
+ cms = debug_cast<ChannelModeList *>(ModeManager::FindChannelModeByChar('b'));
cms->AddMask(c, b);
}
if (!stricmp(av[2], "e"))
{
- cms = dynamic_cast<ChannelModeList *>(ModeManager::FindChannelModeByChar('e'));
+ cms = debug_cast<ChannelModeList *>(ModeManager::FindChannelModeByChar('e'));
cms->AddMask(c, b);
}
if (!stricmp(av[2], "I"))
{
- cms = dynamic_cast<ChannelModeList *>(ModeManager::FindChannelModeByChar('I'));
+ cms = debug_cast<ChannelModeList *>(ModeManager::FindChannelModeByChar('I'));
cms->AddMask(c, b);
}
}
diff --git a/modules/protocol/unreal32.cpp b/modules/protocol/unreal32.cpp
index 4383d88c4..486e248d4 100644
--- a/modules/protocol/unreal32.cpp
+++ b/modules/protocol/unreal32.cpp
@@ -1008,7 +1008,7 @@ int anope_event_sjoin(const Anope::string &source, int ac, const char **av)
if (m->Type != MODE_STATUS)
continue;
- ChannelMode *cm = dynamic_cast<ChannelMode *>(m);
+ ChannelMode *cm = debug_cast<ChannelMode *>(m);
for (CUserList::const_iterator uit = c->users.begin(), uit_end = c->users.end(); uit != uit_end; ++uit)
{
@@ -1052,7 +1052,7 @@ int anope_event_sjoin(const Anope::string &source, int ac, const char **av)
if (keep_their_modes && buf[0] == '&')
{
buf.erase(buf.begin());
- ChannelModeList *cml = dynamic_cast<ChannelModeList *>(ModeManager::FindChannelModeByName(CMODE_BAN));
+ ChannelModeList *cml = debug_cast<ChannelModeList *>(ModeManager::FindChannelModeByName(CMODE_BAN));
if (cml->IsValid(buf))
cml->AddMask(c, buf);
@@ -1061,7 +1061,7 @@ int anope_event_sjoin(const Anope::string &source, int ac, const char **av)
else if (keep_their_modes && buf[0] == '"')
{
buf.erase(buf.begin());
- ChannelModeList *cml = dynamic_cast<ChannelModeList *>(ModeManager::FindChannelModeByName(CMODE_EXCEPT));
+ ChannelModeList *cml = debug_cast<ChannelModeList *>(ModeManager::FindChannelModeByName(CMODE_EXCEPT));
if (cml->IsValid(buf))
cml->AddMask(c, buf);
@@ -1070,7 +1070,7 @@ int anope_event_sjoin(const Anope::string &source, int ac, const char **av)
else if (keep_their_modes && buf[0] == '\'')
{
buf.erase(buf.begin());
- ChannelModeList *cml = dynamic_cast<ChannelModeList *>(ModeManager::FindChannelModeByName(CMODE_INVITEOVERRIDE));
+ ChannelModeList *cml = debug_cast<ChannelModeList *>(ModeManager::FindChannelModeByName(CMODE_INVITEOVERRIDE));
if (cml->IsValid(buf))
cml->AddMask(c, buf);
diff --git a/src/channels.cpp b/src/channels.cpp
index 9654b295b..0d034f222 100644
--- a/src/channels.cpp
+++ b/src/channels.cpp
@@ -232,7 +232,7 @@ bool Channel::HasUserStatus(User *u, ChannelModeStatus *cms) const
*/
bool Channel::HasUserStatus(User *u, ChannelModeName Name) const
{
- return HasUserStatus(u, dynamic_cast<ChannelModeStatus *>(ModeManager::FindChannelModeByName(Name)));
+ return HasUserStatus(u, debug_cast<ChannelModeStatus *>(ModeManager::FindChannelModeByName(Name)));
}
/**
@@ -298,7 +298,7 @@ void Channel::SetModeInternal(ChannelMode *cm, const Anope::string &param, bool
return;
}
- ChannelModeList *cml = dynamic_cast<ChannelModeList *>(cm);
+ ChannelModeList *cml = debug_cast<ChannelModeList *>(cm);
cml->AddMask(this, param);
return;
}
@@ -357,7 +357,7 @@ void Channel::SetModeInternal(ChannelMode *cm, const Anope::string &param, bool
/* If this is a param mode and its mlocked +, check to ensure someone didn't reset it with the wrong param */
else if (cm->Type == MODE_PARAM && ci->HasMLock(cm->Name, true))
{
- ChannelModeParam *cmp = dynamic_cast<ChannelModeParam *>(cm);
+ ChannelModeParam *cmp = debug_cast<ChannelModeParam *>(cm);
Anope::string cparam, ciparam;
/* Get the param currently set on this channel */
GetParam(cmp->Name, cparam);
@@ -429,7 +429,7 @@ void Channel::RemoveModeInternal(ChannelMode *cm, const Anope::string &param, bo
return;
}
- ChannelModeList *cml = dynamic_cast<ChannelModeList *>(cm);
+ ChannelModeList *cml = debug_cast<ChannelModeList *>(cm);
cml->DelMask(this, param);
return;
}
@@ -509,7 +509,7 @@ void Channel::SetMode(BotInfo *bi, ChannelMode *cm, const Anope::string &param,
else if (cm->Type == MODE_STATUS)
{
User *u = finduser(param);
- if (u && HasUserStatus(u, dynamic_cast<ChannelModeStatus *>(cm)))
+ if (u && HasUserStatus(u, debug_cast<ChannelModeStatus *>(cm)))
return;
}
else if (cm->Type == MODE_LIST)
@@ -562,7 +562,7 @@ void Channel::RemoveMode(BotInfo *bi, ChannelMode *cm, const Anope::string &para
else if (cm->Type == MODE_STATUS)
{
User *u = finduser(param);
- if (u && !HasUserStatus(u, dynamic_cast<ChannelModeStatus *>(cm)))
+ if (u && !HasUserStatus(u, debug_cast<ChannelModeStatus *>(cm)))
return;
}
else if (cm->Type == MODE_LIST)
@@ -574,7 +574,7 @@ void Channel::RemoveMode(BotInfo *bi, ChannelMode *cm, const Anope::string &para
bool SendParam = true;
if (cm->Type == MODE_PARAM)
{
- ChannelModeParam *cmp = dynamic_cast<ChannelModeParam *>(cm);
+ ChannelModeParam *cmp = debug_cast<ChannelModeParam *>(cm);
if (cmp->MinusNoArg)
SendParam = false;
}
@@ -677,7 +677,7 @@ void Channel::ClearBans(BotInfo *bi)
Entry *entry, *nexte;
ChannelModeList *cml;
- cml = dynamic_cast<ChannelModeList *>(ModeManager::FindChannelModeByName(CMODE_BAN));
+ cml = debug_cast<ChannelModeList *>(ModeManager::FindChannelModeByName(CMODE_BAN));
if (cml && this->bans && this->bans->count)
for (entry = this->bans->entries; entry; entry = nexte)
@@ -696,7 +696,7 @@ void Channel::ClearExcepts(BotInfo *bi)
Entry *entry, *nexte;
ChannelModeList *cml;
- cml = dynamic_cast<ChannelModeList *>(ModeManager::FindChannelModeByName(CMODE_EXCEPT));
+ cml = debug_cast<ChannelModeList *>(ModeManager::FindChannelModeByName(CMODE_EXCEPT));
if (cml && this->excepts && this->excepts->count)
for (entry = this->excepts->entries; entry; entry = nexte)
@@ -715,7 +715,7 @@ void Channel::ClearInvites(BotInfo *bi)
Entry *entry, *nexte;
ChannelModeList *cml;
- cml = dynamic_cast<ChannelModeList *>(ModeManager::FindChannelModeByName(CMODE_INVITEOVERRIDE));
+ cml = debug_cast<ChannelModeList *>(ModeManager::FindChannelModeByName(CMODE_INVITEOVERRIDE));
if (cml && this->invites && this->invites->count)
for (entry = this->invites->entries; entry; entry = nexte)
@@ -823,7 +823,7 @@ void ChanSetInternalModes(Channel *c, int ac, const char **av)
}
else if (cm->Type == MODE_PARAM)
{
- ChannelModeParam *cmp = dynamic_cast<ChannelModeParam *>(cm);
+ ChannelModeParam *cmp = debug_cast<ChannelModeParam *>(cm);
if (!add && cmp->MinusNoArg)
{
@@ -927,7 +927,7 @@ Anope::string chan_get_modes(Channel *chan, int complete, int plus)
if ((*it)->Class != MC_CHANNEL)
continue;
- ChannelMode *cm = dynamic_cast<ChannelMode *>(*it);
+ ChannelMode *cm = debug_cast<ChannelMode *>(*it);
if (chan->HasMode(cm->Name))
{
@@ -937,7 +937,7 @@ Anope::string chan_get_modes(Channel *chan, int complete, int plus)
{
if (cm->Type == MODE_PARAM)
{
- ChannelModeParam *cmp = dynamic_cast<ChannelModeParam *>(cm);
+ ChannelModeParam *cmp = debug_cast<ChannelModeParam *>(cm);
if (plus || !cmp->MinusNoArg)
{
diff --git a/src/chanserv.cpp b/src/chanserv.cpp
index bcfe239cd..07ebe9525 100644
--- a/src/chanserv.cpp
+++ b/src/chanserv.cpp
@@ -160,7 +160,7 @@ Anope::string get_mlock_modes(ChannelInfo *ci, int complete)
if (cm->Type == MODE_PARAM)
{
- cmp = dynamic_cast<ChannelModeParam *>(cm);
+ cmp = debug_cast<ChannelModeParam *>(cm);
ci->GetParam(cmp->Name, param);
@@ -343,7 +343,7 @@ void check_modes(Channel *c)
/* Add the eventual parameter */
if (cm->Type == MODE_PARAM)
{
- ChannelModeParam *cmp = dynamic_cast<ChannelModeParam *>(cm);
+ ChannelModeParam *cmp = debug_cast<ChannelModeParam *>(cm);
if (!cmp->MinusNoArg)
{
diff --git a/src/config.cpp b/src/config.cpp
index 7dbce6a61..725138516 100644
--- a/src/config.cpp
+++ b/src/config.cpp
@@ -838,82 +838,82 @@ int ServerConfig::Read(bool bail)
{
case DT_NOSPACES:
{
- ValueContainerString *vcs = dynamic_cast<ValueContainerString *>(Values[Index].val);
+ ValueContainerString *vcs = debug_cast<ValueContainerString *>(Values[Index].val);
ValidateNoSpaces(vi.GetValue(), Values[Index].tag, Values[Index].value);
vcs->Set(vi.GetValue());
}
break;
case DT_HOSTNAME:
{
- ValueContainerString *vcs = dynamic_cast<ValueContainerString *>(Values[Index].val);
+ ValueContainerString *vcs = debug_cast<ValueContainerString *>(Values[Index].val);
ValidateHostname(vi.GetValue(), Values[Index].tag, Values[Index].value);
vcs->Set(vi.GetValue());
}
break;
case DT_IPADDRESS:
{
- ValueContainerString *vcs = dynamic_cast<ValueContainerString *>(Values[Index].val);
+ ValueContainerString *vcs = debug_cast<ValueContainerString *>(Values[Index].val);
ValidateIP(vi.GetValue(), Values[Index].tag, Values[Index].value, allow_wild);
vcs->Set(vi.GetValue());
}
break;
case DT_CHARPTR:
{
- ValueContainerChar *vcc = dynamic_cast<ValueContainerChar *>(Values[Index].val);
+ ValueContainerChar *vcc = debug_cast<ValueContainerChar *>(Values[Index].val);
// Make sure we also copy the null terminator
vcc->Set(vi.GetString(), strlen(vi.GetString()) + 1);
}
break;
case DT_CSSTRING:
{
- ValueContainerCSString *vcs = dynamic_cast<ValueContainerCSString *>(Values[Index].val);
+ ValueContainerCSString *vcs = debug_cast<ValueContainerCSString *>(Values[Index].val);
vcs->Set(vi.GetCSValue());
}
break;
case DT_CISTRING:
{
- ValueContainerCIString *vcs = dynamic_cast<ValueContainerCIString *>(Values[Index].val);
+ ValueContainerCIString *vcs = debug_cast<ValueContainerCIString *>(Values[Index].val);
vcs->Set(vi.GetCIValue());
}
break;
case DT_STRING:
{
- ValueContainerString *vcs = dynamic_cast<ValueContainerString *>(Values[Index].val);
+ ValueContainerString *vcs = debug_cast<ValueContainerString *>(Values[Index].val);
vcs->Set(vi.GetValue());
}
break;
case DT_INTEGER:
{
int val = vi.GetInteger();
- ValueContainerInt *vci = dynamic_cast<ValueContainerInt *>(Values[Index].val);
+ ValueContainerInt *vci = debug_cast<ValueContainerInt *>(Values[Index].val);
vci->Set(&val, sizeof(int));
}
break;
case DT_UINTEGER:
{
unsigned val = vi.GetInteger();
- ValueContainerUInt *vci = dynamic_cast<ValueContainerUInt *>(Values[Index].val);
+ ValueContainerUInt *vci = debug_cast<ValueContainerUInt *>(Values[Index].val);
vci->Set(&val, sizeof(unsigned));
}
break;
case DT_LUINTEGER:
{
unsigned long val = vi.GetInteger();
- ValueContainerLUInt *vci = dynamic_cast<ValueContainerLUInt *>(Values[Index].val);
+ ValueContainerLUInt *vci = debug_cast<ValueContainerLUInt *>(Values[Index].val);
vci->Set(&val, sizeof(unsigned long));
}
break;
case DT_TIME:
{
time_t time = dotime(vi.GetValue());
- ValueContainerTime *vci = dynamic_cast<ValueContainerTime *>(Values[Index].val);
+ ValueContainerTime *vci = debug_cast<ValueContainerTime *>(Values[Index].val);
vci->Set(&time, sizeof(time_t));
}
break;
case DT_BOOLEAN:
{
bool val = vi.GetBool();
- ValueContainerBool *vcb = dynamic_cast<ValueContainerBool *>(Values[Index].val);
+ ValueContainerBool *vcb = debug_cast<ValueContainerBool *>(Values[Index].val);
vcb->Set(&val, sizeof(bool));
}
break;
diff --git a/src/modes.cpp b/src/modes.cpp
index af4c2f879..6d8fca77e 100644
--- a/src/modes.cpp
+++ b/src/modes.cpp
@@ -87,7 +87,7 @@ void SetDefaultMLock()
ChannelMode *cm = ModeManager::FindChannelModeByChar(Config.BotModes[i]);
if (cm && cm->Type == MODE_STATUS && std::find(BotModes.begin(), BotModes.end(), cm) == BotModes.end())
- BotModes.push_back(dynamic_cast<ChannelModeStatus *>(cm));
+ BotModes.push_back(debug_cast<ChannelModeStatus *>(cm));
}
}
@@ -730,7 +730,7 @@ char ModeManager::GetStatusChar(char Value)
cm = it->second;
if (cm->Type == MODE_STATUS)
{
- cms = dynamic_cast<ChannelModeStatus *>(cm);
+ cms = debug_cast<ChannelModeStatus *>(cm);
if (Value == cms->Symbol)
return it->first;
diff --git a/src/regchannel.cpp b/src/regchannel.cpp
index 019f173e5..ea16b05da 100644
--- a/src/regchannel.cpp
+++ b/src/regchannel.cpp
@@ -352,7 +352,7 @@ void ChannelInfo::LoadMLock()
{
if ((*mit)->Class == MC_CHANNEL)
{
- ChannelMode *cm = dynamic_cast<ChannelMode *>(*mit);
+ ChannelMode *cm = debug_cast<ChannelMode *>(*mit);
if (cm->NameAsString.equals_ci(*it))
this->SetMLock(cm->Name, true);
@@ -371,7 +371,7 @@ void ChannelInfo::LoadMLock()
{
if ((*mit)->Class == MC_CHANNEL)
{
- ChannelMode *cm = dynamic_cast<ChannelMode *>(*mit);
+ ChannelMode *cm = debug_cast<ChannelMode *>(*mit);
if (cm->NameAsString.equals_ci(*it))
this->SetMLock(cm->Name, false);
@@ -392,7 +392,7 @@ void ChannelInfo::LoadMLock()
{
if ((*mit)->Class == MC_CHANNEL)
{
- ChannelMode *cm = dynamic_cast<ChannelMode *>(*mit);
+ ChannelMode *cm = debug_cast<ChannelMode *>(*mit);
if (cm->NameAsString.equals_ci(it->first))
this->SetMLock(cm->Name, true, it->second);