fixed "Redundant dereferencing and tasking address expression" Rider warnings (#5563)
This commit is contained in:
parent
5e89eb05a6
commit
3811d01498
|
@ -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) {
|
for (std::map<int, std::string>::const_iterator sig=listofsignals.cbegin(); sig!=listofsignals.cend(); ++sig) {
|
||||||
sigaction(sig->first, &act, nullptr);
|
sigaction(sig->first, &act, nullptr);
|
||||||
}
|
}
|
||||||
return (&executor->*f)(cppcheck);
|
return (executor.*f)(cppcheck);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -52,7 +52,7 @@ PlatformData& Platforms::get(Platform::Type platform)
|
||||||
{
|
{
|
||||||
QList<PlatformData>::iterator iter = mPlatforms.begin();
|
QList<PlatformData>::iterator iter = mPlatforms.begin();
|
||||||
while (iter != mPlatforms.end()) {
|
while (iter != mPlatforms.end()) {
|
||||||
if ((*iter).mType == platform) {
|
if (iter->mType == platform) {
|
||||||
return *iter;
|
return *iter;
|
||||||
}
|
}
|
||||||
++iter;
|
++iter;
|
||||||
|
|
|
@ -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();
|
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) {
|
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))
|
if (type->enclosingScope == scope && checkFunctionUsage(privfunc, type->classScope))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -230,7 +230,7 @@ void CheckInternal::checkMissingPercentCharacter()
|
||||||
|
|
||||||
std::set<std::string>::const_iterator knownPattern, knownPatternsEnd = knownPatterns.cend();
|
std::set<std::string>::const_iterator knownPattern, knownPatternsEnd = knownPatterns.cend();
|
||||||
for (knownPattern = knownPatterns.cbegin(); knownPattern != knownPatternsEnd; ++knownPattern) {
|
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;
|
std::string::size_type pos = 0;
|
||||||
while ((pos = pattern.find(brokenPattern, pos)) != std::string::npos) {
|
while ((pos = pattern.find(brokenPattern, pos)) != std::string::npos) {
|
||||||
|
|
|
@ -286,11 +286,11 @@ std::string ErrorMessage::serialize() const
|
||||||
|
|
||||||
for (std::list<ErrorMessage::FileLocation>::const_iterator loc = callStack.cbegin(); loc != callStack.cend(); ++loc) {
|
for (std::list<ErrorMessage::FileLocation>::const_iterator loc = callStack.cbegin(); loc != callStack.cend(); ++loc) {
|
||||||
std::string frame;
|
std::string frame;
|
||||||
frame += std::to_string((*loc).line);
|
frame += std::to_string(loc->line);
|
||||||
frame += '\t';
|
frame += '\t';
|
||||||
frame += std::to_string((*loc).column);
|
frame += std::to_string(loc->column);
|
||||||
frame += '\t';
|
frame += '\t';
|
||||||
frame += (*loc).getfile(false);
|
frame += loc->getfile(false);
|
||||||
frame += '\t';
|
frame += '\t';
|
||||||
frame += loc->getOrigFile(false);
|
frame += loc->getOrigFile(false);
|
||||||
frame += '\t';
|
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) {
|
for (std::list<FileLocation>::const_reverse_iterator it = callStack.crbegin(); it != callStack.crend(); ++it) {
|
||||||
printer.OpenElement("location", false);
|
printer.OpenElement("location", false);
|
||||||
printer.PushAttribute("file", (*it).getfile().c_str());
|
printer.PushAttribute("file", it->getfile().c_str());
|
||||||
printer.PushAttribute("line", std::max((*it).line,0));
|
printer.PushAttribute("line", std::max(it->line,0));
|
||||||
printer.PushAttribute("column", (*it).column);
|
printer.PushAttribute("column", it->column);
|
||||||
if (!it->getinfo().empty())
|
if (!it->getinfo().empty())
|
||||||
printer.PushAttribute("info", fixInvalidChars(it->getinfo()).c_str());
|
printer.PushAttribute("info", fixInvalidChars(it->getinfo()).c_str());
|
||||||
printer.CloseElement(false);
|
printer.CloseElement(false);
|
||||||
|
|
|
@ -5949,7 +5949,7 @@ const Type* Scope::findType(const std::string & name) const
|
||||||
|
|
||||||
// Type was found
|
// Type was found
|
||||||
if (definedTypesMap.end() != it)
|
if (definedTypesMap.end() != it)
|
||||||
return (*it).second;
|
return it->second;
|
||||||
|
|
||||||
// is type defined in anonymous namespace..
|
// is type defined in anonymous namespace..
|
||||||
it = definedTypesMap.find(emptyString);
|
it = definedTypesMap.find(emptyString);
|
||||||
|
|
|
@ -23,7 +23,7 @@ options::options(int argc, const char* const argv[])
|
||||||
,mExe(argv[0])
|
,mExe(argv[0])
|
||||||
{
|
{
|
||||||
for (std::set<std::string>::const_iterator it = mWhichTests.cbegin(); it != mWhichTests.cend();) {
|
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);
|
it = mWhichTests.erase(it);
|
||||||
else
|
else
|
||||||
++it;
|
++it;
|
||||||
|
|
|
@ -975,8 +975,8 @@ private:
|
||||||
ASSERT_EQUALS(true, parser->parseFromArgs(3, argv));
|
ASSERT_EQUALS(true, parser->parseFromArgs(3, argv));
|
||||||
ASSERT_EQUALS(2, settings->nofail.getSuppressions().size());
|
ASSERT_EQUALS(2, settings->nofail.getSuppressions().size());
|
||||||
auto it = settings->nofail.getSuppressions().cbegin();
|
auto it = settings->nofail.getSuppressions().cbegin();
|
||||||
ASSERT_EQUALS("uninitvar", (*it++).errorId);
|
ASSERT_EQUALS("uninitvar", (it++)->errorId);
|
||||||
ASSERT_EQUALS("unusedFunction", (*it).errorId);
|
ASSERT_EQUALS("unusedFunction", it->errorId);
|
||||||
ASSERT_EQUALS("", logger->str());
|
ASSERT_EQUALS("", logger->str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1323,8 +1323,8 @@ private:
|
||||||
ASSERT_EQUALS(true, parser->parseFromArgs(3, argv));
|
ASSERT_EQUALS(true, parser->parseFromArgs(3, argv));
|
||||||
ASSERT_EQUALS(2, settings->nomsg.getSuppressions().size());
|
ASSERT_EQUALS(2, settings->nomsg.getSuppressions().size());
|
||||||
auto it = settings->nomsg.getSuppressions().cbegin();
|
auto it = settings->nomsg.getSuppressions().cbegin();
|
||||||
ASSERT_EQUALS("uninitvar", (*it++).errorId);
|
ASSERT_EQUALS("uninitvar", (it++)->errorId);
|
||||||
ASSERT_EQUALS("unusedFunction", (*it).errorId);
|
ASSERT_EQUALS("unusedFunction", it->errorId);
|
||||||
ASSERT_EQUALS("", logger->str());
|
ASSERT_EQUALS("", logger->str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue