summaryrefslogtreecommitdiff
path: root/src/command_parse.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-07-16 12:18:29 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-07-16 12:18:29 +0000
commit0757a4a495daabf661ac3b7ab79f0a5ee423abe8 (patch)
treed788af6cee694ae3b623bbfbbc31864de43b9d12 /src/command_parse.cpp
parent80d1296c31d8e16e71f7079144618a3eae6976d1 (diff)
mass tidyup, change A LOT of stuff to const char** which was char** (such as parameters to commands in handlers)
which makes the new lineparser work neater with no casts. This also removes tons of casts from other locations (all in all, ive added 2 casts and removed almost a hundred) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4403 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/command_parse.cpp')
-rw-r--r--src/command_parse.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/command_parse.cpp b/src/command_parse.cpp
index 19729d9e4..f27467f34 100644
--- a/src/command_parse.cpp
+++ b/src/command_parse.cpp
@@ -98,7 +98,7 @@ cmd_pass* command_pass;
* before the actual list as well. This code is used by many functions which
* can function as "one to list" (see the RFC) */
-int CommandParser::LoopCall(command_t* fn, char **parameters, int pcnt, userrec *u, int start, int end, int joins)
+int CommandParser::LoopCall(command_t* fn, const char** parameters, int pcnt, userrec *u, int start, int end, int joins)
{
/* Copy of the parameter list, because like strltok, we make a bit of
* a mess of the parameter string we're given, and we want to keep this
@@ -110,13 +110,13 @@ int CommandParser::LoopCall(command_t* fn, char **parameters, int pcnt, userrec
char *param;
/* Parameter list, we can have up to 32 of these
*/
- char *pars[32];
+ const char *pars[32];
/* Seperated items, e.g. holds the #one and #two from "#one,#two"
*/
- char *sep_items[32];
+ const char *sep_items[32];
/* Seperated keys, holds the 'two' and 'three' of "two,three"
*/
- char *sep_keys[32];
+ const char *sep_keys[32];
/* Misc. counters, the total values hold the total number of
* seperated items in sep_items (total) and the total number of
* seperated items in sep_keys (total2)
@@ -316,7 +316,7 @@ bool CommandParser::IsValidCommand(const std::string &commandname, int pcnt, use
// calls a handler function for a command
-bool CommandParser::CallHandler(const std::string &commandname,char **parameters, int pcnt, userrec *user)
+bool CommandParser::CallHandler(const std::string &commandname,const char** parameters, int pcnt, userrec *user)
{
nspace::hash_map<std::string,command_t*>::iterator n = cmdlist.find(commandname);
@@ -347,15 +347,14 @@ bool CommandParser::CallHandler(const std::string &commandname,char **parameters
void CommandParser::ProcessCommand(userrec *user, std::string &cmd)
{
- char *command_p[127];
+ const char *command_p[127];
int items = 0;
-
std::string para[127];
irc::tokenstream tokens(cmd);
std::string xcommand = tokens.GetToken();
- while ((para[items] = tokens.GetToken()) != "")
- command_p[items] = (char*)para[items++].c_str();
+ while (((para[items] = tokens.GetToken()) != "") && (items < 127))
+ command_p[items] = para[items++].c_str();
int MOD_RESULT = 0;
FOREACH_RESULT(I_OnPreCommand,OnPreCommand(xcommand,command_p,items,user,false));