From 35122b0e925f0569552f7aeb54e5baad3f283255 Mon Sep 17 00:00:00 2001 From: Chris Hennes Date: Mon, 21 Jul 2025 22:02:15 -0500 Subject: [PATCH 01/11] Gui: Fix multiplication result converted to larger type --- src/Gui/DAGView/DAGModel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Gui/DAGView/DAGModel.cpp b/src/Gui/DAGView/DAGModel.cpp index f27aa085b0..5e6e0be0b5 100644 --- a/src/Gui/DAGView/DAGModel.cpp +++ b/src/Gui/DAGView/DAGModel.cpp @@ -647,12 +647,12 @@ void Model::updateSlot() auto rectangle = (*theGraph)[currentVertex].rectangle.get(); rectangle->setRect(-rowPadding, 0.0, rowPadding, rowHeight); //calculate actual length later. - rectangle->setTransform(QTransform::fromTranslate(0, rowHeight * currentRow)); + rectangle->setTransform(QTransform::fromTranslate(0, rowHeight * static_cast(currentRow))); rectangle->setBackgroundBrush(backgroundBrushes[currentRow % backgroundBrushes.size()]); auto point = (*theGraph)[currentVertex].point.get(); point->setRect(0.0, 0.0, pointSize, pointSize); - point->setTransform(QTransform::fromTranslate(pointSpacing * currentColumn, + point->setTransform(QTransform::fromTranslate(pointSpacing * static_cast(currentColumn), rowHeight * currentRow + rowHeight / 2.0 - pointSize / 2.0)); point->setBrush(currentBrush); From 764542078fa09868db310b0f735b4fce9d3cc3e1 Mon Sep 17 00:00:00 2001 From: Chris Hennes Date: Mon, 21 Jul 2025 22:03:14 -0500 Subject: [PATCH 02/11] CAM: Fix multiplication result converted to larger type --- src/Mod/CAM/PathSimulator/App/VolSim.cpp | 2 +- src/Mod/CAM/PathSimulator/AppGL/TextureLoader.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Mod/CAM/PathSimulator/App/VolSim.cpp b/src/Mod/CAM/PathSimulator/App/VolSim.cpp index 2a6164e8d9..7a70749b6c 100644 --- a/src/Mod/CAM/PathSimulator/App/VolSim.cpp +++ b/src/Mod/CAM/PathSimulator/App/VolSim.cpp @@ -748,7 +748,7 @@ cSimTool::cSimTool(const TopoDS_Shape& toolShape, float res) for (int x = 0; x < radValue; x++) { // find the face of the tool by checking z points across the // radius to see if the point is inside the shape - pnt.x = x * res; + pnt.x = static_cast(x) * res; bool inside = isInside(toolShape, pnt, res); // move down until the point is outside the shape diff --git a/src/Mod/CAM/PathSimulator/AppGL/TextureLoader.cpp b/src/Mod/CAM/PathSimulator/AppGL/TextureLoader.cpp index 03f2f080c7..4c6aa63c1e 100644 --- a/src/Mod/CAM/PathSimulator/AppGL/TextureLoader.cpp +++ b/src/Mod/CAM/PathSimulator/AppGL/TextureLoader.cpp @@ -55,7 +55,8 @@ TextureLoader::TextureLoader(std::string imgFolder, int textureSize) : mImageFolder(imgFolder) { - int buffsize = textureSize * textureSize * sizeof(unsigned int); + size_t buffsize = + static_cast(textureSize) * static_cast(textureSize) * sizeof(unsigned int); mRawData = (unsigned int*)malloc(buffsize); if (mRawData == nullptr) { return; From 2e28b2bd6365e326ffbb0036d87f04424d17d614 Mon Sep 17 00:00:00 2001 From: Chris Hennes Date: Mon, 21 Jul 2025 22:04:10 -0500 Subject: [PATCH 03/11] FEM: Fix multiplication result converted to larger type --- src/Mod/Fem/Gui/ViewProviderFemMesh.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Mod/Fem/Gui/ViewProviderFemMesh.cpp b/src/Mod/Fem/Gui/ViewProviderFemMesh.cpp index 47028d56cd..c75b653886 100644 --- a/src/Mod/Fem/Gui/ViewProviderFemMesh.cpp +++ b/src/Mod/Fem/Gui/ViewProviderFemMesh.cpp @@ -1552,7 +1552,8 @@ void ViewProviderFEMMeshBuilder::createMesh(const App::Property* prop, double Yln = BndBox.LengthY() / NbrY; double Zln = BndBox.LengthZ() / NbrZ; - std::vector Grid(NbrX * NbrY * NbrZ); + std::vector Grid(static_cast(NbrX) * static_cast(NbrY) + * static_cast(NbrZ)); unsigned int iX = 0; From bb9189c21c20a596ea04a6fe4ae55f8f3a6450ca Mon Sep 17 00:00:00 2001 From: Chris Hennes Date: Mon, 21 Jul 2025 22:04:43 -0500 Subject: [PATCH 04/11] Inspection: Fix multiplication result converted to larger type --- src/Mod/Inspection/App/InspectionFeature.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Mod/Inspection/App/InspectionFeature.cpp b/src/Mod/Inspection/App/InspectionFeature.cpp index 3b5aadcb13..c6b5594eb8 100644 --- a/src/Mod/Inspection/App/InspectionFeature.cpp +++ b/src/Mod/Inspection/App/InspectionFeature.cpp @@ -920,7 +920,7 @@ App::DocumentObjectExecReturn* Feature::execute() fMinDist = -std::numeric_limits::max(); } else { - res.m_sumsq += fMinDist * fMinDist; + res.m_sumsq += static_cast(fMinDist) * static_cast(fMinDist); res.m_numv++; } From c26202afc487cb1f99097dce66098b057d9b89c2 Mon Sep 17 00:00:00 2001 From: Chris Hennes Date: Mon, 21 Jul 2025 22:05:56 -0500 Subject: [PATCH 05/11] Mesh: Fix multiplication result converted to larger type --- src/Mod/Mesh/App/Core/Approximation.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Mod/Mesh/App/Core/Approximation.cpp b/src/Mod/Mesh/App/Core/Approximation.cpp index eb03190946..cd0d976df4 100644 --- a/src/Mod/Mesh/App/Core/Approximation.cpp +++ b/src/Mod/Mesh/App/Core/Approximation.cpp @@ -348,7 +348,7 @@ float PlaneFit::GetStdDeviation() const } fMean = (1.0F / ulPtCt) * fSumXi; - return sqrt((ulPtCt / (ulPtCt - 1.0F)) * ((1.0F / ulPtCt) * fSumXi2 - fMean * fMean)); + return sqrtf((ulPtCt / (ulPtCt - 1.0F)) * ((1.0F / ulPtCt) * fSumXi2 - fMean * fMean)); } float PlaneFit::GetSignedStdDeviation() const @@ -392,7 +392,8 @@ float PlaneFit::GetSignedStdDeviation() const fMean = 1.0F / ulPtCt * fSumXi; - return fFactor * sqrt((ulPtCt / (ulPtCt - 3.0F)) * ((1.0F / ulPtCt) * fSumXi2 - fMean * fMean)); + return fFactor + * sqrtf((ulPtCt / (ulPtCt - 3.0F)) * ((1.0F / ulPtCt) * fSumXi2 - fMean * fMean)); } void PlaneFit::ProjectToPlane() @@ -1314,7 +1315,7 @@ float CylinderFit::GetStdDeviation() const } fMean = (1.0F / ulPtCt) * fSumXi; - return sqrt((ulPtCt / (ulPtCt - 1.0F)) * ((1.0F / ulPtCt) * fSumXi2 - fMean * fMean)); + return sqrtf((ulPtCt / (ulPtCt - 1.0F)) * ((1.0F / ulPtCt) * fSumXi2 - fMean * fMean)); } void CylinderFit::GetBounding(Base::Vector3f& bottom, Base::Vector3f& top) const @@ -1485,7 +1486,7 @@ float SphereFit::GetStdDeviation() const } fMean = (1.0F / ulPtCt) * fSumXi; - return sqrt((ulPtCt / (ulPtCt - 1.0F)) * ((1.0F / ulPtCt) * fSumXi2 - fMean * fMean)); + return sqrtf((ulPtCt / (ulPtCt - 1.0F)) * ((1.0F / ulPtCt) * fSumXi2 - fMean * fMean)); } void SphereFit::ProjectToSphere() From eeb3d027c540d7d8fe2763fe725ce80fb5af4ff5 Mon Sep 17 00:00:00 2001 From: Chris Hennes Date: Mon, 21 Jul 2025 22:07:01 -0500 Subject: [PATCH 06/11] MeshPart: Fix multiplication result converted to larger type --- src/Mod/MeshPart/App/MeshFlattening.cpp | 3 ++- src/Mod/MeshPart/App/MeshFlatteningNurbs.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Mod/MeshPart/App/MeshFlattening.cpp b/src/Mod/MeshPart/App/MeshFlattening.cpp index f845b0a299..2834ad5df9 100644 --- a/src/Mod/MeshPart/App/MeshFlattening.cpp +++ b/src/Mod/MeshPart/App/MeshFlattening.cpp @@ -196,7 +196,8 @@ ColMat FaceUnwrapper::interpolateFlatFace(const TopoDS_Face& face) const TColStd_Array1OfReal& _vknots = _bspline->VKnotSequence(); Eigen::VectorXd weights; - weights.resize(_bspline->NbUPoles() * _bspline->NbVPoles()); + weights.resize(static_cast(_bspline->NbUPoles()) + * static_cast(_bspline->NbVPoles())); long i = 0; for (long u = 1; u <= _bspline->NbUPoles(); u++) { for (long v = 1; v <= _bspline->NbVPoles(); v++) { diff --git a/src/Mod/MeshPart/App/MeshFlatteningNurbs.cpp b/src/Mod/MeshPart/App/MeshFlatteningNurbs.cpp index 9af4f3e676..da252cb943 100644 --- a/src/Mod/MeshPart/App/MeshFlatteningNurbs.cpp +++ b/src/Mod/MeshPart/App/MeshFlatteningNurbs.cpp @@ -368,7 +368,7 @@ Eigen::Matrix NurbsBase2D::getUVMesh(int num_u_points double v_min = this->v_knots(0); double v_max = this->v_knots(this->v_knots.size() - 1); Eigen::Matrix uv_points; - uv_points.resize(num_u_points * num_v_points, 2); + uv_points.resize(static_cast(num_u_points) * static_cast(num_v_points), 2); int i = 0; for (int u = 0; u < num_u_points; u++) { From 5d84b6044ba3735879a7218e97773cf7cc37dc40 Mon Sep 17 00:00:00 2001 From: Chris Hennes Date: Mon, 21 Jul 2025 22:07:57 -0500 Subject: [PATCH 07/11] Part: Fix multiplication result converted to larger type --- src/Mod/Part/Gui/ViewProviderSpline.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Mod/Part/Gui/ViewProviderSpline.cpp b/src/Mod/Part/Gui/ViewProviderSpline.cpp index 362f745b2c..d35229ec1b 100644 --- a/src/Mod/Part/Gui/ViewProviderSpline.cpp +++ b/src/Mod/Part/Gui/ViewProviderSpline.cpp @@ -289,7 +289,8 @@ void ViewProviderSplineExtension::showControlPointsOfFace(const TopoDS_Face& fac return; // nothing to do SoCoordinate3 * coords = new SoCoordinate3; - coords->point.setNum(nCtU * nCtV + knots.size()); + coords->point.setNum((static_cast(nCtU) * static_cast(nCtV)) + + static_cast(knots.size())); int index=0; SbVec3f* verts = coords->point.startEditing(); From c6f5e5a262a412b10c0d64e0b0b30da55a911cb0 Mon Sep 17 00:00:00 2001 From: Chris Hennes Date: Mon, 21 Jul 2025 22:08:50 -0500 Subject: [PATCH 08/11] Reverse Engineering: Fix multiplication result converted to larger type --- src/Mod/ReverseEngineering/App/ApproxSurface.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Mod/ReverseEngineering/App/ApproxSurface.cpp b/src/Mod/ReverseEngineering/App/ApproxSurface.cpp index 1063d35e18..c9dbef0cc9 100644 --- a/src/Mod/ReverseEngineering/App/ApproxSurface.cpp +++ b/src/Mod/ReverseEngineering/App/ApproxSurface.cpp @@ -964,7 +964,9 @@ void BSplineParameterCorrection::DoParameterCorrection(int iIter) double fMaxDiff = 0.0, fMaxScalar = 1.0; double fWeight = _fSmoothInfluence; - Base::SequencerLauncher seq("Calc surface...", iIter * _pvcPoints->Length()); + Base::SequencerLauncher seq("Calc surface...", + static_cast(iIter) + * static_cast(_pvcPoints->Length())); do { fMaxScalar = 1.0; @@ -1273,8 +1275,10 @@ void BSplineParameterCorrection::CalcSmoothingTerms(bool bRecalc, { if (bRecalc) { Base::SequencerLauncher seq("Initializing...", - 3 * _usUCtrlpoints * _usUCtrlpoints * _usVCtrlpoints - * _usVCtrlpoints); + static_cast(3) * static_cast(_usUCtrlpoints) + * static_cast(_usUCtrlpoints) + * static_cast(_usVCtrlpoints) + * static_cast(_usVCtrlpoints)); CalcFirstSmoothMatrix(seq); CalcSecondSmoothMatrix(seq); CalcThirdSmoothMatrix(seq); From c1bc10f4d6410145e7ea3f6a9c237b63e53d036b Mon Sep 17 00:00:00 2001 From: Chris Hennes Date: Mon, 21 Jul 2025 22:09:23 -0500 Subject: [PATCH 09/11] Sketcher: Fix multiplication result converted to larger type --- src/Mod/Sketcher/Gui/EditModeGeometryCoinConverter.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Mod/Sketcher/Gui/EditModeGeometryCoinConverter.cpp b/src/Mod/Sketcher/Gui/EditModeGeometryCoinConverter.cpp index d1d827a362..b6daaab3c2 100644 --- a/src/Mod/Sketcher/Gui/EditModeGeometryCoinConverter.cpp +++ b/src/Mod/Sketcher/Gui/EditModeGeometryCoinConverter.cpp @@ -271,8 +271,8 @@ void EditModeGeometryCoinConverter::convert(const Sketcher::GeoListFacade& geoli // Coin Nodes Editing int vOrFactor = ViewProviderSketchCoinAttorney::getViewOrientationFactor(viewProvider); - double linez = vOrFactor * drawingParameters.zLowLines; // NOLINT - double pointz = vOrFactor * drawingParameters.zLowPoints; + double linez = vOrFactor * static_cast(drawingParameters.zLowLines); // NOLINT + double pointz = vOrFactor * static_cast(drawingParameters.zLowPoints); for (auto l = 0; l < geometryLayerParameters.getCoinLayerCount(); l++) { geometryLayerNodes.PointsCoordinate[l]->point.setNum(Points[l].size()); From 2aa659f2b3efbe8fefe1c33e5cc64bb5a375d97b Mon Sep 17 00:00:00 2001 From: Chris Hennes Date: Mon, 21 Jul 2025 22:09:51 -0500 Subject: [PATCH 10/11] TD: Fix multiplication result converted to larger type --- src/Mod/TechDraw/Gui/CommandCreateDims.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Mod/TechDraw/Gui/CommandCreateDims.cpp b/src/Mod/TechDraw/Gui/CommandCreateDims.cpp index f86bbe92cb..145a4e7f4c 100644 --- a/src/Mod/TechDraw/Gui/CommandCreateDims.cpp +++ b/src/Mod/TechDraw/Gui/CommandCreateDims.cpp @@ -384,7 +384,7 @@ public: if (Rez::guiX(pp.first().y) > scenePos.y()) dimDistance = -dimDistance; - double y = scenePos.y() + i * dimDistance; + double y = static_cast(scenePos.y()) + i * static_cast(dimDistance); scenePos = QPointF(curPos.x(), y); } else if(type == DimensionType::DistanceY) { @@ -392,7 +392,7 @@ public: if (Rez::guiX(pp.first().x) > scenePos.x()) dimDistance = -dimDistance; - double x = scenePos.x() + i * dimDistance; + double x = static_cast(scenePos.x()) + i * static_cast(dimDistance); scenePos = QPointF(x, curPos.y()); } } From 014286177403811298369bf81c511ddbcf9ec7e9 Mon Sep 17 00:00:00 2001 From: Chris Hennes Date: Thu, 24 Jul 2025 17:59:09 -0500 Subject: [PATCH 11/11] GUI: Switch DAGModel to use qreal instead of float --- src/Gui/DAGView/DAGModel.cpp | 28 ++++++++++++++-------------- src/Gui/DAGView/DAGModel.h | 22 +++++++++++----------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/Gui/DAGView/DAGModel.cpp b/src/Gui/DAGView/DAGModel.cpp index 5e6e0be0b5..4428d44d70 100644 --- a/src/Gui/DAGView/DAGModel.cpp +++ b/src/Gui/DAGView/DAGModel.cpp @@ -563,7 +563,7 @@ void Model::updateSlot() int currentRow = 0; int currentColumn = -1; //we know first column is going to be root so will be kicked up to 0. int maxColumn = currentColumn; //used for determining offset of icons and text. - float maxTextLength = 0; + qreal maxTextLength = 0; for (const auto ¤tVertex : sorted) { if (!(*theGraph)[currentVertex].dagVisible) @@ -647,7 +647,7 @@ void Model::updateSlot() auto rectangle = (*theGraph)[currentVertex].rectangle.get(); rectangle->setRect(-rowPadding, 0.0, rowPadding, rowHeight); //calculate actual length later. - rectangle->setTransform(QTransform::fromTranslate(0, rowHeight * static_cast(currentRow))); + rectangle->setTransform(QTransform::fromTranslate(0, rowHeight * currentRow)); rectangle->setBackgroundBrush(backgroundBrushes[currentRow % backgroundBrushes.size()]); auto point = (*theGraph)[currentVertex].point.get(); @@ -656,7 +656,7 @@ void Model::updateSlot() rowHeight * currentRow + rowHeight / 2.0 - pointSize / 2.0)); point->setBrush(currentBrush); - float cheat = 0.0; + qreal cheat = 0.0; if (direction == -1) cheat = rowHeight; @@ -672,7 +672,7 @@ void Model::updateSlot() auto text = (*theGraph)[currentVertex].text.get(); text->setPlainText(QString::fromUtf8(findRecord(currentVertex, *graphLink).DObject->Label.getValue())); text->setDefaultTextColor(currentBrush.color()); - maxTextLength = std::max(maxTextLength, static_cast(text->boundingRect().width())); + maxTextLength = std::max(maxTextLength, text->boundingRect().width()); text->setTransform(QTransform::fromTranslate (0.0, rowHeight * currentRow - verticalSpacing * 2.0 + cheat)); //calculate x location later. (*theGraph)[currentVertex].lastVisibleState = VisibilityState::None; //force visual update for color. @@ -683,8 +683,8 @@ void Model::updateSlot() //our list is topo sorted so all dependents should be located, so we can build the connectors. //will have some more logic for connector path, simple for now. - float currentX = pointSpacing * currentColumn + pointSize / 2.0; - float currentY = rowHeight * currentRow + rowHeight / 2.0; + qreal currentX = pointSpacing * currentColumn + pointSize / 2.0; + qreal currentY = rowHeight * currentRow + rowHeight / 2.0; OutEdgeIterator it, itEnd; boost::tie(it, itEnd) = boost::out_edges(currentVertex, *theGraph); for (; it != itEnd; ++it) @@ -692,9 +692,9 @@ void Model::updateSlot() Vertex target = boost::target(*it, *theGraph); if (!(*theGraph)[target].dagVisible) continue; //we don't make it here if source isn't visible. So don't have to worry about that. - float dependentX = pointSpacing * static_cast(columnFromMask((*theGraph)[target].column)) + pointSize / 2.0; //on center. + qreal dependentX = pointSpacing * static_cast(columnFromMask((*theGraph)[target].column)) + pointSize / 2.0; //on center. columnFromMask((*theGraph)[target].column); - float dependentY = rowHeight * (*theGraph)[target].row + rowHeight / 2.0; + qreal dependentY = rowHeight * (*theGraph)[target].row + rowHeight / 2.0; QGraphicsPathItem *pathItem = (*theGraph)[*it].connector.get(); pathItem->setBrush(Qt::NoBrush); @@ -705,17 +705,17 @@ void Model::updateSlot() else { //connector with bend. - float radius = pointSpacing / 1.9; //no zero length line. + qreal radius = pointSpacing / 1.9; //no zero length line. path.lineTo(currentX, dependentY + radius * direction); - float yPosition; + qreal yPosition; if (direction == -1.0) yPosition = dependentY - 2.0 * radius; else yPosition = dependentY; - float width = 2.0 * radius; - float height = width; + qreal width = 2.0 * radius; + qreal height = width; if (dependentX > currentX) //radius to the right. { QRectF arcRect(currentX, yPosition, width, height); @@ -735,10 +735,10 @@ void Model::updateSlot() } //now that we have the graph drawn we know where to place icons and text. - float columnSpacing = (maxColumn * pointSpacing); + qreal columnSpacing = (maxColumn * pointSpacing); for (const auto ¤tVertex : sorted) { - float localCurrentX = columnSpacing; + qreal localCurrentX = columnSpacing; localCurrentX += pointToIcon; auto visiblePixmap = (*theGraph)[currentVertex].visibleIcon.get(); QTransform visibleIconTransform = QTransform::fromTranslate(localCurrentX, 0.0); diff --git a/src/Gui/DAGView/DAGModel.h b/src/Gui/DAGView/DAGModel.h index 15079b939a..a7e743dcbf 100644 --- a/src/Gui/DAGView/DAGModel.h +++ b/src/Gui/DAGView/DAGModel.h @@ -118,17 +118,17 @@ namespace Gui //! @name View Constants for spacing //@{ - float fontHeight; //!< height of the current qApp default font. - float direction; //!< controls top to bottom or bottom to top direction. - float verticalSpacing; //!< pixels between top and bottom of text to background rectangle. - float rowHeight; //!< height of background rectangle. - float iconSize; //!< size of icon to match font. - float pointSize; //!< size of the connection point. - float pointSpacing; //!< spacing between pofloat columns. - float pointToIcon; //!< spacing from last column points to first icon. - float iconToIcon; //!< spacing between icons. - float iconToText; //!< spacing between last icon and text. - float rowPadding; //!< spaces added to rectangle background width ends. + qreal fontHeight; //!< height of the current qApp default font. + qreal direction; //!< controls top to bottom or bottom to top direction. + qreal verticalSpacing; //!< pixels between top and bottom of text to background rectangle. + qreal rowHeight; //!< height of background rectangle. + qreal iconSize; //!< size of icon to match font. + qreal pointSize; //!< size of the connection point. + qreal pointSpacing; //!< spacing between pofloat columns. + qreal pointToIcon; //!< spacing from last column points to first icon. + qreal iconToIcon; //!< spacing between icons. + qreal iconToText; //!< spacing between last icon and text. + qreal rowPadding; //!< spaces added to rectangle background width ends. std::vector backgroundBrushes; //!< brushes to paint background rectangles. std::vector forgroundBrushes; //!< brushes to paint points, connectors, text. void setupViewConstants();