]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/command_parse.cpp
publish "JSON-RPC" interface
[user/henk/code/inspircd.git] / src / command_parse.cpp
index c7f89e03bb914b839d5f04f6368750b6f57508b8..52c58ef999aba743e78506101cd314538479aea6 100644 (file)
@@ -1,4 +1,4 @@
-       /*       +------------------------------------+
+/*       +------------------------------------+
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
@@ -65,7 +65,7 @@ std::string InspIRCd::TimeString(time_t curtime)
 /** Refactored by Brain, Jun 2007. Much faster with some clever O(1) array
  * lookups and pointer maths.
  */
-long InspIRCd::Duration(const char* str)
+long InspIRCd::Duration(const std::string &str)
 {
        unsigned char multiplier = 0;
        long total = 0;
@@ -73,7 +73,7 @@ long InspIRCd::Duration(const char* str)
        long subtotal = 0;
 
        /* Iterate each item in the string, looking for number or multiplier */
-       for (const char* i = str + strlen(str) - 1; i >= str; --i)
+       for (std::string::const_reverse_iterator i = str.rbegin(); i != str.rend(); ++i)
        {
                /* Found a number, queue it onto the current number */
                if ((*i >= '0') && (*i <= '9'))
@@ -133,7 +133,7 @@ int CommandParser::LoopCall(userrec* user, command_t* CommandObj, const char** p
         */
        irc::commasepstream items1(parameters[splithere]);
        irc::commasepstream items2(parameters[extra]);
-       std::string item = "*";
+       std::string item("*");
        unsigned int max = 0;
 
        /* Attempt to iterate these lists and call the command objech
@@ -174,7 +174,7 @@ int CommandParser::LoopCall(userrec* user, command_t* CommandObj, const char** p
 
        /* Only one commasepstream here */
        irc::commasepstream items1(parameters[splithere]);
-       std::string item = "*";
+       std::string item("*");
        unsigned int max = 0;
 
        /* Parse the commasepstream until there are no tokens remaining.
@@ -395,6 +395,7 @@ void CommandParser::RemoveCommand(command_table::iterator safei, const char* sou
        if (x->source == std::string(source))
        {
                cmdlist.erase(safei);
+               delete x;
        }
 }