Fix bug: CommandLineParserParams's comparator would fail with equal arguments.
This commit is contained in:
@@ -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)
|
static bool cmp_params(const CommandLineParserParams & p1, const CommandLineParserParams & p2)
|
||||||
{
|
{
|
||||||
|
if (p1.number < p2.number)
|
||||||
|
return true;
|
||||||
|
|
||||||
if (p1.number > p2.number)
|
if (p1.number > p2.number)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (p1.number == -1 && p2.number == -1)
|
return p1.keys[0].compare(p2.keys[0]) < 0;
|
||||||
{
|
|
||||||
if (p1.keys[0].compare(p2.keys[0]) > 0)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandLineParser::CommandLineParser(int argc, const char* const argv[], const String& keys)
|
CommandLineParser::CommandLineParser(int argc, const char* const argv[], const String& keys)
|
||||||
|
Reference in New Issue
Block a user