From 9eadb9fbc5dae0cc9c0d2f4afc8c4feb3ef7bb15 Mon Sep 17 00:00:00 2001 From: marioalexis Date: Fri, 17 Jun 2022 12:11:38 -0300 Subject: [PATCH] Mesh: Replace C cast --- src/Mod/Mesh/App/MeshProperties.cpp | 6 +++--- src/Mod/Mesh/Gui/ViewProvider.cpp | 4 ++-- src/Mod/Mesh/Gui/ViewProviderCurvature.cpp | 8 +++----- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/Mod/Mesh/App/MeshProperties.cpp b/src/Mod/Mesh/App/MeshProperties.cpp index 8d307f0384..e11b8803b0 100644 --- a/src/Mod/Mesh/App/MeshProperties.cpp +++ b/src/Mod/Mesh/App/MeshProperties.cpp @@ -490,12 +490,12 @@ const MeshObject& PropertyMeshKernel::getValue()const const MeshObject* PropertyMeshKernel::getValuePtr()const { - return (MeshObject*)_meshObject; + return static_cast(_meshObject); } const Data::ComplexGeoData* PropertyMeshKernel::getComplexData() const { - return (MeshObject*)_meshObject; + return static_cast(_meshObject); } Base::BoundBox3d PropertyMeshKernel::getBoundingBox() const @@ -514,7 +514,7 @@ unsigned int PropertyMeshKernel::getMemSize () const MeshObject* PropertyMeshKernel::startEditing() { aboutToSetValue(); - return (MeshObject*)_meshObject; + return static_cast(_meshObject); } void PropertyMeshKernel::finishEditing() diff --git a/src/Mod/Mesh/Gui/ViewProvider.cpp b/src/Mod/Mesh/Gui/ViewProvider.cpp index 4df52c2e92..429e28e83b 100644 --- a/src/Mod/Mesh/Gui/ViewProvider.cpp +++ b/src/Mod/Mesh/Gui/ViewProvider.cpp @@ -1539,7 +1539,7 @@ void ViewProviderMesh::segmentMesh(const MeshCore::MeshKernel& toolMesh, const B void ViewProviderMesh::faceInfoCallback(void * ud, SoEventCallback * n) { - const SoMouseButtonEvent * mbe = (SoMouseButtonEvent *)n->getEvent(); + const SoMouseButtonEvent * mbe = static_cast(n->getEvent()); Gui::View3DInventorViewer* view = static_cast(n->getUserData()); // Mark all incoming mouse button events as handled, especially, to deactivate the selection node @@ -1621,7 +1621,7 @@ void ViewProviderMesh::faceInfoCallback(void * ud, SoEventCallback * n) void ViewProviderMesh::fillHoleCallback(void * ud, SoEventCallback * n) { - const SoMouseButtonEvent * mbe = (SoMouseButtonEvent *)n->getEvent(); + const SoMouseButtonEvent * mbe = static_cast(n->getEvent()); Gui::View3DInventorViewer* view = static_cast(n->getUserData()); // Mark all incoming mouse button events as handled, especially, to deactivate the selection node diff --git a/src/Mod/Mesh/Gui/ViewProviderCurvature.cpp b/src/Mod/Mesh/Gui/ViewProviderCurvature.cpp index 0038050f33..30148b8217 100644 --- a/src/Mod/Mesh/Gui/ViewProviderCurvature.cpp +++ b/src/Mod/Mesh/Gui/ViewProviderCurvature.cpp @@ -541,8 +541,7 @@ void ViewProviderMeshCurvature::curvatureInfoCallback(void * ud, SoEventCallback ViewProviderMeshCurvature* self = static_cast(vp); const SoDetail* detail = point->getDetail(point->getPath()->getTail()); if (detail && detail->getTypeId() == SoFaceDetail::getClassTypeId()) { - // safe downward cast, know the type - SoFaceDetail * facedetail = (SoFaceDetail *)detail; + const SoFaceDetail * facedetail = static_cast(detail); // get the curvature info of the three points of the picked facet int index1 = facedetail->getPoint(0)->getCoordinateIndex(); int index2 = facedetail->getPoint(1)->getCoordinateIndex(); @@ -576,8 +575,7 @@ void ViewProviderMeshCurvature::curvatureInfoCallback(void * ud, SoEventCallback ViewProviderMeshCurvature* that = static_cast(vp); const SoDetail* detail = point->getDetail(point->getPath()->getTail()); if (detail && detail->getTypeId() == SoFaceDetail::getClassTypeId()) { - // safe downward cast, know the type - SoFaceDetail * facedetail = (SoFaceDetail *)detail; + const SoFaceDetail * facedetail = static_cast(detail); // get the curvature info of the three points of the picked facet int index1 = facedetail->getPoint(0)->getCoordinateIndex(); int index2 = facedetail->getPoint(1)->getCoordinateIndex(); @@ -594,7 +592,7 @@ std::string ViewProviderMeshCurvature::curvatureInfo(bool detail, int index1, in App::Property* prop = pcObject->getPropertyByName("CurvInfo"); std::stringstream str; if (prop && prop->getTypeId() == Mesh::PropertyCurvatureList::getClassTypeId()) { - Mesh::PropertyCurvatureList* curv = (Mesh::PropertyCurvatureList*)prop; + Mesh::PropertyCurvatureList* curv = static_cast(prop); const Mesh::CurvatureInfo& cVal1 = (*curv)[index1]; const Mesh::CurvatureInfo& cVal2 = (*curv)[index2]; const Mesh::CurvatureInfo& cVal3 = (*curv)[index3];