diff --git a/lib/checkother.cpp b/lib/checkother.cpp index 728719835..9a8bd4a64 100644 --- a/lib/checkother.cpp +++ b/lib/checkother.cpp @@ -616,11 +616,11 @@ void CheckOther::checkRedundantAssignmentInSwitch() // case 3: b = 1; // <== redundant // case 4: b = 2; if (Token::Match(tok2->previous(), ";|{|}|: %var% = %any% ;") && tok2->varId() != 0) { - std::map::iterator i = varsAssigned.find(tok2->varId()); - if (i == varsAssigned.end()) + std::map::iterator i2 = varsAssigned.find(tok2->varId()); + if (i2 == varsAssigned.end()) varsAssigned[tok2->varId()] = tok2; else - redundantAssignmentInSwitchError(i->second, i->second->str()); + redundantAssignmentInSwitchError(i2->second, i2->second->str()); stringsCopied.erase(tok2->varId()); } @@ -628,11 +628,11 @@ void CheckOther::checkRedundantAssignmentInSwitch() // case 3: strcpy(str, "a"); // <== redundant // case 4: strcpy(str, "b"); else if (Token::Match(tok2->previous(), ";|{|}|: strcpy|strncpy ( %var% ,") && tok2->tokAt(2)->varId() != 0) { - std::map::iterator i = stringsCopied.find(tok2->tokAt(2)->varId()); - if (i == stringsCopied.end()) + std::map::iterator i2 = stringsCopied.find(tok2->tokAt(2)->varId()); + if (i2 == stringsCopied.end()) stringsCopied[tok2->tokAt(2)->varId()] = tok2->tokAt(2); else - redundantStrcpyInSwitchError(i->second, i->second->str()); + redundantStrcpyInSwitchError(i2->second, i2->second->str()); } // Not a simple assignment so there may be good reason if this variable is assigned to twice. E.g.: // case 3: b = 1;