summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Powell <petpow@saberuk.com>2018-04-16 22:20:29 +0100
committerPeter Powell <petpow@saberuk.com>2018-04-17 18:36:50 +0100
commiteff72815b561c1241a00405485d26331ff0a0788 (patch)
tree8775c8d9b37aad5549f64430f30983d9848b8875 /src
parent11a9aaeaa7e979ca4e0a91bc7f001cef2e7138a6 (diff)
Convert some usages of ato[il] to use ConvToNum.
Diffstat (limited to 'src')
-rw-r--r--src/modules/m_anticaps.cpp4
-rw-r--r--src/modules/m_operlevels.cpp12
-rw-r--r--src/modules/m_spanningtree/save.cpp2
3 files changed, 10 insertions, 8 deletions
diff --git a/src/modules/m_anticaps.cpp b/src/modules/m_anticaps.cpp
index 6b0c192be..b6167893c 100644
--- a/src/modules/m_anticaps.cpp
+++ b/src/modules/m_anticaps.cpp
@@ -75,7 +75,7 @@ class AntiCapsMode : public ParamMode<AntiCapsMode, SimpleExtItem<AntiCapsSettin
if (!stream.GetToken(minlenstr))
return false;
- uint16_t result = atoi(minlenstr.c_str());
+ uint16_t result = ConvToNum<uint16_t>(minlenstr);
if (result < 1 || result > ServerInstance->Config->Limits.MaxLine)
return false;
@@ -89,7 +89,7 @@ class AntiCapsMode : public ParamMode<AntiCapsMode, SimpleExtItem<AntiCapsSettin
if (!stream.GetToken(percentstr))
return false;
- int result = atoi(percentstr.c_str());
+ uint8_t result = ConvToNum<uint8_t>(percentstr);
if (result < 1 || result > 100)
return false;
diff --git a/src/modules/m_operlevels.cpp b/src/modules/m_operlevels.cpp
index bf758b1f7..2e02ffddf 100644
--- a/src/modules/m_operlevels.cpp
+++ b/src/modules/m_operlevels.cpp
@@ -35,14 +35,16 @@ class ModuleOperLevels : public Module
// oper killing an oper?
if (dest->IsOper() && source->IsOper())
{
- std::string level = dest->oper->getConfig("level");
- long dest_level = atol(level.c_str());
- level = source->oper->getConfig("level");
- long source_level = atol(level.c_str());
+ unsigned long dest_level = ConvToNum<unsigned long>(dest->oper->getConfig("level"));
+ unsigned long source_level = ConvToNum<unsigned long>(source->oper->getConfig("level"));
if (dest_level > source_level)
{
- if (IS_LOCAL(source)) ServerInstance->SNO->WriteGlobalSno('a', "Oper %s (level %ld) attempted to /kill a higher oper: %s (level %ld): Reason: %s",source->nick.c_str(),source_level,dest->nick.c_str(),dest_level,reason.c_str());
+ if (IS_LOCAL(source))
+ {
+ ServerInstance->SNO->WriteGlobalSno('a', "Oper %s (level %lu) attempted to /kill a higher oper: %s (level %lu): Reason: %s",
+ source->nick.c_str(), source_level, dest->nick.c_str(), dest_level, reason.c_str());
+ }
dest->WriteNotice("*** Oper " + source->nick + " attempted to /kill you!");
source->WriteNumeric(ERR_NOPRIVILEGES, InspIRCd::Format("Permission Denied - Oper %s is a higher level than you", dest->nick.c_str()));
return MOD_RES_DENY;
diff --git a/src/modules/m_spanningtree/save.cpp b/src/modules/m_spanningtree/save.cpp
index 7131b49fe..d77c2a382 100644
--- a/src/modules/m_spanningtree/save.cpp
+++ b/src/modules/m_spanningtree/save.cpp
@@ -32,7 +32,7 @@ CmdResult CommandSave::Handle(User* user, std::vector<std::string>& params)
if (!u)
return CMD_FAILURE;
- time_t ts = atol(params[1].c_str());
+ time_t ts = ConvToNum<time_t>(params[1]);
if (u->age == ts)
u->ChangeNick(u->uuid, SavedTimestamp);