mirror of
https://github.com/anope/anope.git
synced 2026-07-01 13:26:39 +02:00
Fixed non-debug build
This commit is contained in:
+17
-5
@@ -596,25 +596,37 @@ template<typename T> inline T convertTo(const Anope::string &s, bool failIfLefto
|
||||
return x;
|
||||
}
|
||||
|
||||
/** 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.
|
||||
/** Casts to be used instead of dynamic_cast, this uses dynamic_cast
|
||||
* for debug builds and static_cast/reinterpret_cast on releass builds
|
||||
* to speed up the program because dynamic_cast relies on RTTI.
|
||||
*/
|
||||
#ifdef DEBUG_BUILD
|
||||
# include <typeinfo>
|
||||
#endif
|
||||
template<typename T, typename O> inline T debug_cast(O ptr)
|
||||
template<typename T, typename O> inline T anope_dynamic_static_cast(O ptr)
|
||||
{
|
||||
#ifdef DEBUG_BUILD
|
||||
T ret = dynamic_cast<T>(ptr);
|
||||
if (ptr != NULL && ret == NULL)
|
||||
throw CoreException(Anope::string("debug_cast<") + typeid(T).name() + ">(" + typeid(O).name() + ") fail");
|
||||
throw CoreException(Anope::string("anope_dynamic_static_cast<") + typeid(T).name() + ">(" + typeid(O).name() + ") fail");
|
||||
return ret;
|
||||
#else
|
||||
return static_cast<T>(ptr);
|
||||
#endif
|
||||
}
|
||||
|
||||
template<typename T, typename O> inline T anope_dynamic_reinterpret_cast(O ptr)
|
||||
{
|
||||
#ifdef DEBUG_BUILD
|
||||
T ret = dynamic_cast<T>(ptr);
|
||||
if (ptr != NULL && ret == NULL)
|
||||
throw CoreException(Anope::string("anope_dynamic_reinterpret_cast<") + typeid(T).name() + ">(" + typeid(O).name() + ") fail");
|
||||
return ret;
|
||||
#else
|
||||
return reinterpret_cast<T>(ptr);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/** Class with the ability to keep flags on items, they should extend from this
|
||||
|
||||
@@ -90,7 +90,7 @@ class CoreExport Extensible
|
||||
{
|
||||
extensible_map::const_iterator it = this->extension_items.find(key);
|
||||
if (it != this->extension_items.end())
|
||||
return debug_cast<T>(it->second);
|
||||
return anope_dynamic_static_cast<T>(it->second);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+1
-1
@@ -113,7 +113,7 @@ enum ModeClass
|
||||
|
||||
/** This class is the basis of all modes in Anope
|
||||
*/
|
||||
class CoreExport Mode : public virtual Base
|
||||
class CoreExport Mode : public Base
|
||||
{
|
||||
public:
|
||||
/* Class of mode this is */
|
||||
|
||||
@@ -50,7 +50,7 @@ class AccessChanAccess : public ChanAccess
|
||||
{
|
||||
if (access->provider->name == "access/access")
|
||||
{
|
||||
const AccessChanAccess *aaccess = debug_cast<const AccessChanAccess *>(access);
|
||||
const AccessChanAccess *aaccess = anope_dynamic_static_cast<const AccessChanAccess *>(access);
|
||||
return aaccess->level;
|
||||
}
|
||||
else
|
||||
@@ -160,7 +160,7 @@ class CommandCSAccess : public Command
|
||||
service_reference<AccessProvider> provider("AccessProvider", "access/access");
|
||||
if (!provider)
|
||||
return;
|
||||
AccessChanAccess *access = debug_cast<AccessChanAccess *>(provider->Create());
|
||||
AccessChanAccess *access = anope_dynamic_static_cast<AccessChanAccess *>(provider->Create());
|
||||
access->ci = ci;
|
||||
access->mask = mask;
|
||||
access->creator = u->nick;
|
||||
|
||||
@@ -63,7 +63,7 @@ Serializable* EntryMsg::unserialize(Serializable *obj, Serialize::Data &data)
|
||||
|
||||
if (obj)
|
||||
{
|
||||
EntryMsg *msg = debug_cast<EntryMsg *>(obj);
|
||||
EntryMsg *msg = anope_dynamic_static_cast<EntryMsg *>(obj);
|
||||
msg->ci = ci;
|
||||
data["creator"] >> msg->creator;
|
||||
data["message"] >> msg->message;
|
||||
|
||||
@@ -196,7 +196,7 @@ class CommandCSFlags : public Command
|
||||
service_reference<AccessProvider> provider("AccessProvider", "access/flags");
|
||||
if (!provider)
|
||||
return;
|
||||
FlagsChanAccess *access = debug_cast<FlagsChanAccess *>(provider->Create());
|
||||
FlagsChanAccess *access = anope_dynamic_static_cast<FlagsChanAccess *>(provider->Create());
|
||||
access->ci = ci;
|
||||
access->mask = mask;
|
||||
access->creator = u->nick;
|
||||
|
||||
@@ -22,7 +22,7 @@ class CommandCSMode : public Command
|
||||
|
||||
const Anope::string accesses[] = { "VOICE", "HALFOP", "OPDEOP", "PROTECT", "OWNER", "" };
|
||||
const ChannelModeName modes[] = { CMODE_VOICE, CMODE_HALFOP, CMODE_OP, CMODE_PROTECT, CMODE_OWNER };
|
||||
ChannelModeStatus *cms = debug_cast<ChannelModeStatus *>(cm);
|
||||
ChannelModeStatus *cms = anope_dynamic_static_cast<ChannelModeStatus *>(cm);
|
||||
AccessGroup access = ci->AccessFor(u);
|
||||
unsigned short u_level = 0;
|
||||
|
||||
@@ -32,7 +32,7 @@ class CommandCSMode : public Command
|
||||
ChannelMode *cm2 = ModeManager::FindChannelModeByName(modes[i]);
|
||||
if (cm2 == NULL || cm2->Type != MODE_STATUS)
|
||||
continue;
|
||||
ChannelModeStatus *cms2 = debug_cast<ChannelModeStatus *>(cm2);
|
||||
ChannelModeStatus *cms2 = anope_dynamic_static_cast<ChannelModeStatus *>(cm2);
|
||||
if (cms2->Level > u_level)
|
||||
u_level = cms2->Level;
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ struct SeenInfo : Serializable
|
||||
{
|
||||
SeenInfo *s;
|
||||
if (obj)
|
||||
s = debug_cast<SeenInfo *>(obj);
|
||||
s = anope_dynamic_static_cast<SeenInfo *>(obj);
|
||||
else
|
||||
s = new SeenInfo();
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ struct CSMiscData : ExtensibleItem, Serializable
|
||||
CSMiscData *d;
|
||||
if (obj)
|
||||
{
|
||||
d = debug_cast<CSMiscData *>(obj);
|
||||
d = anope_dynamic_static_cast<CSMiscData *>(obj);
|
||||
d->ci = ci;
|
||||
data["name"] >> d->name;
|
||||
data["data"] >> d->data;
|
||||
|
||||
@@ -50,7 +50,7 @@ struct ChanSuspend : ExtensibleItem, Serializable
|
||||
|
||||
ChanSuspend *cs;
|
||||
if (obj)
|
||||
cs = debug_cast<ChanSuspend *>(obj);
|
||||
cs = anope_dynamic_static_cast<ChanSuspend *>(obj);
|
||||
else
|
||||
cs = new ChanSuspend();
|
||||
|
||||
|
||||
@@ -149,7 +149,7 @@ class XOPChanAccess : public ChanAccess
|
||||
{
|
||||
if (access->provider->name == "access/xop")
|
||||
{
|
||||
const XOPChanAccess *xaccess = debug_cast<const XOPChanAccess *>(access);
|
||||
const XOPChanAccess *xaccess = anope_dynamic_static_cast<const XOPChanAccess *>(access);
|
||||
return xaccess->type;
|
||||
}
|
||||
else
|
||||
@@ -263,7 +263,7 @@ class XOPBase : public Command
|
||||
service_reference<AccessProvider> provider("AccessProvider", "access/xop");
|
||||
if (!provider)
|
||||
return;
|
||||
XOPChanAccess *acc = debug_cast<XOPChanAccess *>(provider->Create());
|
||||
XOPChanAccess *acc = anope_dynamic_static_cast<XOPChanAccess *>(provider->Create());
|
||||
acc->ci = ci;
|
||||
acc->mask = mask;
|
||||
acc->creator = u->nick;
|
||||
|
||||
@@ -55,7 +55,7 @@ struct HostRequest : ExtensibleItem, Serializable
|
||||
|
||||
HostRequest *req;
|
||||
if (obj)
|
||||
req = debug_cast<HostRequest *>(obj);
|
||||
req = anope_dynamic_static_cast<HostRequest *>(obj);
|
||||
else
|
||||
req = new HostRequest;
|
||||
req->nick = na->nick;
|
||||
|
||||
@@ -39,8 +39,8 @@ class CommandMSCancel : public Command
|
||||
source.Reply(ischan ? CHAN_X_NOT_REGISTERED : _(NICK_X_NOT_REGISTERED), nname.c_str());
|
||||
else
|
||||
{
|
||||
ChannelInfo *ci;
|
||||
NickAlias *na;
|
||||
ChannelInfo *ci = NULL;
|
||||
NickAlias *na = NULL;
|
||||
if (ischan)
|
||||
ci = cs_findchan(nname);
|
||||
else
|
||||
|
||||
@@ -52,7 +52,7 @@ class CommandMSDel : public Command
|
||||
User *u = source.u;
|
||||
|
||||
MemoInfo *mi;
|
||||
ChannelInfo *ci;
|
||||
ChannelInfo *ci = NULL;
|
||||
Anope::string numstr = !params.empty() ? params[0] : "", chan;
|
||||
|
||||
if (!numstr.empty() && numstr[0] == '#')
|
||||
|
||||
@@ -28,7 +28,7 @@ class CommandMSInfo : public Command
|
||||
|
||||
const MemoInfo *mi;
|
||||
const NickAlias *na = NULL;
|
||||
ChannelInfo *ci;
|
||||
ChannelInfo *ci = NULL;
|
||||
const Anope::string &nname = !params.empty() ? params[0] : "";
|
||||
int hardmax = 0;
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ class CommandMSList : public Command
|
||||
User *u = source.u;
|
||||
|
||||
Anope::string param = !params.empty() ? params[0] : "", chan;
|
||||
ChannelInfo *ci;
|
||||
ChannelInfo *ci = NULL;
|
||||
const MemoInfo *mi;
|
||||
|
||||
if (!param.empty() && param[0] == '#')
|
||||
|
||||
@@ -96,7 +96,7 @@ class CommandMSRead : public Command
|
||||
User *u = source.u;
|
||||
|
||||
MemoInfo *mi;
|
||||
ChannelInfo *ci;
|
||||
ChannelInfo *ci = NULL;
|
||||
Anope::string numstr = params[0], chan;
|
||||
|
||||
if (!numstr.empty() && numstr[0] == '#')
|
||||
|
||||
@@ -51,7 +51,7 @@ struct AJoinList : std::vector<std::pair<Anope::string, Anope::string> >, Extens
|
||||
|
||||
AJoinList *aj;
|
||||
if (obj)
|
||||
aj = debug_cast<AJoinList *>(obj);
|
||||
aj = anope_dynamic_static_cast<AJoinList *>(obj);
|
||||
else
|
||||
{
|
||||
aj = new AJoinList(nc);
|
||||
|
||||
@@ -48,7 +48,7 @@ struct NSMiscData : ExtensibleItem, Serializable
|
||||
NSMiscData *d;
|
||||
if (obj)
|
||||
{
|
||||
d = debug_cast<NSMiscData *>(obj);
|
||||
d = anope_dynamic_static_cast<NSMiscData *>(obj);
|
||||
d->nc = nc;
|
||||
data["name"] >> d->name;
|
||||
data["data"] >> d->data;
|
||||
|
||||
@@ -45,7 +45,7 @@ struct NickSuspend : ExtensibleItem, Serializable
|
||||
|
||||
NickSuspend *ns;
|
||||
if (obj)
|
||||
ns = debug_cast<NickSuspend *>(obj);
|
||||
ns = anope_dynamic_static_cast<NickSuspend *>(obj);
|
||||
else
|
||||
ns = new NickSuspend();
|
||||
|
||||
|
||||
@@ -69,63 +69,63 @@ class CommandOSConfig : public Command
|
||||
{
|
||||
case DT_NOSPACES:
|
||||
{
|
||||
ValueContainerString *vcs = debug_cast<ValueContainerString *>(v->val);
|
||||
ValueContainerString *vcs = anope_dynamic_static_cast<ValueContainerString *>(v->val);
|
||||
Config->ValidateNoSpaces(vi.GetValue(), v->tag, v->value);
|
||||
vcs->Set(vi.GetValue());
|
||||
break;
|
||||
}
|
||||
case DT_HOSTNAME:
|
||||
{
|
||||
ValueContainerString *vcs = debug_cast<ValueContainerString *>(v->val);
|
||||
ValueContainerString *vcs = anope_dynamic_static_cast<ValueContainerString *>(v->val);
|
||||
Config->ValidateHostname(vi.GetValue(), v->tag, v->value);
|
||||
vcs->Set(vi.GetValue());
|
||||
break;
|
||||
}
|
||||
case DT_IPADDRESS:
|
||||
{
|
||||
ValueContainerString *vcs = debug_cast<ValueContainerString *>(v->val);
|
||||
ValueContainerString *vcs = anope_dynamic_static_cast<ValueContainerString *>(v->val);
|
||||
Config->ValidateIP(vi.GetValue(), v->tag, v->value, allow_wild);
|
||||
vcs->Set(vi.GetValue());
|
||||
break;
|
||||
}
|
||||
case DT_STRING:
|
||||
{
|
||||
ValueContainerString *vcs = debug_cast<ValueContainerString *>(v->val);
|
||||
ValueContainerString *vcs = anope_dynamic_static_cast<ValueContainerString *>(v->val);
|
||||
vcs->Set(vi.GetValue());
|
||||
break;
|
||||
}
|
||||
case DT_INTEGER:
|
||||
{
|
||||
int val = vi.GetInteger();
|
||||
ValueContainerInt *vci = debug_cast<ValueContainerInt *>(v->val);
|
||||
ValueContainerInt *vci = anope_dynamic_static_cast<ValueContainerInt *>(v->val);
|
||||
vci->Set(&val, sizeof(int));
|
||||
break;
|
||||
}
|
||||
case DT_UINTEGER:
|
||||
{
|
||||
unsigned val = vi.GetInteger();
|
||||
ValueContainerUInt *vci = debug_cast<ValueContainerUInt *>(v->val);
|
||||
ValueContainerUInt *vci = anope_dynamic_static_cast<ValueContainerUInt *>(v->val);
|
||||
vci->Set(&val, sizeof(unsigned));
|
||||
break;
|
||||
}
|
||||
case DT_LUINTEGER:
|
||||
{
|
||||
unsigned long val = vi.GetInteger();
|
||||
ValueContainerLUInt *vci = debug_cast<ValueContainerLUInt *>(v->val);
|
||||
ValueContainerLUInt *vci = anope_dynamic_static_cast<ValueContainerLUInt *>(v->val);
|
||||
vci->Set(&val, sizeof(unsigned long));
|
||||
break;
|
||||
}
|
||||
case DT_TIME:
|
||||
{
|
||||
time_t time = dotime(vi.GetValue());
|
||||
ValueContainerTime *vci = debug_cast<ValueContainerTime *>(v->val);
|
||||
ValueContainerTime *vci = anope_dynamic_static_cast<ValueContainerTime *>(v->val);
|
||||
vci->Set(&time, sizeof(time_t));
|
||||
break;
|
||||
}
|
||||
case DT_BOOLEAN:
|
||||
{
|
||||
bool val = vi.GetBool();
|
||||
ValueContainerBool *vcb = debug_cast<ValueContainerBool *>(v->val);
|
||||
ValueContainerBool *vcb = anope_dynamic_static_cast<ValueContainerBool *>(v->val);
|
||||
vcb->Set(&val, sizeof(bool));
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -293,7 +293,7 @@ class OSDefcon : public Module
|
||||
|
||||
if (cm->Type == MODE_PARAM)
|
||||
{
|
||||
cmp = debug_cast<ChannelModeParam *>(cm);
|
||||
cmp = anope_dynamic_static_cast<ChannelModeParam *>(cm);
|
||||
|
||||
if (!ss.GetToken(param))
|
||||
{
|
||||
|
||||
@@ -60,7 +60,7 @@ Serializable* ForbidData::unserialize(Serializable *obj, Serialize::Data &data)
|
||||
|
||||
ForbidData *fb;
|
||||
if (obj)
|
||||
fb = debug_cast<ForbidData *>(obj);
|
||||
fb = anope_dynamic_static_cast<ForbidData *>(obj);
|
||||
else
|
||||
fb = new ForbidData;
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ Serializable* IgnoreData::unserialize(Serializable *obj, Serialize::Data &data)
|
||||
|
||||
if (obj)
|
||||
{
|
||||
IgnoreData *ign = debug_cast<IgnoreData *>(obj);
|
||||
IgnoreData *ign = anope_dynamic_static_cast<IgnoreData *>(obj);
|
||||
data["mask"] >> ign->mask;
|
||||
data["creator"] >> ign->creator;
|
||||
data["reason"] >> ign->reason;
|
||||
|
||||
@@ -60,7 +60,7 @@ Serializable* NewsItem::unserialize(Serializable *obj, Serialize::Data &data)
|
||||
|
||||
NewsItem *ni;
|
||||
if (obj)
|
||||
ni = debug_cast<NewsItem *>(obj);
|
||||
ni = anope_dynamic_static_cast<NewsItem *>(obj);
|
||||
else
|
||||
ni = new NewsItem();
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ struct MyOper : Oper, Serializable
|
||||
|
||||
MyOper *myo;
|
||||
if (obj)
|
||||
myo = debug_cast<MyOper *>(obj);
|
||||
myo = anope_dynamic_static_cast<MyOper *>(obj);
|
||||
else
|
||||
myo = new MyOper(nc->display, ot);
|
||||
nc->o = myo;
|
||||
|
||||
@@ -72,7 +72,7 @@ Serializable* Exception::unserialize(Serializable *obj, Serialize::Data &data)
|
||||
|
||||
Exception *ex;
|
||||
if (obj)
|
||||
ex = debug_cast<Exception *>(obj);
|
||||
ex = anope_dynamic_static_cast<Exception *>(obj);
|
||||
else
|
||||
ex = new Exception;
|
||||
data["mask"] >> ex->mask;
|
||||
|
||||
@@ -228,7 +228,7 @@ ClientSocket *SSLSocketIO::Accept(ListenSocket *s)
|
||||
|
||||
ClientSocket *newsocket = s->OnAccept(newsock, conaddr);
|
||||
me->service.Init(newsocket);
|
||||
SSLSocketIO *IO = debug_cast<SSLSocketIO *>(newsocket->IO);
|
||||
SSLSocketIO *IO = anope_dynamic_static_cast<SSLSocketIO *>(newsocket->IO);
|
||||
|
||||
IO->sslsock = SSL_new(server_ctx);
|
||||
if (!IO->sslsock)
|
||||
@@ -254,7 +254,7 @@ SocketFlag SSLSocketIO::FinishAccept(ClientSocket *cs)
|
||||
else if (!cs->HasFlag(SF_ACCEPTING))
|
||||
throw SocketException("SSLSocketIO::FinishAccept called for a socket not accepted nor accepting?");
|
||||
|
||||
SSLSocketIO *IO = debug_cast<SSLSocketIO *>(cs->IO);
|
||||
SSLSocketIO *IO = anope_dynamic_static_cast<SSLSocketIO *>(cs->IO);
|
||||
|
||||
int ret = SSL_accept(IO->sslsock);
|
||||
if (ret <= 0)
|
||||
@@ -323,7 +323,7 @@ SocketFlag SSLSocketIO::FinishConnect(ConnectionSocket *s)
|
||||
else if (!s->HasFlag(SF_CONNECTING))
|
||||
throw SocketException("SSLSocketIO::FinishConnect called for a socket not connected nor connecting?");
|
||||
|
||||
SSLSocketIO *IO = debug_cast<SSLSocketIO *>(s->IO);
|
||||
SSLSocketIO *IO = anope_dynamic_static_cast<SSLSocketIO *>(s->IO);
|
||||
|
||||
if (IO->sslsock == NULL)
|
||||
{
|
||||
|
||||
@@ -93,7 +93,7 @@ class MyXMLRPCEvent : public XMLRPCEvent
|
||||
if (created && u)
|
||||
{
|
||||
User *useru = u;
|
||||
XMLRPCUser *myu = debug_cast<XMLRPCUser *>(useru);
|
||||
XMLRPCUser *myu = anope_dynamic_static_cast<XMLRPCUser *>(useru);
|
||||
if (!myu->GetOut().empty())
|
||||
request->reply("return", iface->Sanitize(myu->GetOut()));
|
||||
delete u;
|
||||
|
||||
@@ -664,7 +664,7 @@ class Inspircd20IRCdMessage : public InspircdIRCdMessage
|
||||
continue;
|
||||
}
|
||||
|
||||
ChannelModeStatus *cms = debug_cast<ChannelModeStatus *>(cm);
|
||||
ChannelModeStatus *cms = anope_dynamic_static_cast<ChannelModeStatus *>(cm);
|
||||
cms->Level = level--;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -116,7 +116,7 @@ Serializable* ChanAccess::unserialize(Serializable *obj, Serialize::Data &data)
|
||||
|
||||
ChanAccess *access;
|
||||
if (obj)
|
||||
access = debug_cast<ChanAccess *>(obj);
|
||||
access = anope_dynamic_static_cast<ChanAccess *>(obj);
|
||||
else
|
||||
access = const_cast<ChanAccess *>(aprovider->Create());
|
||||
access->provider = aprovider;
|
||||
|
||||
+1
-1
@@ -97,7 +97,7 @@ Serializable* BotInfo::unserialize(Serializable *obj, Serialize::Data &data)
|
||||
{
|
||||
BotInfo *bi;
|
||||
if (obj)
|
||||
bi = debug_cast<BotInfo *>(obj);
|
||||
bi = anope_dynamic_static_cast<BotInfo *>(obj);
|
||||
else if (!(bi = findbot(data["nick"].astr())))
|
||||
bi = new BotInfo(data["nick"].astr(), data["user"].astr(), data["host"].astr(), data["realname"].astr());
|
||||
data["created"] >> bi->created;
|
||||
|
||||
+11
-11
@@ -299,7 +299,7 @@ bool Channel::HasUserStatus(const User *u, ChannelModeStatus *cms) const
|
||||
*/
|
||||
bool Channel::HasUserStatus(const User *u, ChannelModeName Name) const
|
||||
{
|
||||
return HasUserStatus(u, debug_cast<ChannelModeStatus *>(ModeManager::FindChannelModeByName(Name)));
|
||||
return HasUserStatus(u, anope_dynamic_static_cast<ChannelModeStatus *>(ModeManager::FindChannelModeByName(Name)));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -387,7 +387,7 @@ void Channel::SetModeInternal(User *setter, ChannelMode *cm, const Anope::string
|
||||
|
||||
if (cm->Type == MODE_LIST)
|
||||
{
|
||||
ChannelModeList *cml = debug_cast<ChannelModeList *>(cm);
|
||||
ChannelModeList *cml = anope_dynamic_static_cast<ChannelModeList *>(cm);
|
||||
cml->OnAdd(this, param);
|
||||
}
|
||||
|
||||
@@ -474,7 +474,7 @@ void Channel::RemoveModeInternal(User *setter, ChannelMode *cm, const Anope::str
|
||||
|
||||
if (cm->Type == MODE_LIST)
|
||||
{
|
||||
ChannelModeList *cml = debug_cast<ChannelModeList *>(cm);
|
||||
ChannelModeList *cml = anope_dynamic_static_cast<ChannelModeList *>(cm);
|
||||
cml->OnDel(this, param);
|
||||
}
|
||||
|
||||
@@ -515,7 +515,7 @@ void Channel::SetMode(BotInfo *bi, ChannelMode *cm, const Anope::string ¶m,
|
||||
return;
|
||||
else if (cm->Type == MODE_PARAM)
|
||||
{
|
||||
ChannelModeParam *cmp = debug_cast<ChannelModeParam *>(cm);
|
||||
ChannelModeParam *cmp = anope_dynamic_static_cast<ChannelModeParam *>(cm);
|
||||
if (!cmp->IsValid(param))
|
||||
return;
|
||||
|
||||
@@ -526,12 +526,12 @@ void Channel::SetMode(BotInfo *bi, ChannelMode *cm, const Anope::string ¶m,
|
||||
else if (cm->Type == MODE_STATUS)
|
||||
{
|
||||
User *u = finduser(param);
|
||||
if (!u || HasUserStatus(u, debug_cast<ChannelModeStatus *>(cm)))
|
||||
if (!u || HasUserStatus(u, anope_dynamic_static_cast<ChannelModeStatus *>(cm)))
|
||||
return;
|
||||
}
|
||||
else if (cm->Type == MODE_LIST)
|
||||
{
|
||||
ChannelModeList *cml = debug_cast<ChannelModeList *>(cm);
|
||||
ChannelModeList *cml = anope_dynamic_static_cast<ChannelModeList *>(cm);
|
||||
if (this->HasMode(cm->Name, param) || !cml->IsValid(param))
|
||||
return;
|
||||
}
|
||||
@@ -569,7 +569,7 @@ void Channel::RemoveMode(BotInfo *bi, ChannelMode *cm, const Anope::string ¶
|
||||
else if (cm->Type == MODE_STATUS)
|
||||
{
|
||||
User *u = finduser(param);
|
||||
if (!u || !HasUserStatus(u, debug_cast<ChannelModeStatus *>(cm)))
|
||||
if (!u || !HasUserStatus(u, anope_dynamic_static_cast<ChannelModeStatus *>(cm)))
|
||||
return;
|
||||
}
|
||||
else if (cm->Type == MODE_LIST)
|
||||
@@ -583,7 +583,7 @@ void Channel::RemoveMode(BotInfo *bi, ChannelMode *cm, const Anope::string ¶
|
||||
if (cm->Type == MODE_PARAM)
|
||||
{
|
||||
realparam.clear();
|
||||
ChannelModeParam *cmp = debug_cast<ChannelModeParam *>(cm);
|
||||
ChannelModeParam *cmp = anope_dynamic_static_cast<ChannelModeParam *>(cm);
|
||||
if (!cmp->MinusNoArg)
|
||||
this->GetParam(cmp->Name, realparam);
|
||||
}
|
||||
@@ -734,7 +734,7 @@ void Channel::SetModesInternal(User *setter, const Anope::string &mode, bool Enf
|
||||
}
|
||||
else if (cm->Type == MODE_PARAM)
|
||||
{
|
||||
ChannelModeParam *cmp = debug_cast<ChannelModeParam *>(cm);
|
||||
ChannelModeParam *cmp = anope_dynamic_static_cast<ChannelModeParam *>(cm);
|
||||
|
||||
if (!add && cmp->MinusNoArg)
|
||||
{
|
||||
@@ -857,7 +857,7 @@ Anope::string Channel::GetModes(bool complete, bool plus)
|
||||
|
||||
if (complete && !it->second.empty())
|
||||
{
|
||||
ChannelModeParam *cmp = debug_cast<ChannelModeParam *>(cm);
|
||||
ChannelModeParam *cmp = anope_dynamic_static_cast<ChannelModeParam *>(cm);
|
||||
|
||||
if (plus || !cmp->MinusNoArg)
|
||||
params += " " + it->second;
|
||||
@@ -1368,7 +1368,7 @@ bool Entry::Matches(const User *u, bool full) const
|
||||
ChannelMode *cm = ModeManager::FindChannelModeByName(this->modename);
|
||||
if (cm != NULL && cm->Type == MODE_LIST)
|
||||
{
|
||||
ChannelModeList *cml = debug_cast<ChannelModeList *>(cm);
|
||||
ChannelModeList *cml = anope_dynamic_static_cast<ChannelModeList *>(cm);
|
||||
if (cml->Matches(u, this))
|
||||
ret = true;
|
||||
}
|
||||
|
||||
+9
-9
@@ -1501,63 +1501,63 @@ void ServerConfig::Read()
|
||||
{
|
||||
case DT_NOSPACES:
|
||||
{
|
||||
ValueContainerString *vcs = debug_cast<ValueContainerString *>(configitems.Values[Index].val);
|
||||
ValueContainerString *vcs = anope_dynamic_static_cast<ValueContainerString *>(configitems.Values[Index].val);
|
||||
ValidateNoSpaces(vi.GetValue(), configitems.Values[Index].tag, configitems.Values[Index].value);
|
||||
vcs->Set(vi.GetValue());
|
||||
break;
|
||||
}
|
||||
case DT_HOSTNAME:
|
||||
{
|
||||
ValueContainerString *vcs = debug_cast<ValueContainerString *>(configitems.Values[Index].val);
|
||||
ValueContainerString *vcs = anope_dynamic_static_cast<ValueContainerString *>(configitems.Values[Index].val);
|
||||
ValidateHostname(vi.GetValue(), configitems.Values[Index].tag, configitems.Values[Index].value);
|
||||
vcs->Set(vi.GetValue());
|
||||
break;
|
||||
}
|
||||
case DT_IPADDRESS:
|
||||
{
|
||||
ValueContainerString *vcs = debug_cast<ValueContainerString *>(configitems.Values[Index].val);
|
||||
ValueContainerString *vcs = anope_dynamic_static_cast<ValueContainerString *>(configitems.Values[Index].val);
|
||||
ValidateIP(vi.GetValue(), configitems.Values[Index].tag, configitems.Values[Index].value, allow_wild);
|
||||
vcs->Set(vi.GetValue());
|
||||
break;
|
||||
}
|
||||
case DT_STRING:
|
||||
{
|
||||
ValueContainerString *vcs = debug_cast<ValueContainerString *>(configitems.Values[Index].val);
|
||||
ValueContainerString *vcs = anope_dynamic_static_cast<ValueContainerString *>(configitems.Values[Index].val);
|
||||
vcs->Set(vi.GetValue());
|
||||
break;
|
||||
}
|
||||
case DT_INTEGER:
|
||||
{
|
||||
int val = vi.GetInteger();
|
||||
ValueContainerInt *vci = debug_cast<ValueContainerInt *>(configitems.Values[Index].val);
|
||||
ValueContainerInt *vci = anope_dynamic_static_cast<ValueContainerInt *>(configitems.Values[Index].val);
|
||||
vci->Set(&val, sizeof(int));
|
||||
break;
|
||||
}
|
||||
case DT_UINTEGER:
|
||||
{
|
||||
unsigned val = vi.GetInteger();
|
||||
ValueContainerUInt *vci = debug_cast<ValueContainerUInt *>(configitems.Values[Index].val);
|
||||
ValueContainerUInt *vci = anope_dynamic_static_cast<ValueContainerUInt *>(configitems.Values[Index].val);
|
||||
vci->Set(&val, sizeof(unsigned));
|
||||
break;
|
||||
}
|
||||
case DT_LUINTEGER:
|
||||
{
|
||||
unsigned long val = vi.GetInteger();
|
||||
ValueContainerLUInt *vci = debug_cast<ValueContainerLUInt *>(configitems.Values[Index].val);
|
||||
ValueContainerLUInt *vci = anope_dynamic_static_cast<ValueContainerLUInt *>(configitems.Values[Index].val);
|
||||
vci->Set(&val, sizeof(unsigned long));
|
||||
break;
|
||||
}
|
||||
case DT_TIME:
|
||||
{
|
||||
time_t time = dotime(vi.GetValue());
|
||||
ValueContainerTime *vci = debug_cast<ValueContainerTime *>(configitems.Values[Index].val);
|
||||
ValueContainerTime *vci = anope_dynamic_static_cast<ValueContainerTime *>(configitems.Values[Index].val);
|
||||
vci->Set(&time, sizeof(time_t));
|
||||
break;
|
||||
}
|
||||
case DT_BOOLEAN:
|
||||
{
|
||||
bool val = vi.GetBool();
|
||||
ValueContainerBool *vcb = debug_cast<ValueContainerBool *>(configitems.Values[Index].val);
|
||||
ValueContainerBool *vcb = anope_dynamic_static_cast<ValueContainerBool *>(configitems.Values[Index].val);
|
||||
vcb->Set(&val, sizeof(bool));
|
||||
break;
|
||||
}
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ Serializable* Memo::unserialize(Serializable *obj, Serialize::Data &data)
|
||||
|
||||
Memo *m;
|
||||
if (obj)
|
||||
m = debug_cast<Memo *>(obj);
|
||||
m = anope_dynamic_static_cast<Memo *>(obj);
|
||||
else
|
||||
m = new Memo();
|
||||
data["owner"] >> m->owner;
|
||||
|
||||
+11
-11
@@ -112,7 +112,7 @@ Anope::string ChannelStatus::BuildModePrefixList() const
|
||||
|
||||
if (this->HasFlag(cm->Name))
|
||||
{
|
||||
ChannelModeStatus *cms = debug_cast<ChannelModeStatus *>(cm);
|
||||
ChannelModeStatus *cms = anope_dynamic_static_cast<ChannelModeStatus *>(cm);
|
||||
ret += cms->Symbol;
|
||||
}
|
||||
}
|
||||
@@ -302,13 +302,13 @@ void StackerInfo::AddMode(Mode *mode, bool Set, const Anope::string &Param)
|
||||
|
||||
if (Type == ST_CHANNEL)
|
||||
{
|
||||
cm = debug_cast<ChannelMode *>(mode);
|
||||
cm = anope_dynamic_static_cast<ChannelMode *>(mode);
|
||||
if (cm->Type == MODE_PARAM)
|
||||
IsParam = true;
|
||||
}
|
||||
else if (Type == ST_USER)
|
||||
{
|
||||
um = debug_cast<UserMode *>(mode);
|
||||
um = anope_dynamic_static_cast<UserMode *>(mode);
|
||||
if (um->Type == MODE_PARAM)
|
||||
IsParam = true;
|
||||
}
|
||||
@@ -411,12 +411,12 @@ std::list<Anope::string> ModeManager::BuildModeStrings(StackerInfo *info)
|
||||
|
||||
if (info->Type == ST_CHANNEL)
|
||||
{
|
||||
cm = debug_cast<ChannelMode *>(it->first);
|
||||
cm = anope_dynamic_static_cast<ChannelMode *>(it->first);
|
||||
buf += cm->ModeChar;
|
||||
}
|
||||
else if (info->Type == ST_USER)
|
||||
{
|
||||
um = debug_cast<UserMode *>(it->first);
|
||||
um = anope_dynamic_static_cast<UserMode *>(it->first);
|
||||
buf += um->ModeChar;
|
||||
}
|
||||
|
||||
@@ -440,12 +440,12 @@ std::list<Anope::string> ModeManager::BuildModeStrings(StackerInfo *info)
|
||||
|
||||
if (info->Type == ST_CHANNEL)
|
||||
{
|
||||
cm = debug_cast<ChannelMode *>(it->first);
|
||||
cm = anope_dynamic_static_cast<ChannelMode *>(it->first);
|
||||
buf += cm->ModeChar;
|
||||
}
|
||||
else if (info->Type == ST_USER)
|
||||
{
|
||||
um = debug_cast<UserMode *>(it->first);
|
||||
um = anope_dynamic_static_cast<UserMode *>(it->first);
|
||||
buf += um->ModeChar;
|
||||
}
|
||||
|
||||
@@ -478,7 +478,7 @@ void ModeManager::StackerAddInternal(const BotInfo *bi, Base *Object, Mode *mode
|
||||
if (bi)
|
||||
s->bi = bi;
|
||||
else if (Type == ST_CHANNEL)
|
||||
s->bi = debug_cast<Channel *>(Object)->ci->WhoSends();
|
||||
s->bi = anope_dynamic_reinterpret_cast<Channel *>(Object)->ci->WhoSends();
|
||||
else if (Type == ST_USER)
|
||||
s->bi = NULL;
|
||||
|
||||
@@ -638,7 +638,7 @@ char ModeManager::GetStatusChar(char Value)
|
||||
ChannelMode *cm = ModeManager::ChannelModes[i];
|
||||
if (cm->Type == MODE_STATUS)
|
||||
{
|
||||
ChannelModeStatus *cms = debug_cast<ChannelModeStatus *>(cm);
|
||||
ChannelModeStatus *cms = anope_dynamic_static_cast<ChannelModeStatus *>(cm);
|
||||
|
||||
if (Value == cms->Symbol)
|
||||
return cms->ModeChar;
|
||||
@@ -685,9 +685,9 @@ void ModeManager::ProcessModes()
|
||||
Channel *c = NULL;
|
||||
|
||||
if (s->Type == ST_USER)
|
||||
u = debug_cast<User *>(it->first);
|
||||
u = anope_dynamic_reinterpret_cast<User *>(it->first);
|
||||
else if (s->Type == ST_CHANNEL)
|
||||
c = debug_cast<Channel *>(it->first);
|
||||
c = anope_dynamic_reinterpret_cast<Channel *>(it->first);
|
||||
else
|
||||
throw CoreException("ModeManager::ProcessModes got invalid Stacker Info type");
|
||||
|
||||
|
||||
+1
-1
@@ -281,7 +281,7 @@ Serializable* NickAlias::unserialize(Serializable *obj, Serialize::Data &data)
|
||||
|
||||
NickAlias *na;
|
||||
if (obj)
|
||||
na = debug_cast<NickAlias *>(obj);
|
||||
na = anope_dynamic_static_cast<NickAlias *>(obj);
|
||||
else
|
||||
na = new NickAlias(data["nick"].astr(), core);
|
||||
|
||||
|
||||
+1
-1
@@ -91,7 +91,7 @@ Serializable* NickCore::unserialize(Serializable *obj, Serialize::Data &data)
|
||||
NickCore *nc;
|
||||
|
||||
if (obj)
|
||||
nc = debug_cast<NickCore *>(obj);
|
||||
nc = anope_dynamic_static_cast<NickCore *>(obj);
|
||||
else
|
||||
nc = new NickCore(data["display"].astr());
|
||||
|
||||
|
||||
+1
-1
@@ -168,7 +168,7 @@ Serializable* XLine::unserialize(Serializable *obj, Serialize::Data &data)
|
||||
XLine *xl;
|
||||
if (obj)
|
||||
{
|
||||
xl = debug_cast<XLine *>(obj);
|
||||
xl = anope_dynamic_static_cast<XLine *>(obj);
|
||||
data["mask"] >> xl->Mask;
|
||||
data["by"] >> xl->By;
|
||||
data["reason"] >> xl->Reason;
|
||||
|
||||
+5
-5
@@ -51,7 +51,7 @@ Serializable* BadWord::unserialize(Serializable *obj, Serialize::Data &data)
|
||||
BadWord *bw;
|
||||
if (obj)
|
||||
{
|
||||
bw = debug_cast<BadWord *>(obj);
|
||||
bw = anope_dynamic_static_cast<BadWord *>(obj);
|
||||
data["word"] >> bw->word;
|
||||
bw->type = static_cast<BadWordType>(n);
|
||||
}
|
||||
@@ -98,7 +98,7 @@ Serializable* AutoKick::unserialize(Serializable *obj, Serialize::Data &data)
|
||||
NickCore *nc = findcore(data["nc"].astr());
|
||||
if (obj)
|
||||
{
|
||||
ak = debug_cast<AutoKick *>(obj);
|
||||
ak = anope_dynamic_static_cast<AutoKick *>(obj);
|
||||
data["creator"] >> ak->creator;
|
||||
data["reason"] >> ak->reason;
|
||||
ak->nc = findcore(data["nc"].astr());
|
||||
@@ -167,7 +167,7 @@ Serializable* ModeLock::unserialize(Serializable *obj, Serialize::Data &data)
|
||||
ModeLock *ml;
|
||||
if (obj)
|
||||
{
|
||||
ml = debug_cast<ModeLock *>(obj);
|
||||
ml = anope_dynamic_static_cast<ModeLock *>(obj);
|
||||
|
||||
data["set"] >> ml->set;
|
||||
ml->name = name;
|
||||
@@ -224,7 +224,7 @@ Serializable* LogSetting::unserialize(Serializable *obj, Serialize::Data &data)
|
||||
|
||||
LogSetting *ls;
|
||||
if (obj)
|
||||
ls = debug_cast<LogSetting *>(obj);
|
||||
ls = anope_dynamic_static_cast<LogSetting *>(obj);
|
||||
else
|
||||
{
|
||||
ls = new LogSetting();
|
||||
@@ -433,7 +433,7 @@ Serializable* ChannelInfo::unserialize(Serializable *obj, Serialize::Data &data)
|
||||
{
|
||||
ChannelInfo *ci;
|
||||
if (obj)
|
||||
ci = debug_cast<ChannelInfo *>(obj);
|
||||
ci = anope_dynamic_static_cast<ChannelInfo *>(obj);
|
||||
else
|
||||
ci = new ChannelInfo(data["name"].astr());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user