fix coverity issues
This commit is contained in:
parent
6d3e2a396a
commit
68ea7fdac5
|
@ -73,6 +73,7 @@ bool GUIApplication::notify (QObject * receiver, QEvent * event)
|
|||
if (!receiver) {
|
||||
Base::Console().Log("GUIApplication::notify: Unexpected null receiver, event type: %d\n",
|
||||
(int)event->type());
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
if (event->type() == Spaceball::ButtonEvent::ButtonEventType ||
|
||||
|
|
|
@ -38,7 +38,6 @@
|
|||
#include "Document.h"
|
||||
#include "Selection.h"
|
||||
#include "SelectionFilter.h"
|
||||
#include "SelectionObjectPy.h"
|
||||
#include "View3DInventor.h"
|
||||
#include <Base/Exception.h>
|
||||
#include <Base/Console.h>
|
||||
|
@ -47,6 +46,7 @@
|
|||
#include <App/Document.h>
|
||||
#include <App/DocumentObject.h>
|
||||
#include <App/DocumentObjectPy.h>
|
||||
#include <Gui/SelectionObjectPy.h>
|
||||
#include "MainWindow.h"
|
||||
|
||||
|
||||
|
@ -981,6 +981,7 @@ SelectionSingleton::SelectionSingleton()
|
|||
hz = 0;
|
||||
ActiveGate = 0;
|
||||
App::GetApplication().signalDeletedObject.connect(boost::bind(&Gui::SelectionSingleton::slotDeletedObject, this, _1));
|
||||
CurrentPreselection.Type = SelectionChanges::ClrSelection;
|
||||
CurrentPreselection.pDocName = 0;
|
||||
CurrentPreselection.pObjectName = 0;
|
||||
CurrentPreselection.pSubName = 0;
|
||||
|
|
|
@ -841,9 +841,10 @@ void View3DInventorViewer::setNavigationType(Base::Type t)
|
|||
}
|
||||
|
||||
NavigationStyle* ns = static_cast<NavigationStyle*>(base);
|
||||
ns->operator = (*this->navigation);
|
||||
if (this->navigation)
|
||||
if (this->navigation) {
|
||||
ns->operator = (*this->navigation);
|
||||
delete this->navigation;
|
||||
}
|
||||
this->navigation = ns;
|
||||
this->navigation->setViewer(this);
|
||||
}
|
||||
|
|
|
@ -273,6 +273,9 @@ void orthoview::set_projection(gp_Ax2 cs)
|
|||
|
||||
OrthoViews::OrthoViews(App::Document* doc, const char * pagename, const char * partname)
|
||||
{
|
||||
horiz = 0;
|
||||
vert = 0;
|
||||
|
||||
parent_doc = doc;
|
||||
parent_doc->openTransaction("Create view");
|
||||
|
||||
|
|
|
@ -232,22 +232,21 @@ PyObject* FemMeshPy::addEdge(PyObject *args)
|
|||
SMESHDS_Mesh* meshDS = mesh->GetMeshDS();
|
||||
|
||||
int n1,n2;
|
||||
if (!PyArg_ParseTuple(args, "ii",&n1,&n2))
|
||||
return 0;
|
||||
|
||||
try {
|
||||
const SMDS_MeshNode* node1 = meshDS->FindNode(n1);
|
||||
const SMDS_MeshNode* node2 = meshDS->FindNode(n2);
|
||||
if (!node1 || !node2)
|
||||
throw std::runtime_error("Failed to get node of the given indices");
|
||||
SMDS_MeshEdge* edge = meshDS->AddEdge(node1, node2);
|
||||
if (!edge)
|
||||
throw std::runtime_error("Failed to add edge");
|
||||
return Py::new_reference_to(Py::Int(edge->GetID()));
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
PyErr_SetString(Base::BaseExceptionFreeCADError, e.what());
|
||||
return 0;
|
||||
if (PyArg_ParseTuple(args, "ii",&n1,&n2)) {
|
||||
try {
|
||||
const SMDS_MeshNode* node1 = meshDS->FindNode(n1);
|
||||
const SMDS_MeshNode* node2 = meshDS->FindNode(n2);
|
||||
if (!node1 || !node2)
|
||||
throw std::runtime_error("Failed to get node of the given indices");
|
||||
SMDS_MeshEdge* edge = meshDS->AddEdge(node1, node2);
|
||||
if (!edge)
|
||||
throw std::runtime_error("Failed to add edge");
|
||||
return Py::new_reference_to(Py::Int(edge->GetID()));
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
PyErr_SetString(Base::BaseExceptionFreeCADError, e.what());
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
PyErr_Clear();
|
||||
|
||||
|
@ -281,20 +280,21 @@ PyObject* FemMeshPy::addEdge(PyObject *args)
|
|||
default:
|
||||
throw std::runtime_error("Unknown node count, [2|3] are allowed"); //unknown edge type
|
||||
}
|
||||
}else{
|
||||
}
|
||||
else {
|
||||
switch(Nodes.size()){
|
||||
case 2:
|
||||
edge = meshDS->AddEdge(Nodes[0],Nodes[1]);
|
||||
if (!edge)
|
||||
throw std::runtime_error("Failed to add edge");
|
||||
break;
|
||||
case 3:
|
||||
edge = meshDS->AddEdge(Nodes[0],Nodes[1],Nodes[2]);
|
||||
if (!edge)
|
||||
throw std::runtime_error("Failed to add edge");
|
||||
break;
|
||||
default:
|
||||
throw std::runtime_error("Unknown node count, [2|3] are allowed"); //unknown edge type
|
||||
case 2:
|
||||
edge = meshDS->AddEdge(Nodes[0],Nodes[1]);
|
||||
if (!edge)
|
||||
throw std::runtime_error("Failed to add edge");
|
||||
break;
|
||||
case 3:
|
||||
edge = meshDS->AddEdge(Nodes[0],Nodes[1],Nodes[2]);
|
||||
if (!edge)
|
||||
throw std::runtime_error("Failed to add edge");
|
||||
break;
|
||||
default:
|
||||
throw std::runtime_error("Unknown node count, [2|3] are allowed"); //unknown edge type
|
||||
}
|
||||
}
|
||||
return Py::new_reference_to(Py::Int(edge->GetID()));
|
||||
|
|
|
@ -52,7 +52,7 @@ using namespace FemGui;
|
|||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
TaskDlgMeshShapeNetgen::TaskDlgMeshShapeNetgen(FemGui::ViewProviderFemMeshShapeNetgen *obj)
|
||||
: TaskDialog(),ViewProviderFemMeshShapeNetgen(obj)
|
||||
: TaskDialog(), param(0), ViewProviderFemMeshShapeNetgen(obj)
|
||||
{
|
||||
FemMeshShapeNetgenObject = dynamic_cast<Fem::FemMeshShapeNetgenObject *>(obj->getObject());
|
||||
if (FemMeshShapeNetgenObject) {
|
||||
|
|
|
@ -183,7 +183,7 @@ void ViewProviderInspection::updateData(const App::Property* prop)
|
|||
{
|
||||
// set to the expected size
|
||||
if (prop->getTypeId() == App::PropertyLink::getClassTypeId()) {
|
||||
App::GeoFeature* object = dynamic_cast<const App::PropertyLink*>(prop)->getValue<App::GeoFeature*>();
|
||||
App::GeoFeature* object = static_cast<const App::PropertyLink*>(prop)->getValue<App::GeoFeature*>();
|
||||
if (object) {
|
||||
float accuracy=0;
|
||||
Base::Type meshId = Base::Type::fromName("Mesh::Feature");
|
||||
|
|
|
@ -1639,9 +1639,6 @@ Base::Placement AttachEngineLine::calculateAttachedPlacement(Base::Placement ori
|
|||
|
||||
|
||||
switch (mmode) {
|
||||
case mmDeactivated:
|
||||
//should have been filtered out already!
|
||||
break;
|
||||
case mm1AxisInertia1:
|
||||
case mm1AxisInertia2:
|
||||
case mm1AxisInertia3:{
|
||||
|
@ -1802,7 +1799,7 @@ Base::Placement AttachEngineLine::calculateAttachedPlacement(Base::Placement ori
|
|||
|
||||
//=================================================================================
|
||||
|
||||
TYPESYSTEM_SOURCE(Attacher::AttachEnginePoint, Attacher::AttachEngine);
|
||||
TYPESYSTEM_SOURCE(Attacher::AttachEnginePoint, Attacher::AttachEngine)
|
||||
|
||||
AttachEnginePoint::AttachEnginePoint()
|
||||
{
|
||||
|
@ -1874,7 +1871,7 @@ Base::Placement AttachEnginePoint::calculateAttachedPlacement(Base::Placement or
|
|||
std::vector<eRefType> types;
|
||||
readLinks(this->references, parts, shapes, copiedShapeStorage, types);
|
||||
|
||||
if (parts.size() == 0)
|
||||
if (parts.empty())
|
||||
throw ExceptionCancel();
|
||||
|
||||
|
||||
|
@ -1884,9 +1881,6 @@ Base::Placement AttachEnginePoint::calculateAttachedPlacement(Base::Placement or
|
|||
|
||||
|
||||
switch (mmode) {
|
||||
case mmDeactivated:
|
||||
//should have been filtered out already!
|
||||
break;
|
||||
case mm0Vertex:{
|
||||
std::vector<gp_Pnt> points;
|
||||
assert(shapes.size()>0);
|
||||
|
|
|
@ -86,9 +86,11 @@ void ViewProviderBoolean::updateData(const App::Property* prop)
|
|||
if (hist.size() != 2)
|
||||
return;
|
||||
Part::Boolean* objBool = dynamic_cast<Part::Boolean*>(getObject());
|
||||
if (!objBool)
|
||||
return;
|
||||
Part::Feature* objBase = dynamic_cast<Part::Feature*>(objBool->Base.getValue());
|
||||
Part::Feature* objTool = dynamic_cast<Part::Feature*>(objBool->Tool.getValue());
|
||||
if (objBool && objBase && objTool) {
|
||||
if (objBase && objTool) {
|
||||
const TopoDS_Shape& baseShape = objBase->Shape.getValue();
|
||||
const TopoDS_Shape& toolShape = objTool->Shape.getValue();
|
||||
const TopoDS_Shape& boolShape = objBool->Shape.getValue();
|
||||
|
|
|
@ -67,7 +67,7 @@ PROPERTY_SOURCE(PartGui::ViewProviderCurveNet,PartGui::ViewProviderPart)
|
|||
|
||||
|
||||
ViewProviderCurveNet::ViewProviderCurveNet()
|
||||
: bInEdit(false),bMovePointMode(false)
|
||||
: bInEdit(false),bMovePointMode(false),EdgeRoot(0),VertexRoot(0)
|
||||
{
|
||||
LineWidth.setValue(4.0f);
|
||||
PointSize.setValue(0.05f);
|
||||
|
|
|
@ -239,8 +239,10 @@ void ViewProviderFillet::updateData(const App::Property* prop)
|
|||
if (hist.size() != 1)
|
||||
return;
|
||||
Part::Fillet* objFill = dynamic_cast<Part::Fillet*>(getObject());
|
||||
if (!objFill)
|
||||
return;
|
||||
Part::Feature* objBase = dynamic_cast<Part::Feature*>(objFill->Base.getValue());
|
||||
if (objFill && objBase) {
|
||||
if (objBase) {
|
||||
const TopoDS_Shape& baseShape = objBase->Shape.getValue();
|
||||
const TopoDS_Shape& fillShape = objFill->Shape.getValue();
|
||||
|
||||
|
@ -342,8 +344,10 @@ void ViewProviderChamfer::updateData(const App::Property* prop)
|
|||
if (hist.size() != 1)
|
||||
return;
|
||||
Part::Chamfer* objCham = dynamic_cast<Part::Chamfer*>(getObject());
|
||||
if (!objCham)
|
||||
return;
|
||||
Part::Feature* objBase = dynamic_cast<Part::Feature*>(objCham->Base.getValue());
|
||||
if (objCham && objBase) {
|
||||
if (objBase) {
|
||||
const TopoDS_Shape& baseShape = objBase->Shape.getValue();
|
||||
const TopoDS_Shape& chamShape = objCham->Shape.getValue();
|
||||
|
||||
|
|
|
@ -2602,7 +2602,7 @@ private:
|
|||
{
|
||||
// We will approximate the ellipse as a sequence of connected chords
|
||||
// Number of points per quadrant of the ellipse
|
||||
double n = static_cast<double>((editCurve.size() - 1) / 4);
|
||||
int n = static_cast<int>((editCurve.size() - 1) / 4);
|
||||
|
||||
// We choose points in the perifocal frame then translate them to sketch cartesian.
|
||||
// This gives us a better approximation of an ellipse, i.e. more points where the
|
||||
|
@ -2661,7 +2661,7 @@ private:
|
|||
*/
|
||||
void ellipseToOctave(Base::Vector2D /*onSketchPos*/)
|
||||
{
|
||||
double n = static_cast<double>((editCurve.size() - 1) / 4);
|
||||
int n = static_cast<int>((editCurve.size() - 1) / 4);
|
||||
|
||||
// send a GNU Octave script to stdout to plot points for debugging
|
||||
std::ostringstream octave;
|
||||
|
|
Loading…
Reference in New Issue
Block a user