diff options
Diffstat (limited to 'modules/commands')
-rw-r--r-- | modules/commands/cs_enforce.cpp | 2 | ||||
-rw-r--r-- | modules/commands/cs_set.cpp | 8 | ||||
-rw-r--r-- | modules/commands/hs_request.cpp | 2 | ||||
-rw-r--r-- | modules/commands/ms_del.cpp | 2 | ||||
-rw-r--r-- | modules/commands/ms_info.cpp | 26 | ||||
-rw-r--r-- | modules/commands/ms_rsend.cpp | 2 | ||||
-rw-r--r-- | modules/commands/ms_send.cpp | 2 | ||||
-rw-r--r-- | modules/commands/ns_group.cpp | 4 | ||||
-rw-r--r-- | modules/commands/ns_register.cpp | 8 | ||||
-rw-r--r-- | modules/commands/os_forbid.cpp | 4 | ||||
-rw-r--r-- | modules/commands/os_logsearch.cpp | 8 | ||||
-rw-r--r-- | modules/commands/os_news.cpp | 5 | ||||
-rw-r--r-- | modules/commands/os_stats.cpp | 22 | ||||
-rw-r--r-- | modules/commands/os_svs.cpp | 2 |
14 files changed, 54 insertions, 43 deletions
diff --git a/modules/commands/cs_enforce.cpp b/modules/commands/cs_enforce.cpp index 46bb86a35..d0165013a 100644 --- a/modules/commands/cs_enforce.cpp +++ b/modules/commands/cs_enforce.cpp @@ -203,7 +203,7 @@ private: ci->c->Kick(NULL, user, "%s", reason.c_str()); } - source.Reply(_("LIMIT enforced on %s, %d users removed."), ci->name.c_str(), users.size()); + source.Reply(_("LIMIT enforced on %s, %zu users removed."), ci->name.c_str(), users.size()); } public: diff --git a/modules/commands/cs_set.cpp b/modules/commands/cs_set.cpp index 17183898c..973a01b23 100644 --- a/modules/commands/cs_set.cpp +++ b/modules/commands/cs_set.cpp @@ -122,7 +122,7 @@ public: source.Reply(_("Enables or disables %s's autoop feature for a\n" "channel. When disabled, users who join the channel will\n" "not automatically gain any status from %s."), source.service->nick.c_str(), - source.service->nick.c_str(), this->name.c_str()); + source.service->nick.c_str()); return true; } }; @@ -189,7 +189,7 @@ public: "0: ban in the form *!user@host\n" "1: ban in the form *!*user@host\n" "2: ban in the form *!*@host\n" - "3: ban in the form *!*user@*.domain"), this->name.c_str()); + "3: ban in the form *!*user@*.domain")); return true; } }; @@ -251,7 +251,7 @@ public: this->SendSyntax(source); source.Reply(" "); source.Reply(_("Sets the description for the channel, which shows up with\n" - "the \002LIST\002 and \002INFO\002 commands."), this->name.c_str()); + "the \002LIST\002 and \002INFO\002 commands.")); return true; } }; @@ -320,7 +320,7 @@ public: this->SendSyntax(source); source.Reply(" "); source.Reply(_("Changes the founder of a channel. The new nickname must\n" - "be a registered one."), this->name.c_str()); + "be a registered one.")); return true; } }; diff --git a/modules/commands/hs_request.cpp b/modules/commands/hs_request.cpp index f207d6966..8e63f2b9d 100644 --- a/modules/commands/hs_request.cpp +++ b/modules/commands/hs_request.cpp @@ -157,7 +157,7 @@ public: time_t send_delay = Config->GetModule("memoserv")->Get<time_t>("senddelay"); if (Config->GetModule(this->owner)->Get<bool>("memooper") && send_delay > 0 && u && u->lastmemosend + send_delay > Anope::CurTime) { - source.Reply(_("Please wait %d seconds before requesting a new vHost."), send_delay); + source.Reply(_("Please wait %lu seconds before requesting a new vHost."), (unsigned long)send_delay); u->lastmemosend = Anope::CurTime; return; } diff --git a/modules/commands/ms_del.cpp b/modules/commands/ms_del.cpp index 40be9d4d3..13f2b53d2 100644 --- a/modules/commands/ms_del.cpp +++ b/modules/commands/ms_del.cpp @@ -98,7 +98,7 @@ public: /* Delete last memo. */ FOREACH_MOD(OnMemoDel, (ci ? ci->name : source.nc->display, mi, mi->GetMemo(mi->memos->size() - 1))); mi->Del(mi->memos->size() - 1); - source.Reply(_("Memo %d has been deleted."), mi->memos->size() + 1); + source.Reply(_("Memo %zu has been deleted."), mi->memos->size() + 1); if (ci) Log(LOG_COMMAND, source, this, ci) << "on LAST memo"; } diff --git a/modules/commands/ms_info.cpp b/modules/commands/ms_info.cpp index 38c99934b..b8b44085b 100644 --- a/modules/commands/ms_info.cpp +++ b/modules/commands/ms_info.cpp @@ -80,18 +80,19 @@ public: } else { - unsigned count = 0, i, end; - for (i = 0, end = mi->memos->size(); i < end; ++i) + size_t count = 0; + for (size_t i = 0; i < mi->memos->size(); ++i) if (mi->GetMemo(i)->unread) ++count; + if (count == mi->memos->size()) - source.Reply(_("%s currently has \002%d\002 memos; all of them are unread."), nname.c_str(), count); + source.Reply(_("%s currently has \002%zu\002 memos; all of them are unread."), nname.c_str(), count); else if (!count) - source.Reply(_("%s currently has \002%d\002 memos."), nname.c_str(), mi->memos->size()); + source.Reply(_("%s currently has \002%zu\002 memos."), nname.c_str(), mi->memos->size()); else if (count == 1) - source.Reply(_("%s currently has \002%d\002 memos, of which \0021\002 is unread."), nname.c_str(), mi->memos->size()); + source.Reply(_("%s currently has \002%zu\002 memos, of which \0021\002 is unread."), nname.c_str(), mi->memos->size()); else - source.Reply(_("%s currently has \002%d\002 memos, of which \002%d\002 are unread."), nname.c_str(), mi->memos->size(), count); + source.Reply(_("%s currently has \002%zu\002 memos, of which \002%zu\002 are unread."), nname.c_str(), mi->memos->size(), count); } if (!mi->memomax) { @@ -137,18 +138,19 @@ public: } else { - unsigned count = 0, i, end; - for (i = 0, end = mi->memos->size(); i < end; ++i) + size_t count = 0; + for (size_t i = 0; i < mi->memos->size(); ++i) if (mi->GetMemo(i)->unread) ++count; + if (count == mi->memos->size()) - source.Reply(_("You currently have \002%d\002 memos; all of them are unread."), count); + source.Reply(_("You currently have \002%zu\002 memos; all of them are unread."), count); else if (!count) - source.Reply(_("You currently have \002%d\002 memos."), mi->memos->size()); + source.Reply(_("You currently have \002%zu\002 memos."), mi->memos->size()); else if (count == 1) - source.Reply(_("You currently have \002%d\002 memos, of which \0021\002 is unread."), mi->memos->size()); + source.Reply(_("You currently have \002%zu\002 memos, of which \0021\002 is unread."), mi->memos->size()); else - source.Reply(_("You currently have \002%d\002 memos, of which \002%d\002 are unread."), mi->memos->size(), count); + source.Reply(_("You currently have \002%zu\002 memos, of which \002%zu\002 are unread."), mi->memos->size(), count); } if (!mi->memomax) diff --git a/modules/commands/ms_rsend.cpp b/modules/commands/ms_rsend.cpp index c3be36838..854b4e2be 100644 --- a/modules/commands/ms_rsend.cpp +++ b/modules/commands/ms_rsend.cpp @@ -55,7 +55,7 @@ public: if (result == MemoServService::MEMO_INVALID_TARGET) source.Reply(_("\002%s\002 is not a registered unforbidden nick or channel."), nick.c_str()); else if (result == MemoServService::MEMO_TOO_FAST) - source.Reply(_("Please wait %d seconds before using the %s command again."), Config->GetModule("memoserv")->Get<time_t>("senddelay"), source.command.c_str()); + source.Reply(_("Please wait %lu seconds before using the %s command again."), Config->GetModule("memoserv")->Get<unsigned long>("senddelay"), source.command.c_str()); else if (result == MemoServService::MEMO_TARGET_FULL) source.Reply(_("Sorry, %s currently has too many memos and cannot receive more."), nick.c_str()); else diff --git a/modules/commands/ms_send.cpp b/modules/commands/ms_send.cpp index 3000d9891..141cca01f 100644 --- a/modules/commands/ms_send.cpp +++ b/modules/commands/ms_send.cpp @@ -54,7 +54,7 @@ public: else if (result == MemoServService::MEMO_INVALID_TARGET) source.Reply(_("\002%s\002 is not a registered unforbidden nick or channel."), nick.c_str()); else if (result == MemoServService::MEMO_TOO_FAST) - source.Reply(_("Please wait %d seconds before using the %s command again."), Config->GetModule("memoserv")->Get<time_t>("senddelay"), source.command.c_str()); + source.Reply(_("Please wait %lu seconds before using the %s command again."), Config->GetModule("memoserv")->Get<unsigned long>("senddelay"), source.command.c_str()); else if (result == MemoServService::MEMO_TARGET_FULL) source.Reply(_("Sorry, %s currently has too many memos and cannot receive more."), nick.c_str()); } diff --git a/modules/commands/ns_group.cpp b/modules/commands/ns_group.cpp index fd735d506..6f45d7f49 100644 --- a/modules/commands/ns_group.cpp +++ b/modules/commands/ns_group.cpp @@ -146,7 +146,7 @@ public: if (!(target = NickAlias::Find(nick))) source.Reply(NICK_X_NOT_REGISTERED, nick.c_str()); else if (user && Anope::CurTime < user->lastnickreg + reg_delay) - source.Reply(_("Please wait %d seconds before using the GROUP command again."), (reg_delay + user->lastnickreg) - Anope::CurTime); + source.Reply(_("Please wait %lu seconds before using the GROUP command again."), (unsigned long)(reg_delay + user->lastnickreg) - Anope::CurTime); else if (target->nc->HasExt("NS_SUSPENDED")) { Log(LOG_COMMAND, source, this) << "and tried to group to SUSPENDED nick " << target->nick; @@ -352,7 +352,7 @@ public: for (const auto &reply : replies) source.Reply(reply); - source.Reply(_("%d nickname(s) in the group."), nc->aliases->size()); + source.Reply(_("%zu nickname(s) in the group."), nc->aliases->size()); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override diff --git a/modules/commands/ns_register.cpp b/modules/commands/ns_register.cpp index 7fdca9d03..a5281b4be 100644 --- a/modules/commands/ns_register.cpp +++ b/modules/commands/ns_register.cpp @@ -152,7 +152,8 @@ public: time_t reg_delay = Config->GetModule("nickserv")->Get<time_t>("regdelay"); if (u && !u->HasMode("OPER") && nickregdelay && Anope::CurTime - u->timestamp < nickregdelay) { - source.Reply(_("You must have been using this nick for at least %d seconds to register."), nickregdelay); + source.Reply(_("You must have been using this nick for at least %lu seconds to register."), + (unsigned long)nickregdelay); return; } @@ -198,7 +199,10 @@ public: if (Config->GetModule("nickserv")->Get<bool>("forceemail", "yes") && email.empty()) this->OnSyntaxError(source, ""); else if (u && Anope::CurTime < u->lastnickreg + reg_delay) - source.Reply(_("Please wait %d seconds before using the REGISTER command again."), (u->lastnickreg + reg_delay) - Anope::CurTime); + { + source.Reply(_("Please wait %lu seconds before using the REGISTER command again."), + (unsigned long)(u->lastnickreg + reg_delay) - Anope::CurTime); + } else if (NickAlias::Find(u_nick) != NULL) source.Reply(NICK_ALREADY_REGISTERED, u_nick.c_str()); else if (pass.equals_ci(u_nick)) diff --git a/modules/commands/os_forbid.cpp b/modules/commands/os_forbid.cpp index 41e36aee4..4523e694b 100644 --- a/modules/commands/os_forbid.cpp +++ b/modules/commands/os_forbid.cpp @@ -356,7 +356,7 @@ public: ListFormatter list(source.GetAccount()); list.AddColumn(_("Mask")).AddColumn(_("Type")).AddColumn(_("Creator")).AddColumn(_("Expires")).AddColumn(_("Reason")); - unsigned shown = 0; + size_t shown = 0; for (auto *forbid : forbids) { if (ftype != FT_SIZE && ftype != forbid->type) @@ -401,7 +401,7 @@ public: if (shown >= forbids.size()) source.Reply(_("End of forbid list.")); else - source.Reply(_("End of forbid list - %d/%d entries shown."), shown, forbids.size()); + source.Reply(_("End of forbid list - %zu/%zu entries shown."), shown, forbids.size()); } } } diff --git a/modules/commands/os_logsearch.cpp b/modules/commands/os_logsearch.cpp index 9293feffa..cec0d0b50 100644 --- a/modules/commands/os_logsearch.cpp +++ b/modules/commands/os_logsearch.cpp @@ -127,7 +127,7 @@ public: fd.close(); } - unsigned int found = matches.size(); + size_t found = matches.size(); if (!found) { source.Reply(_("No matches for \002%s\002 found."), search_string.c_str()); @@ -146,10 +146,10 @@ public: } source.Reply(_("Matches for \002%s\002:"), search_string.c_str()); - unsigned int count = 0; + size_t count = 0; for (const auto &match : matches) - source.Reply("#%d: %s", ++count, match.c_str()); - source.Reply(_("Showed %d/%d matches for \002%s\002."), matches.size(), found, search_string.c_str()); + source.Reply("#%zu: %s", ++count, match.c_str()); + source.Reply(_("Showed %zu/%zu matches for \002%s\002."), matches.size(), found, search_string.c_str()); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override diff --git a/modules/commands/os_news.cpp b/modules/commands/os_news.cpp index 72435de67..631c7abb5 100644 --- a/modules/commands/os_news.cpp +++ b/modules/commands/os_news.cpp @@ -12,6 +12,11 @@ #include "module.h" #include "modules/os_news.h" +// TODO: msgarray breaks the format string checking +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wformat-security" +#endif + /* List of messages for each news type. This simplifies message sending. */ enum diff --git a/modules/commands/os_stats.cpp b/modules/commands/os_stats.cpp index 71a37930a..e7575f288 100644 --- a/modules/commands/os_stats.cpp +++ b/modules/commands/os_stats.cpp @@ -68,7 +68,7 @@ private: if (akills) { /* AKILLs */ - source.Reply(_("Current number of AKILLs: \002%d\002"), akills->GetCount()); + source.Reply(_("Current number of AKILLs: \002%zu\002"), akills->GetCount()); timeout = Config->GetModule("operserv")->Get<time_t>("autokillexpiry", "30d") + 59; if (timeout >= 172800) source.Reply(_("Default AKILL expiry time: \002%d days\002"), timeout / 86400); @@ -88,7 +88,7 @@ private: if (snlines) { /* SNLINEs */ - source.Reply(_("Current number of SNLINEs: \002%d\002"), snlines->GetCount()); + source.Reply(_("Current number of SNLINEs: \002%zu\002"), snlines->GetCount()); timeout = Config->GetModule("operserv")->Get<time_t>("snlineexpiry", "30d") + 59; if (timeout >= 172800) source.Reply(_("Default SNLINE expiry time: \002%d days\002"), timeout / 86400); @@ -108,7 +108,7 @@ private: if (sqlines) { /* SQLINEs */ - source.Reply(_("Current number of SQLINEs: \002%d\002"), sqlines->GetCount()); + source.Reply(_("Current number of SQLINEs: \002%zu\002"), sqlines->GetCount()); timeout = Config->GetModule("operserv")->Get<time_t>("sglineexpiry", "30d") + 59; if (timeout >= 172800) source.Reply(_("Default SQLINE expiry time: \002%d days\002"), timeout / 86400); @@ -137,7 +137,7 @@ private: void DoStatsUptime(CommandSource &source) { time_t uptime = Anope::CurTime - Anope::StartTime; - source.Reply(_("Current users: \002%d\002 (\002%d\002 ops)"), UserListByNick.size(), OperCount); + source.Reply(_("Current users: \002%zu\002 (\002%d\002 ops)"), UserListByNick.size(), OperCount); source.Reply(_("Maximum users: \002%d\002 (%s)"), MaxUserCount, Anope::strftime(MaxUserTime, source.GetAccount()).c_str()); source.Reply(_("Services up %s."), Anope::Duration(uptime, source.GetAccount()).c_str()); @@ -171,30 +171,30 @@ private: size_t entries, buckets, max_chain; GetHashStats(UserListByNick, entries, buckets, max_chain); - source.Reply(_("Users (nick): %lu entries, %lu buckets, longest chain is %d"), entries, buckets, max_chain); + source.Reply(_("Users (nick): %lu entries, %lu buckets, longest chain is %zu"), entries, buckets, max_chain); if (!UserListByUID.empty()) { GetHashStats(UserListByUID, entries, buckets, max_chain); - source.Reply(_("Users (uid): %lu entries, %lu buckets, longest chain is %d"), entries, buckets, max_chain); + source.Reply(_("Users (uid): %lu entries, %lu buckets, longest chain is %zu"), entries, buckets, max_chain); } GetHashStats(ChannelList, entries, buckets, max_chain); - source.Reply(_("Channels: %lu entries, %lu buckets, longest chain is %d"), entries, buckets, max_chain); + source.Reply(_("Channels: %zu entries, %zu buckets, longest chain is %zu"), entries, buckets, max_chain); GetHashStats(*RegisteredChannelList, entries, buckets, max_chain); - source.Reply(_("Registered channels: %lu entries, %lu buckets, longest chain is %d"), entries, buckets, max_chain); + source.Reply(_("Registered channels: %zu entries, %zu buckets, longest chain is %zu"), entries, buckets, max_chain); GetHashStats(*NickAliasList, entries, buckets, max_chain); - source.Reply(_("Registered nicknames: %lu entries, %lu buckets, longest chain is %d"), entries, buckets, max_chain); + source.Reply(_("Registered nicknames: %zu entries, %zu buckets, longest chain is %zu"), entries, buckets, max_chain); GetHashStats(*NickCoreList, entries, buckets, max_chain); - source.Reply(_("Registered nick groups: %lu entries, %lu buckets, longest chain is %d"), entries, buckets, max_chain); + source.Reply(_("Registered nick groups: %zu entries, %zu buckets, longest chain is %zu"), entries, buckets, max_chain); if (session_service) { GetHashStats(session_service->GetSessions(), entries, buckets, max_chain); - source.Reply(_("Sessions: %lu entries, %lu buckets, longest chain is %d"), entries, buckets, max_chain); + source.Reply(_("Sessions: %zu entries, %zu buckets, longest chain is %zu"), entries, buckets, max_chain); } } diff --git a/modules/commands/os_svs.cpp b/modules/commands/os_svs.cpp index b8586be9c..e9ef64bf9 100644 --- a/modules/commands/os_svs.cpp +++ b/modules/commands/os_svs.cpp @@ -36,7 +36,7 @@ public: unsigned nicklen = Config->GetBlock("networkinfo")->Get<unsigned>("nicklen"); if (newnick.length() > nicklen) { - source.Reply(_("Nick \002%s\002 was truncated to %d characters."), newnick.c_str(), nicklen, newnick.c_str()); + source.Reply(_("Nick \002%s\002 was truncated to %u characters."), newnick.c_str(), nicklen); newnick = params[1].substr(0, nicklen); } |