Skip to content

Commit

Permalink
Fix bug: CommandLineParserParams's comparator would fail with equal a…
Browse files Browse the repository at this point in the history
…rguments.
  • Loading branch information
Roman Donchenko committed Jul 4, 2013
1 parent 4692d4b commit 0daf4b8
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions modules/core/src/command_line_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,18 +136,13 @@ void CommandLineParser::getByIndex(int index, bool space_delete, int type, void*

static bool cmp_params(const CommandLineParserParams & p1, const CommandLineParserParams & p2)
{
if (p1.number < p2.number)
return true;

if (p1.number > p2.number)
return false;

if (p1.number == -1 && p2.number == -1)
{
if (p1.keys[0].compare(p2.keys[0]) > 0)
{
return false;
}
}

return true;
return p1.keys[0].compare(p2.keys[0]) < 0;
}

CommandLineParser::CommandLineParser(int argc, const char* const argv[], const String& keys)
Expand Down

0 comments on commit 0daf4b8

Please sign in to comment.