fixed "Redundant dereferencing and tasking address expression" Rider warnings (#5563)

This commit is contained in:
Oliver Stöneberg 2023-10-16 14:09:03 +02:00 committed by GitHub
parent 5e89eb05a6
commit 3811d01498
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 16 additions and 16 deletions

View File

@ -321,7 +321,7 @@ int check_wrapper_sig(CppCheckExecutor& executor, int (CppCheckExecutor::*f)(Cpp
for (std::map<int, std::string>::const_iterator sig=listofsignals.cbegin(); sig!=listofsignals.cend(); ++sig) {
sigaction(sig->first, &act, nullptr);
}
return (&executor->*f)(cppcheck);
return (executor.*f)(cppcheck);
}
#endif

View File

@ -52,7 +52,7 @@ PlatformData& Platforms::get(Platform::Type platform)
{
QList<PlatformData>::iterator iter = mPlatforms.begin();
while (iter != mPlatforms.end()) {
if ((*iter).mType == platform) {
if (iter->mType == platform) {
return *iter;
}
++iter;

View File

@ -1244,7 +1244,7 @@ static bool checkFunctionUsage(const Function *privfunc, const Scope* scope)
const std::map<std::string, Type*>::const_iterator end = scope->definedTypesMap.cend();
for (std::map<std::string, Type*>::const_iterator iter = scope->definedTypesMap.cbegin(); iter != end; ++iter) {
const Type *type = (*iter).second;
const Type *type = iter->second;
if (type->enclosingScope == scope && checkFunctionUsage(privfunc, type->classScope))
return true;
}

View File

@ -230,7 +230,7 @@ void CheckInternal::checkMissingPercentCharacter()
std::set<std::string>::const_iterator knownPattern, knownPatternsEnd = knownPatterns.cend();
for (knownPattern = knownPatterns.cbegin(); knownPattern != knownPatternsEnd; ++knownPattern) {
const std::string brokenPattern = (*knownPattern).substr(0, (*knownPattern).size() - 1);
const std::string brokenPattern = knownPattern->substr(0, knownPattern->size() - 1);
std::string::size_type pos = 0;
while ((pos = pattern.find(brokenPattern, pos)) != std::string::npos) {

View File

@ -286,11 +286,11 @@ std::string ErrorMessage::serialize() const
for (std::list<ErrorMessage::FileLocation>::const_iterator loc = callStack.cbegin(); loc != callStack.cend(); ++loc) {
std::string frame;
frame += std::to_string((*loc).line);
frame += std::to_string(loc->line);
frame += '\t';
frame += std::to_string((*loc).column);
frame += std::to_string(loc->column);
frame += '\t';
frame += (*loc).getfile(false);
frame += loc->getfile(false);
frame += '\t';
frame += loc->getOrigFile(false);
frame += '\t';
@ -498,9 +498,9 @@ std::string ErrorMessage::toXML() const
for (std::list<FileLocation>::const_reverse_iterator it = callStack.crbegin(); it != callStack.crend(); ++it) {
printer.OpenElement("location", false);
printer.PushAttribute("file", (*it).getfile().c_str());
printer.PushAttribute("line", std::max((*it).line,0));
printer.PushAttribute("column", (*it).column);
printer.PushAttribute("file", it->getfile().c_str());
printer.PushAttribute("line", std::max(it->line,0));
printer.PushAttribute("column", it->column);
if (!it->getinfo().empty())
printer.PushAttribute("info", fixInvalidChars(it->getinfo()).c_str());
printer.CloseElement(false);

View File

@ -5949,7 +5949,7 @@ const Type* Scope::findType(const std::string & name) const
// Type was found
if (definedTypesMap.end() != it)
return (*it).second;
return it->second;
// is type defined in anonymous namespace..
it = definedTypesMap.find(emptyString);

View File

@ -23,7 +23,7 @@ options::options(int argc, const char* const argv[])
,mExe(argv[0])
{
for (std::set<std::string>::const_iterator it = mWhichTests.cbegin(); it != mWhichTests.cend();) {
if (!(*it).empty() && (((*it)[0] == '-') || ((*it).find("::") != std::string::npos && mWhichTests.count((*it).substr(0, (*it).find("::"))))))
if (!it->empty() && (((*it)[0] == '-') || (it->find("::") != std::string::npos && mWhichTests.count(it->substr(0, it->find("::"))))))
it = mWhichTests.erase(it);
else
++it;

View File

@ -975,8 +975,8 @@ private:
ASSERT_EQUALS(true, parser->parseFromArgs(3, argv));
ASSERT_EQUALS(2, settings->nofail.getSuppressions().size());
auto it = settings->nofail.getSuppressions().cbegin();
ASSERT_EQUALS("uninitvar", (*it++).errorId);
ASSERT_EQUALS("unusedFunction", (*it).errorId);
ASSERT_EQUALS("uninitvar", (it++)->errorId);
ASSERT_EQUALS("unusedFunction", it->errorId);
ASSERT_EQUALS("", logger->str());
}
@ -1323,8 +1323,8 @@ private:
ASSERT_EQUALS(true, parser->parseFromArgs(3, argv));
ASSERT_EQUALS(2, settings->nomsg.getSuppressions().size());
auto it = settings->nomsg.getSuppressions().cbegin();
ASSERT_EQUALS("uninitvar", (*it++).errorId);
ASSERT_EQUALS("unusedFunction", (*it).errorId);
ASSERT_EQUALS("uninitvar", (it++)->errorId);
ASSERT_EQUALS("unusedFunction", it->errorId);
ASSERT_EQUALS("", logger->str());
}