From af8effe4f0876d6fa934806745712f679bd36278 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Tue, 24 Jan 2023 23:41:50 +0000 Subject: Replace getInt/getUInt/getFloat with type safe templated functions. --- src/configreader.cpp | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'src/configreader.cpp') diff --git a/src/configreader.cpp b/src/configreader.cpp index 0a9256005..d7d6d2c93 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -41,17 +41,17 @@ #include "exitcodes.h" ServerLimits::ServerLimits(const std::shared_ptr& tag) - : MaxLine(tag->getUInt("maxline", 512, 512)) - , MaxNick(tag->getUInt("maxnick", 30, 1, MaxLine)) - , MaxChannel(tag->getUInt("maxchan", 60, 1, MaxLine)) - , MaxModes(tag->getUInt("maxmodes", 20, 1)) - , MaxUser(tag->getUInt("maxident", 10, 1)) - , MaxQuit(tag->getUInt("maxquit", 300, 0, MaxLine)) - , MaxTopic(tag->getUInt("maxtopic", 330, 1, MaxLine)) - , MaxKick(tag->getUInt("maxkick", 300, 1, MaxLine)) - , MaxReal(tag->getUInt("maxreal", 130, 1, MaxLine)) - , MaxAway(tag->getUInt("maxaway", 200, 1, MaxLine)) - , MaxHost(tag->getUInt("maxhost", 64, 1, MaxLine)) + : MaxLine(tag->getNum("maxline", 512, 512)) + , MaxNick(tag->getNum("maxnick", 30, 1, MaxLine)) + , MaxChannel(tag->getNum("maxchan", 60, 1, MaxLine)) + , MaxModes(tag->getNum("maxmodes", 20, 1)) + , MaxUser(tag->getNum("maxident", 10, 1)) + , MaxQuit(tag->getNum("maxquit", 300, 0, MaxLine)) + , MaxTopic(tag->getNum("maxtopic", 330, 1, MaxLine)) + , MaxKick(tag->getNum("maxkick", 300, 1, MaxLine)) + , MaxReal(tag->getNum("maxreal", 130, 1, MaxLine)) + , MaxAway(tag->getNum("maxaway", 200, 1, MaxLine)) + , MaxHost(tag->getNum("maxhost", 64, 1, MaxLine)) { } @@ -298,22 +298,22 @@ void ServerConfig::Fill() if (!nsid.empty() && nsid != sid) throw CoreException("You must restart to change the server id"); } - SoftLimit = ConfValue("performance")->getUInt("softlimit", (SocketEngine::GetMaxFds() > 0 ? SocketEngine::GetMaxFds() : LONG_MAX), 10); - MaxConn = static_cast(ConfValue("performance")->getUInt("somaxconn", SOMAXCONN)); + SoftLimit = ConfValue("performance")->getNum("softlimit", (SocketEngine::GetMaxFds() > 0 ? SocketEngine::GetMaxFds() : SIZE_MAX), 10); + MaxConn = ConfValue("performance")->getNum("somaxconn", SOMAXCONN, 1); TimeSkipWarn = ConfValue("performance")->getDuration("timeskipwarn", 2, 0, 30); XLineMessage = options->getString("xlinemessage", "You're banned!", 1); ServerDesc = server->getString("description", "Configure Me", 1); Network = server->getString("network", "Network", 1); - NetBufferSize = ConfValue("performance")->getInt("netbuffersize", 10240, 1024, 65534); + NetBufferSize = ConfValue("performance")->getNum("netbuffersize", 10240, 1024, 65534); CustomVersion = security->getString("customversion"); HideBans = security->getBool("hidebans"); HideServer = security->getString("hideserver", "", InspIRCd::IsFQDN); SyntaxHints = options->getBool("syntaxhints"); FullHostInTopic = options->getBool("hostintopic"); - MaxTargets = security->getUInt("maxtargets", 20, 1, 31); + MaxTargets = security->getNum("maxtargets", 5, 1, 50); DefaultModes = options->getString("defaultmodes", "not"); - c_ipv4_range = ConfValue("cidr")->getUInt("ipv4clone", 32, 1, 32); - c_ipv6_range = ConfValue("cidr")->getUInt("ipv6clone", 128, 1, 128); + c_ipv4_range = ConfValue("cidr")->getNum("ipv4clone", 32, 1, 32); + c_ipv6_range = ConfValue("cidr")->getNum("ipv6clone", 128, 1, 128); Limits = ServerLimits(ConfValue("limits")); Paths = ServerPaths(ConfValue("path")); NoSnoticeStack = options->getBool("nosnoticestack", false); -- cgit v1.3.1-10-gc9f91