Fix comparing sibling name with denoted name

This commit is contained in:
Martchus 2017-11-27 10:30:14 +01:00
parent fe3929c340
commit 8aff877874
1 changed files with 10 additions and 2 deletions

View File

@ -191,8 +191,16 @@ void ArgumentReader::read(ArgumentVector &args)
for (auto parentArgument = parentPath.crbegin(), pathEnd = parentPath.crend();; ++parentArgument) {
for (Argument *sibling : (parentArgument != pathEnd ? (*parentArgument)->subArguments() : parser.m_mainArgs)) {
if (sibling->occurrences() < sibling->maxOccurrences()) {
if ((argDenotationType == Abbreviation && (sibling->abbreviation() && sibling->abbreviation() == *argDenotation))
|| (sibling->name() && !strncmp(sibling->name(), argDenotation, argDenotationLength))) {
// check whether the denoted abbreviation matches the sibling's abbreviatiopn
if (argDenotationType == Abbreviation && (sibling->abbreviation() && sibling->abbreviation() == *argDenotation)) {
return;
}
// check whether the denoted name matches the sibling's name
if (!sibling->name()) {
continue;
}
const auto siblingNameLength = strlen(sibling->name());
if (argDenotationLength == siblingNameLength && !strncmp(sibling->name(), argDenotation, argDenotationLength)) {
return;
}
}