Remove inner identical condition

This commit is contained in:
Daniel Marjamäki 2018-04-08 08:12:56 +02:00
parent 90983303f0
commit 541e255159
1 changed files with 8 additions and 12 deletions

View File

@ -1230,19 +1230,15 @@ void CheckIO::checkFormatString(const Token * const tok,
// If the next character is the same (which makes 'hh' or 'll') then expect another alphabetical character
const bool isSecondCharAvailable = ((i + 1) != formatString.end());
if (i != formatString.end() && isSecondCharAvailable && *(i + 1) == *i) {
if (isSecondCharAvailable) {
if (!isalpha(*(i + 2))) {
std::string modifier;
modifier += *i;
modifier += *(i + 1);
invalidLengthModifierError(tok, numFormat, modifier);
done = true;
} else {
specifier = *i++;
specifier += *i++;
}
} else {
if (!isalpha(*(i + 2))) {
std::string modifier;
modifier += *i;
modifier += *(i + 1);
invalidLengthModifierError(tok, numFormat, modifier);
done = true;
} else {
specifier = *i++;
specifier += *i++;
}
} else {
if (i != formatString.end()) {