From 5095617d6c53081521efb673823946cbfc183753 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Sun, 29 Mar 2026 13:34:14 +0100 Subject: Avoid the direct use of intptr_t wherever possible. This may cause problems on systems like CheriBSD where the pointer type stores extra data. --- modules/delaymsg.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'modules/delaymsg.cpp') diff --git a/modules/delaymsg.cpp b/modules/delaymsg.cpp index 103ab3ae4..4997ad26a 100644 --- a/modules/delaymsg.cpp +++ b/modules/delaymsg.cpp @@ -28,13 +28,15 @@ #include "timeutils.h" #include "numerichelper.h" +using TimeExtItem = NumExtItem; + class DelayMsgMode final - : public ParamMode + : public ParamMode { public: - IntExtItem jointime; + TimeExtItem jointime; DelayMsgMode(const WeakModulePtr& Parent) - : ParamMode(Parent, "delaymsg", 'd') + : ParamMode(Parent, "delaymsg", 'd') , jointime(Parent, "delaymsg", ExtensionType::MEMBERSHIP) { ranktoset = ranktounset = OP_VALUE; @@ -43,13 +45,13 @@ public: bool ResolveModeConflict(const std::string& their_param, const std::string& our_param, Channel*) override { - return ConvToNum(their_param) < ConvToNum(our_param); + return ConvToNum(their_param) < ConvToNum(our_param); } bool OnSet(User* source, Channel* chan, std::string& parameter) override; void OnUnset(User* source, Channel* chan) override; - void SerializeParam(Channel* chan, intptr_t n, std::string& out) + void SerializeParam(Channel* chan, time_t n, std::string& out) { out += ConvToStr(n); } @@ -81,7 +83,7 @@ public: bool DelayMsgMode::OnSet(User* source, Channel* chan, std::string& parameter) { // Setting a new limit, sanity check - intptr_t limit = ConvToNum(parameter); + auto limit = ConvToNum(parameter); if (limit <= 0) limit = 1; @@ -129,7 +131,7 @@ ModResult ModuleDelayMsg::HandleMessage(User* user, const MessageTarget& target) if (ts == 0) return MOD_RES_PASSTHRU; - intptr_t len = djm.ext.Get(channel); + const auto len = djm.ext.Get(channel); if ((ts + len) > ServerInstance->Time()) { -- cgit v1.3.1-10-gc9f91