From dd36852a52e8541306b76c5b88bce8ab9b36654c Mon Sep 17 00:00:00 2001 From: brain Date: Wed, 20 Feb 2008 19:07:07 +0000 Subject: Wheee, mass commit! this adds const stafety, throwing a compile error if anyone does: "parameters[n] = blahvar;" in a command handler etc. where they REALLY SHOULD NOT fuck with the value and should copy the pointer. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8971 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_spanningtree/main.cpp | 8 +++---- src/modules/m_spanningtree/main.h | 28 ++++++++++++------------- src/modules/m_spanningtree/override_admin.cpp | 2 +- src/modules/m_spanningtree/override_map.cpp | 2 +- src/modules/m_spanningtree/override_modules.cpp | 2 +- src/modules/m_spanningtree/override_motd.cpp | 2 +- src/modules/m_spanningtree/override_squit.cpp | 2 +- src/modules/m_spanningtree/override_stats.cpp | 2 +- src/modules/m_spanningtree/override_time.cpp | 2 +- src/modules/m_spanningtree/override_whois.cpp | 2 +- src/modules/m_spanningtree/postcommand.cpp | 2 +- src/modules/m_spanningtree/precommand.cpp | 2 +- src/modules/m_spanningtree/rconnect.cpp | 2 +- src/modules/m_spanningtree/rconnect.h | 2 +- src/modules/m_spanningtree/rsquit.cpp | 2 +- src/modules/m_spanningtree/rsquit.h | 2 +- 16 files changed, 32 insertions(+), 32 deletions(-) (limited to 'src/modules/m_spanningtree') diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index 98c3758d2..119e98220 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -114,14 +114,14 @@ int ModuleSpanningTree::CountServs() return Utils->serverlist.size(); } -void ModuleSpanningTree::HandleLinks(const char** parameters, int pcnt, User* user) +void ModuleSpanningTree::HandleLinks(const char* const* parameters, int pcnt, User* user) { ShowLinks(Utils->TreeRoot,user,0); user->WriteServ("365 %s * :End of /LINKS list.",user->nick); return; } -void ModuleSpanningTree::HandleLusers(const char** parameters, int pcnt, User* user) +void ModuleSpanningTree::HandleLusers(const char* const* parameters, int pcnt, User* user) { unsigned int n_users = ServerInstance->Users->UserCount(); @@ -322,7 +322,7 @@ void ModuleSpanningTree::AutoConnectServers(time_t curtime) } } -int ModuleSpanningTree::HandleVersion(const char** parameters, int pcnt, User* user) +int ModuleSpanningTree::HandleVersion(const char* const* parameters, int pcnt, User* user) { // we've already checked if pcnt > 0, so this is safe TreeServer* found = Utils->FindServerMask(parameters[0]); @@ -392,7 +392,7 @@ void ModuleSpanningTree::RemoteMessage(User* user, const char* format, ...) SendingRemoteMessage = false; } -int ModuleSpanningTree::HandleConnect(const char** parameters, int pcnt, User* user) +int ModuleSpanningTree::HandleConnect(const char* const* parameters, int pcnt, User* user) { for (std::vector::iterator x = Utils->LinkBlocks.begin(); x < Utils->LinkBlocks.end(); x++) { diff --git a/src/modules/m_spanningtree/main.h b/src/modules/m_spanningtree/main.h index 5eeaca7b1..e8c83221e 100644 --- a/src/modules/m_spanningtree/main.h +++ b/src/modules/m_spanningtree/main.h @@ -75,11 +75,11 @@ class ModuleSpanningTree : public Module /** Handle LINKS command */ - void HandleLinks(const char** parameters, int pcnt, User* user); + void HandleLinks(const char* const* parameters, int pcnt, User* user); /** Handle LUSERS command */ - void HandleLusers(const char** parameters, int pcnt, User* user); + void HandleLusers(const char* const* parameters, int pcnt, User* user); /** Show MAP output to a user (recursive) */ @@ -87,35 +87,35 @@ class ModuleSpanningTree : public Module /** Handle remote MOTD */ - int HandleMotd(const char** parameters, int pcnt, User* user); + int HandleMotd(const char* const* parameters, int pcnt, User* user); /** Handle remote ADMIN */ - int HandleAdmin(const char** parameters, int pcnt, User* user); + int HandleAdmin(const char* const* parameters, int pcnt, User* user); /** Handle remote STATS */ - int HandleStats(const char** parameters, int pcnt, User* user); + int HandleStats(const char* const* parameters, int pcnt, User* user); /** Handle MAP command */ - void HandleMap(const char** parameters, int pcnt, User* user); + void HandleMap(const char* const* parameters, int pcnt, User* user); /** Handle SQUIT */ - int HandleSquit(const char** parameters, int pcnt, User* user); + int HandleSquit(const char* const* parameters, int pcnt, User* user); /** Handle TIME */ - int HandleTime(const char** parameters, int pcnt, User* user); + int HandleTime(const char* const* parameters, int pcnt, User* user); /** Handle remote WHOIS */ - int HandleRemoteWhois(const char** parameters, int pcnt, User* user); + int HandleRemoteWhois(const char* const* parameters, int pcnt, User* user); /** Handle remote MODULES */ - int HandleModules(const char** parameters, int pcnt, User* user); + int HandleModules(const char* const* parameters, int pcnt, User* user); /** Ping all local servers */ @@ -131,11 +131,11 @@ class ModuleSpanningTree : public Module /** Handle remote VERSON */ - int HandleVersion(const char** parameters, int pcnt, User* user); + int HandleVersion(const char* const* parameters, int pcnt, User* user); /** Handle CONNECT */ - int HandleConnect(const char** parameters, int pcnt, User* user); + int HandleConnect(const char* const* parameters, int pcnt, User* user); /** Send out time sync to all servers */ @@ -157,8 +157,8 @@ class ModuleSpanningTree : public Module ** *** MODULE EVENTS *** **/ - virtual int OnPreCommand(const std::string &command, const char** parameters, int pcnt, User *user, bool validated, const std::string &original_line); - virtual void OnPostCommand(const std::string &command, const char** parameters, int pcnt, User *user, CmdResult result, const std::string &original_line); + virtual int OnPreCommand(const std::string &command, const char* const* parameters, int pcnt, User *user, bool validated, const std::string &original_line); + virtual void OnPostCommand(const std::string &command, const char* const* parameters, int pcnt, User *user, CmdResult result, const std::string &original_line); virtual void OnGetServerDescription(const std::string &servername,std::string &description); virtual void OnUserInvite(User* source,User* dest,Channel* channel, time_t); virtual void OnPostLocalTopicChange(User* user, Channel* chan, const std::string &topic); diff --git a/src/modules/m_spanningtree/override_admin.cpp b/src/modules/m_spanningtree/override_admin.cpp index e011383d2..c090cb071 100644 --- a/src/modules/m_spanningtree/override_admin.cpp +++ b/src/modules/m_spanningtree/override_admin.cpp @@ -33,7 +33,7 @@ /* $ModDep: m_spanningtree/timesynctimer.h m_spanningtree/resolvers.h m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/link.h m_spanningtree/treesocket.h m_spanningtree/rconnect.h m_spanningtree/rsquit.h */ -int ModuleSpanningTree::HandleAdmin(const char** parameters, int pcnt, User* user) +int ModuleSpanningTree::HandleAdmin(const char* const* parameters, int pcnt, User* user) { if (pcnt > 0) { diff --git a/src/modules/m_spanningtree/override_map.cpp b/src/modules/m_spanningtree/override_map.cpp index 9b117272a..853010b4d 100644 --- a/src/modules/m_spanningtree/override_map.cpp +++ b/src/modules/m_spanningtree/override_map.cpp @@ -109,7 +109,7 @@ void ModuleSpanningTree::ShowMap(TreeServer* Current, User* user, int depth, cha // and divisons, we instead render the map onto a backplane of characters // (a character matrix), then draw the branches as a series of "L" shapes // from the nodes. This is not only friendlier on CPU it uses less stack. -void ModuleSpanningTree::HandleMap(const char** parameters, int pcnt, User* user) +void ModuleSpanningTree::HandleMap(const char* const* parameters, int pcnt, User* user) { // This array represents a virtual screen which we will // "scratch" draw to, as the console device of an irc diff --git a/src/modules/m_spanningtree/override_modules.cpp b/src/modules/m_spanningtree/override_modules.cpp index adecb7c34..c47d642f8 100644 --- a/src/modules/m_spanningtree/override_modules.cpp +++ b/src/modules/m_spanningtree/override_modules.cpp @@ -33,7 +33,7 @@ /* $ModDep: m_spanningtree/timesynctimer.h m_spanningtree/resolvers.h m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/link.h m_spanningtree/treesocket.h m_spanningtree/rconnect.h m_spanningtree/rsquit.h */ -int ModuleSpanningTree::HandleModules(const char** parameters, int pcnt, User* user) +int ModuleSpanningTree::HandleModules(const char* const* parameters, int pcnt, User* user) { if (pcnt > 0) { diff --git a/src/modules/m_spanningtree/override_motd.cpp b/src/modules/m_spanningtree/override_motd.cpp index f8398bea9..4aa94334a 100644 --- a/src/modules/m_spanningtree/override_motd.cpp +++ b/src/modules/m_spanningtree/override_motd.cpp @@ -33,7 +33,7 @@ /* $ModDep: m_spanningtree/timesynctimer.h m_spanningtree/resolvers.h m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/link.h m_spanningtree/treesocket.h m_spanningtree/rconnect.h m_spanningtree/rsquit.h */ -int ModuleSpanningTree::HandleMotd(const char** parameters, int pcnt, User* user) +int ModuleSpanningTree::HandleMotd(const char* const* parameters, int pcnt, User* user) { if (pcnt > 0) { diff --git a/src/modules/m_spanningtree/override_squit.cpp b/src/modules/m_spanningtree/override_squit.cpp index 263b8cf2c..1a82e4bfb 100644 --- a/src/modules/m_spanningtree/override_squit.cpp +++ b/src/modules/m_spanningtree/override_squit.cpp @@ -33,7 +33,7 @@ /* $ModDep: m_spanningtree/timesynctimer.h m_spanningtree/resolvers.h m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/link.h m_spanningtree/treesocket.h m_spanningtree/rconnect.h m_spanningtree/rsquit.h */ -int ModuleSpanningTree::HandleSquit(const char** parameters, int pcnt, User* user) +int ModuleSpanningTree::HandleSquit(const char* const* parameters, int pcnt, User* user) { TreeServer* s = Utils->FindServerMask(parameters[0]); if (s) diff --git a/src/modules/m_spanningtree/override_stats.cpp b/src/modules/m_spanningtree/override_stats.cpp index 0ba18e42a..ba6650d6b 100644 --- a/src/modules/m_spanningtree/override_stats.cpp +++ b/src/modules/m_spanningtree/override_stats.cpp @@ -33,7 +33,7 @@ /* $ModDep: m_spanningtree/timesynctimer.h m_spanningtree/resolvers.h m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/link.h m_spanningtree/treesocket.h m_spanningtree/rconnect.h m_spanningtree/rsquit.h */ -int ModuleSpanningTree::HandleStats(const char** parameters, int pcnt, User* user) +int ModuleSpanningTree::HandleStats(const char* const* parameters, int pcnt, User* user) { if (pcnt > 1) { diff --git a/src/modules/m_spanningtree/override_time.cpp b/src/modules/m_spanningtree/override_time.cpp index af2e4f576..cbd29f535 100644 --- a/src/modules/m_spanningtree/override_time.cpp +++ b/src/modules/m_spanningtree/override_time.cpp @@ -33,7 +33,7 @@ /* $ModDep: m_spanningtree/timesynctimer.h m_spanningtree/resolvers.h m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/link.h m_spanningtree/treesocket.h m_spanningtree/rconnect.h m_spanningtree/rsquit.h */ -int ModuleSpanningTree::HandleTime(const char** parameters, int pcnt, User* user) +int ModuleSpanningTree::HandleTime(const char* const* parameters, int pcnt, User* user) { if ((IS_LOCAL(user)) && (pcnt)) { diff --git a/src/modules/m_spanningtree/override_whois.cpp b/src/modules/m_spanningtree/override_whois.cpp index 4721e8bcd..3cb282cb0 100644 --- a/src/modules/m_spanningtree/override_whois.cpp +++ b/src/modules/m_spanningtree/override_whois.cpp @@ -33,7 +33,7 @@ /* $ModDep: m_spanningtree/timesynctimer.h m_spanningtree/resolvers.h m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/link.h m_spanningtree/treesocket.h m_spanningtree/rconnect.h m_spanningtree/rsquit.h */ -int ModuleSpanningTree::HandleRemoteWhois(const char** parameters, int pcnt, User* user) +int ModuleSpanningTree::HandleRemoteWhois(const char* const* parameters, int pcnt, User* user) { if ((IS_LOCAL(user)) && (pcnt > 1)) { diff --git a/src/modules/m_spanningtree/postcommand.cpp b/src/modules/m_spanningtree/postcommand.cpp index bd15113bc..de7142bea 100644 --- a/src/modules/m_spanningtree/postcommand.cpp +++ b/src/modules/m_spanningtree/postcommand.cpp @@ -33,7 +33,7 @@ /* $ModDep: m_spanningtree/timesynctimer.h m_spanningtree/resolvers.h m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/link.h m_spanningtree/treesocket.h m_spanningtree/rconnect.h m_spanningtree/rsquit.h */ -void ModuleSpanningTree::OnPostCommand(const std::string &command, const char** parameters, int pcnt, User *user, CmdResult result, const std::string &original_line) +void ModuleSpanningTree::OnPostCommand(const std::string &command, const char* const* parameters, int pcnt, User *user, CmdResult result, const std::string &original_line) { if ((result == CMD_SUCCESS) && (ServerInstance->IsValidModuleCommand(command, pcnt, user))) { diff --git a/src/modules/m_spanningtree/precommand.cpp b/src/modules/m_spanningtree/precommand.cpp index 00f2c598c..324aa3e14 100644 --- a/src/modules/m_spanningtree/precommand.cpp +++ b/src/modules/m_spanningtree/precommand.cpp @@ -33,7 +33,7 @@ /* $ModDep: m_spanningtree/timesynctimer.h m_spanningtree/resolvers.h m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/link.h m_spanningtree/treesocket.h m_spanningtree/rconnect.h m_spanningtree/rsquit.h */ -int ModuleSpanningTree::OnPreCommand(const std::string &command, const char** parameters, int pcnt, User *user, bool validated, const std::string &original_line) +int ModuleSpanningTree::OnPreCommand(const std::string &command, const char* const* parameters, int pcnt, User *user, bool validated, const std::string &original_line) { /* If the command doesnt appear to be valid, we dont want to mess with it. */ if (!validated) diff --git a/src/modules/m_spanningtree/rconnect.cpp b/src/modules/m_spanningtree/rconnect.cpp index 5cfb681d0..32308377a 100644 --- a/src/modules/m_spanningtree/rconnect.cpp +++ b/src/modules/m_spanningtree/rconnect.cpp @@ -36,7 +36,7 @@ cmd_rconnect::cmd_rconnect (InspIRCd* Instance, Module* Callback, SpanningTreeUt syntax = " "; } -CmdResult cmd_rconnect::Handle (const char** parameters, int pcnt, User *user) +CmdResult cmd_rconnect::Handle (const char* const* parameters, int pcnt, User *user) { if (IS_LOCAL(user)) { diff --git a/src/modules/m_spanningtree/rconnect.h b/src/modules/m_spanningtree/rconnect.h index 55f4d8655..94035dce2 100644 --- a/src/modules/m_spanningtree/rconnect.h +++ b/src/modules/m_spanningtree/rconnect.h @@ -22,7 +22,7 @@ class cmd_rconnect : public Command SpanningTreeUtilities* Utils; /* Utility class */ public: cmd_rconnect (InspIRCd* Instance, Module* Callback, SpanningTreeUtilities* Util); - CmdResult Handle (const char** parameters, int pcnt, User *user); + CmdResult Handle (const char* const* parameters, int pcnt, User *user); }; #endif diff --git a/src/modules/m_spanningtree/rsquit.cpp b/src/modules/m_spanningtree/rsquit.cpp index 236702b72..a4158a20d 100644 --- a/src/modules/m_spanningtree/rsquit.cpp +++ b/src/modules/m_spanningtree/rsquit.cpp @@ -36,7 +36,7 @@ cmd_rsquit::cmd_rsquit (InspIRCd* Instance, Module* Callback, SpanningTreeUtilit syntax = " [target-server-mask]"; } -CmdResult cmd_rsquit::Handle (const char** parameters, int pcnt, User *user) +CmdResult cmd_rsquit::Handle (const char* const* parameters, int pcnt, User *user) { if (IS_LOCAL(user)) { diff --git a/src/modules/m_spanningtree/rsquit.h b/src/modules/m_spanningtree/rsquit.h index 095859dc7..5dce2f310 100644 --- a/src/modules/m_spanningtree/rsquit.h +++ b/src/modules/m_spanningtree/rsquit.h @@ -22,7 +22,7 @@ class cmd_rsquit : public Command SpanningTreeUtilities* Utils; /* Utility class */ public: cmd_rsquit (InspIRCd* Instance, Module* Callback, SpanningTreeUtilities* Util); - CmdResult Handle (const char** parameters, int pcnt, User *user); + CmdResult Handle (const char* const* parameters, int pcnt, User *user); void NoticeUser(User* user, const std::string &msg); }; -- cgit v1.2.3