Merge pull request #22660 from chennes/fixMultResultConvertedToLargerType

Fix mult result converted to larger type
This commit is contained in:
Kacper Donat
2025-07-25 10:20:03 +02:00
committed by GitHub
13 changed files with 52 additions and 43 deletions

View File

@@ -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 &currentVertex : sorted)
{
if (!(*theGraph)[currentVertex].dagVisible)
@@ -652,11 +652,11 @@ void Model::updateSlot()
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<qreal>(currentColumn),
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<float>(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<int>(columnFromMask((*theGraph)[target].column)) + pointSize / 2.0; //on center.
qreal dependentX = pointSpacing * static_cast<int>(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 &currentVertex : sorted)
{
float localCurrentX = columnSpacing;
qreal localCurrentX = columnSpacing;
localCurrentX += pointToIcon;
auto visiblePixmap = (*theGraph)[currentVertex].visibleIcon.get();
QTransform visibleIconTransform = QTransform::fromTranslate(localCurrentX, 0.0);

View File

@@ -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<QBrush> backgroundBrushes; //!< brushes to paint background rectangles.
std::vector<QBrush> forgroundBrushes; //!< brushes to paint points, connectors, text.
void setupViewConstants();

View File

@@ -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<double>(x) * res;
bool inside = isInside(toolShape, pnt, res);
// move down until the point is outside the shape

View File

@@ -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<size_t>(textureSize) * static_cast<size_t>(textureSize) * sizeof(unsigned int);
mRawData = (unsigned int*)malloc(buffsize);
if (mRawData == nullptr) {
return;

View File

@@ -1552,7 +1552,8 @@ void ViewProviderFEMMeshBuilder::createMesh(const App::Property* prop,
double Yln = BndBox.LengthY() / NbrY;
double Zln = BndBox.LengthZ() / NbrZ;
std::vector<FemFaceGridItem> Grid(NbrX * NbrY * NbrZ);
std::vector<FemFaceGridItem> Grid(static_cast<size_t>(NbrX) * static_cast<size_t>(NbrY)
* static_cast<size_t>(NbrZ));
unsigned int iX = 0;

View File

@@ -920,7 +920,7 @@ App::DocumentObjectExecReturn* Feature::execute()
fMinDist = -std::numeric_limits<float>::max();
}
else {
res.m_sumsq += fMinDist * fMinDist;
res.m_sumsq += static_cast<double>(fMinDist) * static_cast<double>(fMinDist);
res.m_numv++;
}

View File

@@ -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()

View File

@@ -196,7 +196,8 @@ ColMat<double, 3> 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<Eigen::Index>(_bspline->NbUPoles())
* static_cast<Eigen::Index>(_bspline->NbVPoles()));
long i = 0;
for (long u = 1; u <= _bspline->NbUPoles(); u++) {
for (long v = 1; v <= _bspline->NbVPoles(); v++) {

View File

@@ -368,7 +368,7 @@ Eigen::Matrix<double, Eigen::Dynamic, 2> 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<double, Eigen::Dynamic, 2> uv_points;
uv_points.resize(num_u_points * num_v_points, 2);
uv_points.resize(static_cast<Eigen::Index>(num_u_points) * static_cast<Eigen::Index>(num_v_points), 2);
int i = 0;
for (int u = 0; u < num_u_points; u++)
{

View File

@@ -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<float>(nCtU) * static_cast<float>(nCtV)) +
static_cast<float>(knots.size()));
int index=0;
SbVec3f* verts = coords->point.startEditing();

View File

@@ -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<size_t>(iIter)
* static_cast<size_t>(_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<size_t>(3) * static_cast<size_t>(_usUCtrlpoints)
* static_cast<size_t>(_usUCtrlpoints)
* static_cast<size_t>(_usVCtrlpoints)
* static_cast<size_t>(_usVCtrlpoints));
CalcFirstSmoothMatrix(seq);
CalcSecondSmoothMatrix(seq);
CalcThirdSmoothMatrix(seq);

View File

@@ -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<double>(drawingParameters.zLowLines); // NOLINT
double pointz = vOrFactor * static_cast<double>(drawingParameters.zLowPoints);
for (auto l = 0; l < geometryLayerParameters.getCoinLayerCount(); l++) {
geometryLayerNodes.PointsCoordinate[l]->point.setNum(Points[l].size());

View File

@@ -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<double>(scenePos.y()) + i * static_cast<double>(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<double>(scenePos.x()) + i * static_cast<double>(dimDistance);
scenePos = QPointF(x, curPos.y());
}
}