diff options
author | Jackmcbarn <jackmcbarn@jackmcbarn.no-ip.org> | 2011-04-01 10:09:18 -0400 |
---|---|---|
committer | Jackmcbarn <jackmcbarn@jackmcbarn.no-ip.org> | 2011-04-01 10:09:18 -0400 |
commit | f8588b112fe6ef1095e40fcd64f85e670d96bc92 (patch) | |
tree | 0b0d9735110ecd94fb114720f92205b8b5be16a2 /src/hashcomp.cpp | |
parent | d2a5339ddf5c64da08c0f26383281ef2385a1d11 (diff) |
Revert to old sepstream logic until a proper fix is finished
Diffstat (limited to 'src/hashcomp.cpp')
-rw-r--r-- | src/hashcomp.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/hashcomp.cpp b/src/hashcomp.cpp index df03d0a58..0ef8d025f 100644 --- a/src/hashcomp.cpp +++ b/src/hashcomp.cpp @@ -305,14 +305,23 @@ bool irc::sepstream::GetToken(std::string &token) { std::string::iterator lsp = last_starting_position; - for(; n != tokens.end(); ++n) + while (n != tokens.end()) { - 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 : n++); - return true; + 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; } + + n++; } token = ""; @@ -326,7 +335,7 @@ const std::string irc::sepstream::GetRemaining() bool irc::sepstream::StreamEnd() { - return n == tokens.end(); + return ((n + 1) == tokens.end()); } irc::sepstream::~sepstream() |