summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJackmcbarn <jackmcbarn@jackmcbarn.no-ip.org>2011-03-28 16:20:48 -0400
committerJackmcbarn <jackmcbarn@jackmcbarn.no-ip.org>2011-03-28 16:20:48 -0400
commitd2a5339ddf5c64da08c0f26383281ef2385a1d11 (patch)
tree73e5fa15b4409eafbf8562918b93989a0b96ab9f /src
parent2018098273b8792fe4f4d59c7545bd133c1c8e85 (diff)
Fix sepstream logic when multiple consecutive separators are encountered
Diffstat (limited to 'src')
-rw-r--r--src/hashcomp.cpp19
1 files changed, 5 insertions, 14 deletions
diff --git a/src/hashcomp.cpp b/src/hashcomp.cpp
index 0ef8d025f..df03d0a58 100644
--- a/src/hashcomp.cpp
+++ b/src/hashcomp.cpp
@@ -305,23 +305,14 @@ bool irc::sepstream::GetToken(std::string &token)
{
std::string::iterator lsp = last_starting_position;
- while (n != tokens.end())
+ for(; n != tokens.end(); ++n)
{
- if ((*n == sep) || (n+1 == tokens.end()))
+ if(*n == sep || n+1 == tokens.end())
{
last_starting_position = n+1;
- token = std::string(lsp, n+1 == tokens.end() ? n+1 : n++);
-
- while ((token.length()) && (token.find_last_of(sep) == token.length() - 1))
- token.erase(token.end() - 1);
-
- if (token.empty())
- n++;
-
- return n == tokens.end() ? false : true;
+ token = std::string(lsp, n+1 == tokens.end() ? ++n : n++);
+ return true;
}
-
- n++;
}
token = "";
@@ -335,7 +326,7 @@ const std::string irc::sepstream::GetRemaining()
bool irc::sepstream::StreamEnd()
{
- return ((n + 1) == tokens.end());
+ return n == tokens.end();
}
irc::sepstream::~sepstream()