[App] code style fixes by MSVC

- automatic .clang fixes while checking for nullptr, no actual code change
This commit is contained in:
Uwe
2022-07-18 13:03:42 +02:00
parent 763a575b23
commit 32ffcc7eda
2 changed files with 29 additions and 30 deletions

View File

@@ -256,24 +256,24 @@ void LinkBaseExtension::setProperty(int idx, Property *prop) {
getPlacementProperty())
{
bool transform = getLinkTransformValue();
getPlacementProperty()->setStatus(Property::Hidden,transform);
getLinkPlacementProperty()->setStatus(Property::Hidden,!transform);
getPlacementProperty()->setStatus(Property::Hidden, transform);
getLinkPlacementProperty()->setStatus(Property::Hidden, !transform);
}
break;
case PropElementList:
getElementListProperty()->setScope(LinkScope::Global);
getElementListProperty()->setStatus(Property::Hidden,true);
getElementListProperty()->setStatus(Property::Hidden, true);
// fall through
case PropLinkedObject:
// Make ElementList as read-only if we are not a group (i.e. having
// LinkedObject property), because it is for holding array elements.
if(getElementListProperty())
getElementListProperty()->setStatus(
Property::Immutable,getLinkedObjectProperty()!=nullptr);
Property::Immutable, getLinkedObjectProperty() != nullptr);
break;
case PropVisibilityList:
getVisibilityListProperty()->setStatus(Property::Immutable,true);
getVisibilityListProperty()->setStatus(Property::Hidden,true);
getVisibilityListProperty()->setStatus(Property::Immutable, true);
getVisibilityListProperty()->setStatus(Property::Hidden, true);
break;
}
@@ -1624,16 +1624,16 @@ void LinkBaseExtension::update(App::DocumentObject *parent, const Property *prop
}
// touch the property again to make sure view provider has been
// signaled before clearing the elements
getShowElementProperty()->setStatus(App::Property::User3,true);
getShowElementProperty()->setStatus(App::Property::User3, true);
getShowElementProperty()->touch();
getShowElementProperty()->setStatus(App::Property::User3,false);
getShowElementProperty()->setStatus(App::Property::User3, false);
getElementListProperty()->setValues(std::vector<App::DocumentObject*>());
if(getPlacementListProperty()) {
getPlacementListProperty()->setStatus(Property::User3,getScaleListProperty()!=nullptr);
getPlacementListProperty()->setStatus(Property::User3, getScaleListProperty() != nullptr);
getPlacementListProperty()->setValue(placements);
getPlacementListProperty()->setStatus(Property::User3,false);
getPlacementListProperty()->setStatus(Property::User3, false);
}
if(getScaleListProperty())
getScaleListProperty()->setValue(scales);
@@ -1884,34 +1884,33 @@ void LinkBaseExtension::syncElementList() {
auto owner = getContainer();
auto ownerID = owner?owner->getID():0;
auto elements = getElementListValue();
for(size_t i=0;i<elements.size();++i) {
for (size_t i = 0; i < elements.size(); ++i) {
auto element = freecad_dynamic_cast<LinkElement>(elements[i]);
if(!element
|| (element->_LinkOwner.getValue()
&& element->_LinkOwner.getValue()!=ownerID))
if (!element
|| (element->_LinkOwner.getValue()
&& element->_LinkOwner.getValue() != ownerID))
continue;
element->_LinkOwner.setValue(ownerID);
element->LinkTransform.setStatus(Property::Hidden,transform!=nullptr);
element->LinkTransform.setStatus(Property::Immutable,transform!=nullptr);
if(transform && element->LinkTransform.getValue()!=transform->getValue())
element->LinkTransform.setStatus(Property::Hidden, transform != nullptr);
element->LinkTransform.setStatus(Property::Immutable, transform != nullptr);
if (transform && element->LinkTransform.getValue() != transform->getValue())
element->LinkTransform.setValue(transform->getValue());
element->LinkedObject.setStatus(Property::Hidden,link!=nullptr);
element->LinkedObject.setStatus(Property::Immutable,link!=nullptr);
if(element->LinkCopyOnChange.getValue()==2)
element->LinkedObject.setStatus(Property::Hidden, link != nullptr);
element->LinkedObject.setStatus(Property::Immutable, link != nullptr);
if (element->LinkCopyOnChange.getValue() == 2)
continue;
if(xlink) {
if(element->LinkedObject.getValue()!=xlink->getValue() ||
element->LinkedObject.getSubValues()!=xlink->getSubValues())
{
if (xlink) {
if (element->LinkedObject.getValue() != xlink->getValue()
|| element->LinkedObject.getSubValues() != xlink->getSubValues()) {
element->LinkedObject.setValue(xlink->getValue(), xlink->getSubValues());
}
} else if(element->LinkedObject.getValue()!=link->getValue() ||
element->LinkedObject.getSubValues().size())
{
element->setLink(-1,link->getValue());
}
else if (element->LinkedObject.getValue() != link->getValue()
|| element->LinkedObject.getSubValues().size()) {
element->setLink(-1, link->getValue());
}
}
}

View File

@@ -115,7 +115,7 @@ void PropertyLinkBase::unregisterLabelReferences()
void PropertyLinkBase::getLabelReferences(std::vector<std::string> &subs,const char *subname) {
const char *dot;
for(;(subname=strchr(subname,'$'))!=nullptr; subname=dot+1) {
for (; (subname = strchr(subname, '$')) != nullptr; subname = dot + 1) {
++subname;
dot = strchr(subname,'.');
if(!dot) break;
@@ -154,7 +154,7 @@ std::string PropertyLinkBase::updateLabelReference(const App::DocumentObject *pa
// hierarchies, we have to search for all occurrences, and make sure the
// referenced sub-object at the found hierarchy is actually the given
// object.
for(const char *pos=subname; ((pos=strstr(pos,ref.c_str()))!=nullptr); pos+=ref.size()) {
for (const char *pos = subname; ((pos = strstr(pos, ref.c_str())) != nullptr); pos += ref.size()) {
auto sub = std::string(subname,pos+ref.size()-subname);
auto sobj = parent->getSubObject(sub.c_str());
if(sobj == obj) {