]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/hashcomp.cpp
Merge branch 'master+websocket'
[user/henk/code/inspircd.git] / src / hashcomp.cpp
index 46981e7034d30c148bc5be264acc78733baa14c8..35e5f3671cec15aa37c1387bfc460a6eaf54eb76 100644 (file)
@@ -153,7 +153,7 @@ unsigned const char rfc_case_sensitive_map[256] = {
 
 size_t CoreExport irc::hash::operator()(const irc::string &s) const
 {
-       register size_t t = 0;
+       size_t t = 0;
        for (irc::string::const_iterator x = s.begin(); x != s.end(); ++x) /* ++x not x++, as its faster */
                t = 5 * t + national_case_insensitive_map[(unsigned char)*x];
        return t;
@@ -196,7 +196,7 @@ size_t irc::insensitive::operator()(const std::string &s) const
         * only with *x replaced with national_case_insensitive_map[*x].
         * This avoids a copy to use hash<const char*>
         */
-       register size_t t = 0;
+       size_t t = 0;
        for (std::string::const_iterator x = s.begin(); x != s.end(); ++x) /* ++x not x++, as its faster */
                t = 5 * t + national_case_insensitive_map[(unsigned char)*x];
        return t;
@@ -268,7 +268,7 @@ bool irc::tokenstream::GetToken(std::string &token)
        /* This is the last parameter */
        if (token[0] == ':' && !first)
        {
-               token = token.substr(1);
+               token.erase(token.begin());
                if (!StreamEnd())
                {
                        token += ' ';
@@ -332,7 +332,7 @@ bool irc::sepstream::GetToken(std::string &token)
        if (p == std::string::npos)
                p = this->tokens.length();
 
-       token = this->tokens.substr(this->pos, p - this->pos);
+       token.assign(tokens, this->pos, p - this->pos);
        this->pos = p + 1;
 
        return true;
@@ -412,10 +412,9 @@ long irc::portparser::GetToken()
        std::string::size_type dash = x.rfind('-');
        if (dash != std::string::npos)
        {
-               std::string sbegin = x.substr(0, dash);
-               std::string send = x.substr(dash+1, x.length());
+               std::string sbegin(x, 0, dash);
                range_begin = atoi(sbegin.c_str());
-               range_end = atoi(send.c_str());
+               range_end = atoi(x.c_str()+dash+1);
 
                if ((range_begin > 0) && (range_end > 0) && (range_begin < 65536) && (range_end < 65536) && (range_begin < range_end))
                {