From 0f433ebe9cb1ffdc7a9f03332468debee1432d05 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Wed, 17 Dec 2025 14:10:42 +0000 Subject: [PATCH] Remove or fix various useless uses of const. --- include/commands.h | 2 +- include/modules/httpd.h | 2 +- include/modules/sql.h | 2 +- modules/botserv/bs_info.cpp | 2 +- modules/chanserv/cs_mode.cpp | 2 +- modules/chanserv/cs_xop.cpp | 2 +- modules/httpd.cpp | 2 +- modules/operserv/os_login.cpp | 4 ++-- modules/operserv/os_sxline.cpp | 2 +- modules/proxyscan.cpp | 6 +++--- src/command.cpp | 2 +- 11 files changed, 14 insertions(+), 14 deletions(-) diff --git a/include/commands.h b/include/commands.h index 571b26589..c4dc6ba30 100644 --- a/include/commands.h +++ b/include/commands.h @@ -148,7 +148,7 @@ public: * @param source The source wanting the command description * @return The commands description */ - virtual const Anope::string GetDesc(CommandSource &source) const; + virtual Anope::string GetDesc(CommandSource &source) const; /** Execute this command. * @param source The source diff --git a/include/modules/httpd.h b/include/modules/httpd.h index 185a28faa..3ea6146c2 100644 --- a/include/modules/httpd.h +++ b/include/modules/httpd.h @@ -152,7 +152,7 @@ public: { } - virtual const Anope::string GetIP() + virtual Anope::string GetIP() const { return this->clientaddr.addr(); } diff --git a/include/modules/sql.h b/include/modules/sql.h index 0dd64862f..668439972 100644 --- a/include/modules/sql.h +++ b/include/modules/sql.h @@ -157,7 +157,7 @@ namespace SQL } } - const Anope::string Get(size_t index, const Anope::string &col) const + Anope::string Get(size_t index, const Anope::string &col) const { const std::map rows = this->Row(index); diff --git a/modules/botserv/bs_info.cpp b/modules/botserv/bs_info.cpp index f2f418386..6753b8645 100644 --- a/modules/botserv/bs_info.cpp +++ b/modules/botserv/bs_info.cpp @@ -107,7 +107,7 @@ public: return true; } - const Anope::string GetDesc(CommandSource &source) const override + Anope::string GetDesc(CommandSource &source) const override { return Anope::Format(Language::Translate(source.GetAccount(), _("Allows you to see %s information about a channel or a bot")), source.service->nick.c_str()); } diff --git a/modules/chanserv/cs_mode.cpp b/modules/chanserv/cs_mode.cpp index 51314df49..783067eec 100644 --- a/modules/chanserv/cs_mode.cpp +++ b/modules/chanserv/cs_mode.cpp @@ -943,7 +943,7 @@ public: } } - const Anope::string GetDesc(CommandSource &source) const override + Anope::string GetDesc(CommandSource &source) const override { const std::pair &m = modes[source.command]; if (!m.second.empty()) diff --git a/modules/chanserv/cs_xop.cpp b/modules/chanserv/cs_xop.cpp index 00cd73c2e..f8a9a5f07 100644 --- a/modules/chanserv/cs_xop.cpp +++ b/modules/chanserv/cs_xop.cpp @@ -514,7 +514,7 @@ public: this->SetSyntax(_("\037channel\037 CLEAR")); } - const Anope::string GetDesc(CommandSource &source) const override + Anope::string GetDesc(CommandSource &source) const override { return Anope::Format(Language::Translate(source.GetAccount(), _("Modify the list of %s users")), source.command.nobreak().c_str()); } diff --git a/modules/httpd.cpp b/modules/httpd.cpp index 890f85639..6f863f9d7 100644 --- a/modules/httpd.cpp +++ b/modules/httpd.cpp @@ -115,7 +115,7 @@ public: return !(!BinarySocket::ProcessWrite() || this->write_buffer.empty()); } - const Anope::string GetIP() override + Anope::string GetIP() const override { return this->ip; } diff --git a/modules/operserv/os_login.cpp b/modules/operserv/os_login.cpp index a08884c69..7ed8376f8 100644 --- a/modules/operserv/os_login.cpp +++ b/modules/operserv/os_login.cpp @@ -75,7 +75,7 @@ public: return true; } - const Anope::string GetDesc(CommandSource &source) const override + Anope::string GetDesc(CommandSource &source) const override { return Anope::Format(Language::Translate(source.GetAccount(), _("Login to %s")), source.service->nick.c_str()); } @@ -121,7 +121,7 @@ public: return true; } - const Anope::string GetDesc(CommandSource &source) const override + Anope::string GetDesc(CommandSource &source) const override { return Anope::Format(Language::Translate(source.GetAccount(), _("Logout from %s")), source.service->nick.c_str()); } diff --git a/modules/operserv/os_sxline.cpp b/modules/operserv/os_sxline.cpp index 63827004c..bcea0da71 100644 --- a/modules/operserv/os_sxline.cpp +++ b/modules/operserv/os_sxline.cpp @@ -245,7 +245,7 @@ public: { } - const Anope::string GetDesc(CommandSource &source) const override + Anope::string GetDesc(CommandSource &source) const override { return Anope::Format(Language::Translate(source.GetAccount(), _("Manipulate the %s list")), source.command.nobreak().c_str()); } diff --git a/modules/proxyscan.cpp b/modules/proxyscan.cpp index 2d56a7d3b..6d4d5bad9 100644 --- a/modules/proxyscan.cpp +++ b/modules/proxyscan.cpp @@ -85,7 +85,7 @@ public: } void OnConnect() override = 0; - virtual const Anope::string GetType() const = 0; + virtual const char *GetType() const = 0; protected: void Ban() @@ -134,7 +134,7 @@ public: this->Write(""); } - const Anope::string GetType() const override + const char *GetType() const override { return "HTTP"; } @@ -187,7 +187,7 @@ public: this->Write(buf, ptr); } - const Anope::string GetType() const override + const char *GetType() const override { return "SOCKS5"; } diff --git a/src/command.cpp b/src/command.cpp index a4470062f..a558aae1e 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -199,7 +199,7 @@ void Command::RequireUser(bool b) this->require_user = b; } -const Anope::string Command::GetDesc(CommandSource &) const +Anope::string Command::GetDesc(CommandSource &) const { return this->desc; }