Part: Fix several coverity issues:

* CID 350581: Structurally dead code
* CID 350620: Structurally dead code
* CID 350563: Big parameter passed by value
* CID 350552: Uncaught exception
* CID 305193: Uncaught exception
* CID 350556: Uninitialized scalar field
* CID 350579: Uninitialized pointer read
This commit is contained in:
wmayer
2022-03-13 16:06:40 +01:00
parent 81ea374800
commit 15ee1fdd4e
6 changed files with 10 additions and 9 deletions

View File

@@ -406,7 +406,7 @@ void ExtrusionHelper::checkInnerWires(std::vector<bool>& isInnerWire, const gp_D
// recursively call the function until all wires are checked
if (numCheckWires > 1)
checkInnerWires(isInnerWire, direction, checklist, !forInner, prisms);
};
}
void ExtrusionHelper::createTaperedPrismOffset(TopoDS_Wire sourceWire,
const gp_Vec& translation,
@@ -452,11 +452,9 @@ void ExtrusionHelper::createTaperedPrismOffset(TopoDS_Wire sourceWire,
}
catch (const Base::Exception& e) {
throw Base::RuntimeError(e.what());
result = TopoDS_Wire();
}
if (!mkOffset.IsDone()) {
Standard_Failure::Raise("Extrusion: Offset could not be created");
result = TopoDS_Wire();
}
if (numEdges == 1) {
// we need to move the offset wire first back to its original position

View File

@@ -238,9 +238,6 @@ PyObject* GeometrySurfacePy::getDN(PyObject *args)
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
return nullptr;
}
PyErr_SetString(PartExceptionOCCError, "Geometry is not a surface");
return nullptr;
}
PyObject* GeometrySurfacePy::value(PyObject *args)

View File

@@ -663,7 +663,7 @@ Handle(Poly_Polygon3D) Part::Tools::polygonOfEdge(const TopoDS_Edge& edge, TopLo
// helper function to use in getNormal, here we pass the local properties
// of the surface given by the #LProp_SLProps objects
template <typename T>
void getNormalBySLProp(T prop, double u, double v, Standard_Real lastU, Standard_Real lastV,
void getNormalBySLProp(T& prop, double u, double v, Standard_Real lastU, Standard_Real lastV,
const Standard_Real tol, gp_Dir& dir, Standard_Boolean& done)
{
if (prop.D1U().Magnitude() > tol &&

View File

@@ -195,7 +195,12 @@ DlgProjectionOnSurface::~DlgProjectionOnSurface()
}
for (auto it : m_shapeVec)
{
higlight_object(it.partFeature, it.partName, false, 0);
try {
higlight_object(it.partFeature, it.partName, false, 0);
}
catch (Standard_NoSuchObject& e) {
Base::Console().Warning("DlgProjectionOnSurface::~DlgProjectionOnSurface: %s", e.GetMessageString());
}
}
Gui::Selection().rmvSelectionGate();
}

View File

@@ -247,7 +247,7 @@ void SectionCut::startCutting(bool isInitial)
// refresh documents list
onRefreshCutPBclicked();
App::DocumentObject* anObject;
App::DocumentObject* anObject = nullptr;
std::vector<App::DocumentObjectT>::iterator it;
// lambda function to delete objects

View File

@@ -119,6 +119,7 @@ TaskAttacher::TaskAttacher(Gui::ViewProviderDocumentObject *ViewProvider, QWidge
, ViewProvider(ViewProvider)
, ui(new Ui_TaskAttacher)
, visibilityFunc(visFunc)
, completed(false)
{
//check if we are attachable
if (!ViewProvider->getObject()->hasExtension(Part::AttachExtension::getExtensionClassTypeId()))