PVS: V547 Expression is always true/false

This commit is contained in:
wmayer
2020-07-17 12:04:49 +02:00
parent 02f45721d6
commit 1b2a7ef6fc
3 changed files with 17 additions and 19 deletions

View File

@@ -80,7 +80,7 @@ Gui::ActiveObjectList::ObjectInfo Gui::ActiveObjectList::getObjectInfo(App::Docu
return info;
if(subname) {
info.obj = obj;
if(subname) info.subname = subname;
info.subname = subname;
}else{
// If the input object is not from this document, it must be brought in
// by some link type object of this document. We only accept the object

View File

@@ -1511,44 +1511,42 @@ void SelectionSingleton::clearSelection(const char* pDocName, bool clearPreSelec
// Because the introduction of external editing, it is best to make
// clearSelection(0) behave as clearCompleteSelection(), which is the same
// behavior of python Selection.clearSelection(None)
if(!pDocName || !pDocName[0] || strcmp(pDocName,"*")==0) {
if (!pDocName || !pDocName[0] || strcmp(pDocName,"*")==0) {
clearCompleteSelection(clearPreSelect);
return;
}
if(_PickedList.size()) {
if (_PickedList.size()) {
_PickedList.clear();
notify(SelectionChanges(SelectionChanges::PickedListChanged));
}
App::Document* pDoc;
pDoc = getDocument(pDocName);
if(pDoc) {
std::string docName;
if (pDocName)
docName = pDocName;
else
docName = pDoc->getName(); // active document
if(clearPreSelect && DocName == docName)
if (pDoc) {
std::string docName = pDocName;
if (clearPreSelect && DocName == docName)
rmvPreselect();
bool touched = false;
for(auto it=_SelList.begin();it!=_SelList.end();) {
if(it->DocName == docName) {
for (auto it=_SelList.begin();it!=_SelList.end();) {
if (it->DocName == docName) {
touched = true;
it = _SelList.erase(it);
}else
}
else {
++it;
}
}
if(!touched)
if (!touched)
return;
if(!logDisabled) {
if (!logDisabled) {
std::ostringstream ss;
ss << "Gui.Selection.clearSelection('" << docName << "'";
if(!clearPreSelect)
ss << ",False";
if (!clearPreSelect)
ss << ", False";
ss << ')';
Application::Instance->macroManager()->addLine(MacroManager::Cmt,ss.str().c_str());
}

View File

@@ -178,7 +178,7 @@ TaskWatcherPython::TaskWatcherPython(const Py::Object& o)
Gui::TaskView::TaskBox *tb = 0;
if (watcher.hasAttr(std::string("commands"))) {
if (!tb) tb = new Gui::TaskView::TaskBox(icon, title, true, 0);
tb = new Gui::TaskView::TaskBox(icon, title, true, 0);
Py::Sequence cmds(watcher.getAttr(std::string("commands")));
CommandManager &mgr = Gui::Application::Instance->commandManager();
for (Py::Sequence::iterator it = cmds.begin(); it != cmds.end(); ++it) {