fix more Coverity issues

This commit is contained in:
wmayer 2016-08-17 21:55:00 +02:00
parent 4e1794f5c8
commit 13528b0aec
6 changed files with 48 additions and 50 deletions

View File

@ -707,6 +707,7 @@ MacroCommand::MacroCommand(const char* name, bool system)
{
sGroup = QT_TR_NOOP("Macros");
eType = 0;
sScriptName = 0;
}
MacroCommand::~MacroCommand()

View File

@ -924,7 +924,7 @@ void StdCmdToggleObjects::activated(int iMsg)
(App::DocumentObject::getClassTypeId());
for (std::vector<App::DocumentObject*>::const_iterator it=obj.begin();it!=obj.end();++it) {
if (doc && doc->isShow((*it)->getNameInDocument()))
if (doc->isShow((*it)->getNameInDocument()))
doCommand(Gui,"Gui.getDocument(\"%s\").getObject(\"%s\").Visibility=False"
, app->getName(), (*it)->getNameInDocument());
else

View File

@ -1425,25 +1425,25 @@ PyObject* Document::getPyObject(void)
void Document::handleChildren3D(ViewProvider* viewProvider)
{
// check for children
if (viewProvider->getChildRoot()) {
if (viewProvider && viewProvider->getChildRoot()) {
std::vector<App::DocumentObject*> children = viewProvider->claimChildren3D();
SoGroup* childGroup = viewProvider->getChildRoot();
// size not the same -> build up the list new
if(childGroup->getNumChildren() != static_cast<int>(children.size())){
if (childGroup->getNumChildren() != static_cast<int>(children.size())) {
childGroup->removeAllChildren();
for(std::vector<App::DocumentObject*>::iterator it=children.begin();it!=children.end();++it){
for (std::vector<App::DocumentObject*>::iterator it=children.begin();it!=children.end();++it) {
ViewProvider* ChildViewProvider = getViewProvider(*it);
if(ChildViewProvider) {
if (ChildViewProvider) {
SoSeparator* childRootNode = ChildViewProvider->getRoot();
childGroup->addChild(childRootNode);
// cycling to all views of the document to remove the viewprovider from the viewer itself
for (std::list<Gui::BaseView*>::iterator vIt = d->baseViews.begin();vIt != d->baseViews.end();++vIt) {
View3DInventor *activeView = dynamic_cast<View3DInventor *>(*vIt);
if (activeView && viewProvider && activeView->getViewer()->hasViewProvider(ChildViewProvider)) {
if (activeView && activeView->getViewer()->hasViewProvider(ChildViewProvider)) {
// Note about hasViewProvider()
//remove the viewprovider serves the purpose of detaching the inventor nodes from the
//top level root in the viewer. However, if some of the children were grouped beneath the object

View File

@ -505,32 +505,31 @@ int FreehandSelection::mouseButtonEvent(const SoMouseButtonEvent* const e, const
const SbBool press = e->getState() == SoButtonEvent::DOWN ? true : false;
if (press) {
switch(button)
{
switch(button) {
case SoMouseButtonEvent::BUTTON1:
{
if (!polyline.isWorking()) {
polyline.setWorking(true);
polyline.clear();
};
polyline.addNode(pos);
polyline.setCoords(pos.x(), pos.y());
m_iXnew = pos.x(); m_iYnew = pos.y();
m_iXold = pos.x(); m_iYold = pos.y();
}
break;
{
if (!polyline.isWorking()) {
polyline.setWorking(true);
polyline.clear();
}
polyline.addNode(pos);
polyline.setCoords(pos.x(), pos.y());
m_iXnew = pos.x(); m_iYnew = pos.y();
m_iXold = pos.x(); m_iYold = pos.y();
}
break;
case SoMouseButtonEvent::BUTTON2:
{
polyline.addNode(pos);
m_iXnew = pos.x(); m_iYnew = pos.y();
m_iXold = pos.x(); m_iYold = pos.y();
}
break;
{
polyline.addNode(pos);
m_iXnew = pos.x(); m_iYnew = pos.y();
m_iXold = pos.x(); m_iYold = pos.y();
}
break;
default:
{
} break;
break;
}
}
// release
@ -542,31 +541,31 @@ int FreehandSelection::mouseButtonEvent(const SoMouseButtonEvent* const e, const
releaseMouseModel();
return Finish;
}
break;
case SoMouseButtonEvent::BUTTON2:
{
QCursor cur = _pcView3D->getWidget()->cursor();
_pcView3D->getWidget()->setCursor(m_cPrevCursor);
{
QCursor cur = _pcView3D->getWidget()->cursor();
_pcView3D->getWidget()->setCursor(m_cPrevCursor);
// The pop-up menu should be shown when releasing mouse button because
// otherwise the navigation style doesn't get the UP event and gets into
// an inconsistent state.
int id = popupMenu();
// The pop-up menu should be shown when releasing mouse button because
// otherwise the navigation style doesn't get the UP event and gets into
// an inconsistent state.
int id = popupMenu();
if (id == Finish || id == Cancel) {
releaseMouseModel();
if (id == Finish || id == Cancel) {
releaseMouseModel();
}
else if (id == Restart) {
_pcView3D->getWidget()->setCursor(cur);
}
polyline.setWorking(false);
return id;
}
else if (id == Restart) {
_pcView3D->getWidget()->setCursor(cur);
}
polyline.setWorking(false);
return id;
}
break;
break;
default:
{
} break;
break;
}
}

View File

@ -135,10 +135,10 @@ void PropertyView::slotAppendDynamicProperty(const App::Property& prop)
if (parent->isHidden(&prop))
return;
if (parent && parent->isDerivedFrom(App::DocumentObject::getClassTypeId())) {
if (parent->isDerivedFrom(App::DocumentObject::getClassTypeId())) {
propertyEditorData->appendProperty(prop);
}
else if (parent && parent->isDerivedFrom(Gui::ViewProvider::getClassTypeId())) {
else if (parent->isDerivedFrom(Gui::ViewProvider::getClassTypeId())) {
propertyEditorView->appendProperty(prop);
}
}

View File

@ -634,8 +634,6 @@ Py::Object AbstractSplitViewPy::getViewer(const Py::Tuple& args)
catch(...) {
throw Py::Exception("Unknown C++ exception");
}
return Py::None();
}
Py::Object AbstractSplitViewPy::sequence_item(ssize_t viewIndex)