Fix several clazy issue:
* Missing reference in range-for with non trivial type [-Wclazy-range-loop-reference]
This commit is contained in:
@@ -696,7 +696,7 @@ PyObject* DocumentObjectPy::getPathsByOutList(PyObject *args)
|
||||
(o)->getDocumentObjectPtr();
|
||||
auto array = getDocumentObjectPtr()->getPathsByOutList(target);
|
||||
Py::List list;
|
||||
for (auto it : array) {
|
||||
for (const auto& it : array) {
|
||||
Py::List path;
|
||||
for (auto jt : it) {
|
||||
path.append(Py::asObject(jt->getPyObject()));
|
||||
|
||||
@@ -137,7 +137,7 @@ public:
|
||||
template<typename ExtensionT>
|
||||
std::vector<ExtensionT*> getExtensionsDerivedFromType() const {
|
||||
std::vector<ExtensionT*> typevec;
|
||||
for(auto entry : _extensions) {
|
||||
for(const auto& entry : _extensions) {
|
||||
if(entry.first.isDerivedFrom(ExtensionT::getExtensionClassTypeId()))
|
||||
typevec.push_back(static_cast<ExtensionT*>(entry.second));
|
||||
}
|
||||
|
||||
@@ -923,7 +923,7 @@ void ParameterGrp::Clear(void)
|
||||
}
|
||||
|
||||
// remove group handles
|
||||
for (auto it : removeGrp) {
|
||||
for (const auto& it : removeGrp) {
|
||||
auto pos = _GroupMap.find(it);
|
||||
vecNodes.push_back(pos->second->_pGroupNode);
|
||||
_GroupMap.erase(pos->first);
|
||||
|
||||
@@ -356,7 +356,7 @@ static void linkConvert(bool unlink) {
|
||||
// PropertyLinkBase::CopyOnLinkReplace().
|
||||
|
||||
std::map<std::pair<App::DocumentObject*,App::DocumentObject*>, Info> infos;
|
||||
for(auto sel : TreeWidget::getSelection()) {
|
||||
for(const auto& sel : TreeWidget::getSelection()) {
|
||||
auto obj = sel.vp->getObject();
|
||||
auto parent = sel.parentVp;
|
||||
if(!parent) {
|
||||
|
||||
@@ -118,7 +118,7 @@ PyObject* CommandPy::listByShortcut(PyObject *args)
|
||||
|
||||
PyObject* pyList = PyList_New(matches.size());
|
||||
int i=0;
|
||||
for (std::string match : matches) {
|
||||
for (const std::string& match : matches) {
|
||||
PyObject* str = PyUnicode_FromString(match.c_str());
|
||||
PyList_SetItem(pyList, i++, str);
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ DlgAddProperty::DlgAddProperty(QWidget* parent,
|
||||
|
||||
std::vector<Base::Type> types;
|
||||
Base::Type::getAllDerivedFrom(Base::Type::fromName("App::Property"),types);
|
||||
for(auto type : types) {
|
||||
for(const auto& type : types) {
|
||||
ui->comboType->addItem(QString::fromLatin1(type.getName()));
|
||||
if(type == defType)
|
||||
ui->comboType->setCurrentIndex(ui->comboType->count()-1);
|
||||
|
||||
@@ -353,7 +353,7 @@ void DlgPropertyLink::init(const App::DocumentObjectT &prop, bool tryFilter) {
|
||||
// For link list type property, try to auto filter type
|
||||
if(tryFilter && isLinkList) {
|
||||
Base::Type objType;
|
||||
for(auto link : oldLinks) {
|
||||
for(const auto& link : oldLinks) {
|
||||
auto obj = link.getSubObject();
|
||||
if(!obj)
|
||||
continue;
|
||||
@@ -745,7 +745,7 @@ QList<App::SubObjectT> DlgPropertyLink::originalLinks() const
|
||||
return oldLinks;
|
||||
}
|
||||
|
||||
QString DlgPropertyLink::linksToPython(QList<App::SubObjectT> links) {
|
||||
QString DlgPropertyLink::linksToPython(const QList<App::SubObjectT>& links) {
|
||||
if(links.isEmpty())
|
||||
return QLatin1String("None");
|
||||
|
||||
@@ -756,7 +756,7 @@ QString DlgPropertyLink::linksToPython(QList<App::SubObjectT> links) {
|
||||
|
||||
if(isLinkSub(links)) {
|
||||
ss << '(' << links.front().getObjectPython() << ", [";
|
||||
for(auto link : links) {
|
||||
for(const auto& link : links) {
|
||||
const auto &sub = link.getSubName();
|
||||
if(sub.size())
|
||||
ss << "u'" << Base::Tools::escapedUnicodeFromUtf8(sub.c_str()) << "',";
|
||||
@@ -764,7 +764,7 @@ QString DlgPropertyLink::linksToPython(QList<App::SubObjectT> links) {
|
||||
ss << "])";
|
||||
} else {
|
||||
ss << '[';
|
||||
for(auto link : links)
|
||||
for(const auto& link : links)
|
||||
ss << link.getSubObjectPython(false) << ',';
|
||||
ss << ']';
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
|
||||
void init(const App::DocumentObjectT &prop, bool tryFilter=true);
|
||||
|
||||
static QString linksToPython(QList<App::SubObjectT> links);
|
||||
static QString linksToPython(const QList<App::SubObjectT>& links);
|
||||
|
||||
static QList<App::SubObjectT> getLinksFromProperty(const App::PropertyLinkBase *prop);
|
||||
|
||||
|
||||
@@ -502,7 +502,7 @@ Py::Object AbstractSplitViewPy::getattr(const char * attr)
|
||||
if (name == "__dict__" || name == "__class__") {
|
||||
Py::Dict dict_self(BaseType::getattr("__dict__"));
|
||||
Py::Dict dict_base(base.getattr("__dict__"));
|
||||
for (auto it : dict_base) {
|
||||
for (const auto& it : dict_base) {
|
||||
dict_self.setItem(it.first, it.second);
|
||||
}
|
||||
return dict_self;
|
||||
|
||||
@@ -3387,7 +3387,7 @@ void TreeWidget::_slotDeleteObject(const Gui::ViewProviderDocumentObject& view,
|
||||
|
||||
bool needUpdate = false;
|
||||
|
||||
for (auto data : itEntry->second) {
|
||||
for (const auto& data : itEntry->second) {
|
||||
DocumentItem* docItem = data->docItem;
|
||||
if (docItem == deletingDoc)
|
||||
continue;
|
||||
@@ -3701,7 +3701,7 @@ void TreeWidget::slotChangeObject(
|
||||
const char* label = obj->Label.getValue();
|
||||
auto firstData = *itEntry->second.begin();
|
||||
if (firstData->label != label) {
|
||||
for (auto data : itEntry->second) {
|
||||
for (const auto& data : itEntry->second) {
|
||||
data->label = label;
|
||||
auto displayName = QString::fromUtf8(label);
|
||||
for (auto item : data->items)
|
||||
@@ -3715,7 +3715,7 @@ void TreeWidget::slotChangeObject(
|
||||
const char* label = obj->Label2.getValue();
|
||||
auto firstData = *itEntry->second.begin();
|
||||
if (firstData->label2 != label) {
|
||||
for (auto data : itEntry->second) {
|
||||
for (const auto& data : itEntry->second) {
|
||||
data->label2 = label;
|
||||
auto displayName = QString::fromUtf8(label);
|
||||
for (auto item : data->items)
|
||||
|
||||
@@ -282,7 +282,7 @@ Py::Object View3DInventorPy::getattribute(const char * attr)
|
||||
if (name == "__dict__" || name == "__class__") {
|
||||
Py::Dict dict_self(BaseType::getattr("__dict__"));
|
||||
Py::Dict dict_base(base.getattr("__dict__"));
|
||||
for (auto it : dict_base) {
|
||||
for (const auto& it : dict_base) {
|
||||
dict_self.setItem(it.first, it.second);
|
||||
}
|
||||
return dict_self;
|
||||
|
||||
@@ -646,7 +646,7 @@ public:
|
||||
dot = next;
|
||||
}
|
||||
|
||||
for(auto v : nodeMap) {
|
||||
for(const auto& v : nodeMap) {
|
||||
if(v.second->getDetail(true,type,subname,det,path))
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user