summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarc Mutz <[email protected]>2025-12-11 09:28:35 +0100
committerMarc Mutz <[email protected]>2025-12-12 01:57:48 +0100
commit928719d77982033f84ae73eb8eb37fcae5a77ad6 (patch)
treec20dbd889a1cb2e20818a0c41b45c1020a2a079e /src
parent1a1d22a7b56b6bcd604797e3a8ff30ea02d466ba (diff)
QEasingCurve: fix TCBPoint default constructor
As pointed out by ClangSA highlighing in QtCreator, but also by Coverity, the way the TCBPoint default constructor was written meant that _t, _c, and _b were left uninitialized even if the user value-initialized a TCBPoint object: TCBPoint p = {}; // ought to zero-initialize, but doesn't Fix by removing all the constructors. Being just a POD^Waggregate is more than sufficient for this type and aggregate initialization behaves predictably: TCBPoint p; // partially-formed (_t, _b, _c are uninitialized) TCBPoint p = {}; // well-formed, value-initialized: _t, _c, _b are 0.0 Amends b9f0bde16e85161666d5090952955bebacc40f89. Coverity-Id: 11609 Pick-to: 6.11 6.10 6.8 6.5 Change-Id: I301e5a7b68e86ddf967348b683f7a97fdc0b598d Reviewed-by: Edward Welbourne <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/tools/qeasingcurve.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/corelib/tools/qeasingcurve.cpp b/src/corelib/tools/qeasingcurve.cpp
index de68a0042ac..ce35e8ccffe 100644
--- a/src/corelib/tools/qeasingcurve.cpp
+++ b/src/corelib/tools/qeasingcurve.cpp
@@ -332,8 +332,6 @@ struct TCBPoint
qreal _c;
qreal _b;
- TCBPoint() {}
- TCBPoint(QPointF point, qreal t, qreal c, qreal b) : _point(point), _t(t), _c(c), _b(b) {}
bool operator==(const TCBPoint &other) const
{
@@ -1381,7 +1379,7 @@ void QEasingCurve::addTCBSegment(const QPointF &nextPoint, qreal t, qreal c, qre
if (!d_ptr->config)
d_ptr->config = curveToFunctionObject(d_ptr->type);
- d_ptr->config->_tcbPoints.append(TCBPoint(nextPoint, t, c, b));
+ d_ptr->config->_tcbPoints.append(TCBPoint{nextPoint, t, c, b});
if (nextPoint == QPointF(1.0, 1.0)) {
d_ptr->config->_bezierCurves = tcbToBezier(d_ptr->config->_tcbPoints);