Skip to content

Commit

Permalink
fixed "Redundant dereferencing and tasking address expression" Rider …
Browse files Browse the repository at this point in the history
…warnings (#5563)
  • Loading branch information
firewave committed Oct 16, 2023
1 parent 5e89eb0 commit 3811d01
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion cli/cppcheckexecutorsig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion gui/platforms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion lib/checkclass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/checkinternal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
12 changes: 6 additions & 6 deletions lib/errorlogger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion lib/symboldatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion test/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions test/testcmdlineparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -975,8 +975,8 @@ class TestCmdlineParser : public TestFixture {
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());
}

Expand Down Expand Up @@ -1323,8 +1323,8 @@ class TestCmdlineParser : public TestFixture {
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());
}

Expand Down

0 comments on commit 3811d01

Please sign in to comment.