fix readability-*:

* readability-const-return-type
* readability-container-data-pointer
* readability-container-size-empty
* readability-delete-null-pointer
* readability-else-after-return
* readability-inconsistent-declaration-parameter-name
* readability-redundant-member-init
* readability-redundant-smartptr-get
* readability-redundant-string-cstr
* readability-use-anyofallof
* readability-static-definition-in-anonymous-namespace
* readability-static-accessed-through-instance
* readability-simplify-boolean-expr
This commit is contained in:
wmayer
2023-11-15 10:50:27 +01:00
parent e4975f0153
commit f539138dd9
42 changed files with 330 additions and 458 deletions

View File

@@ -25,6 +25,7 @@
#include "PreCompiled.h"
#ifndef _PreComp_
#include <algorithm>
#include <cassert>
#include <memory>
#include <xercesc/dom/DOM.hpp>
@@ -464,7 +465,7 @@ std::string ParameterGrp::GetPath() const
if (_Parent && _Parent != _Manager) {
path = _Parent->GetPath();
}
if (path.size() && _cName.size()) {
if (!path.empty() && !_cName.empty()) {
path += "/";
}
path += _cName;
@@ -506,9 +507,8 @@ bool ParameterGrp::IsEmpty() const
if (_pGroupNode && _pGroupNode->getFirstChild()) {
return false;
}
else {
return true;
}
return true;
}
/// test if a special sub group is in this group
@@ -730,13 +730,9 @@ bool ParameterGrp::GetBool(const char* Name, bool bPreset) const
if (!pcElem) {
return bPreset;
}
// if yes check the value and return
if (strcmp(StrX(pcElem->getAttribute(XStr("Value").unicodeForm())).c_str(), "1")) {
return false;
}
else {
return true;
}
return (strcmp(StrX(pcElem->getAttribute(XStr("Value").unicodeForm())).c_str(), "1") == 0);
}
void ParameterGrp::SetBool(const char* Name, bool bValue)
@@ -1381,13 +1377,10 @@ bool ParameterGrp::ShouldRemove() const
if (this->getRefCount() > 1) {
return false;
}
for (const auto& it : _GroupMap) {
bool ok = it.second->ShouldRemove();
if (!ok) {
return false;
}
}
return true;
return std::all_of(_GroupMap.cbegin(), _GroupMap.cend(), [](const auto& it) {
return it.second->ShouldRemove();
});
}
XERCES_CPP_NAMESPACE_QUALIFIER DOMElement*
@@ -1710,9 +1703,8 @@ int ParameterManager::LoadDocument()
if (paramSerializer) {
return paramSerializer->LoadDocument(*this);
}
else {
return -1;
}
return -1;
}
bool ParameterManager::LoadOrCreateDocument()
@@ -1720,9 +1712,8 @@ bool ParameterManager::LoadOrCreateDocument()
if (paramSerializer) {
return paramSerializer->LoadOrCreateDocument(*this);
}
else {
return false;
}
return false;
}
void ParameterManager::SaveDocument() const
@@ -1742,10 +1733,9 @@ bool ParameterManager::LoadOrCreateDocument(const char* sFileName)
LoadDocument(sFileName);
return false;
}
else {
CreateDocument();
return true;
}
CreateDocument();
return true;
}
int ParameterManager::LoadDocument(const char* sFileName)