Skip to content

Commit

Permalink
Revert to old sepstream logic until a proper fix is finished
Browse files Browse the repository at this point in the history
  • Loading branch information
Jackmcbarn committed Apr 1, 2011
1 parent b95e842 commit 9c69364
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/hashcomp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,14 +315,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 = "";
Expand All @@ -336,7 +345,7 @@ const std::string irc::sepstream::GetRemaining()

bool irc::sepstream::StreamEnd()
{
return n == tokens.end();
return ((n + 1) == tokens.end());
}

irc::sepstream::~sepstream()
Expand Down

0 comments on commit 9c69364

Please sign in to comment.