From 97f9320bb3180927d48d4e4fc2b4c13a42f486f3 Mon Sep 17 00:00:00 2001 From: wmayer Date: Thu, 30 Jun 2022 16:31:16 +0200 Subject: [PATCH] Core: fix minor issues: + fix issues found by clang's clazy tool + fix cppcoreguidelines-pro-type-member-init * Make sure that all class members are initialized in the constructor --- src/App/PropertyUnits.cpp | 4 ++-- src/Base/Rotation.cpp | 13 +++++++++---- src/Gui/DocumentRecovery.cpp | 2 +- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/App/PropertyUnits.cpp b/src/App/PropertyUnits.cpp index 026222dd35..201cdbb331 100644 --- a/src/App/PropertyUnits.cpp +++ b/src/App/PropertyUnits.cpp @@ -193,14 +193,14 @@ void PropertyQuantityConstraint::setPyObject(PyObject *value) quant.setValue(temp); if (unit.isEmpty()){ - PropertyFloat::setValue(quant.getValue()); + PropertyFloat::setValue(quant.getValue()); // clazy:exclude=skipped-base-method return; } if (unit != _Unit) throw Base::UnitsMismatchError("Not matching Unit!"); - PropertyFloat::setValue(quant.getValue()); + PropertyFloat::setValue(quant.getValue()); // clazy:exclude=skipped-base-method } //************************************************************************** diff --git a/src/Base/Rotation.cpp b/src/Base/Rotation.cpp index 1d3f1d92fd..1326a7536a 100644 --- a/src/Base/Rotation.cpp +++ b/src/Base/Rotation.cpp @@ -33,15 +33,15 @@ using namespace Base; Rotation::Rotation() + : quat{0.0,0.0,0.0,1.0} + , _axis{0.0,0.0,1.0} + , _angle{0.0} { - quat[0]=quat[1]=quat[2]=0.0;quat[3]=1.0; - - _axis.Set(0.0, 0.0, 1.0); - _angle = 0.0; } /** Construct a rotation by rotation axis and angle */ Rotation::Rotation(const Vector3d& axis, const double fAngle) + : Rotation() { // set to (0,0,1) as fallback in case the passed axis is the null vector _axis.Set(0.0, 0.0, 1.0); @@ -49,6 +49,7 @@ Rotation::Rotation(const Vector3d& axis, const double fAngle) } Rotation::Rotation(const Matrix4D& matrix) + : Rotation() { this->setValue(matrix); } @@ -58,6 +59,7 @@ Rotation::Rotation(const Matrix4D& matrix) * where the quaternion is specified by q=w+xi+yj+zk. */ Rotation::Rotation(const double q[4]) + : Rotation() { this->setValue(q); } @@ -67,16 +69,19 @@ Rotation::Rotation(const double q[4]) * where the quaternion is specified by q=w+xi+yj+zk. */ Rotation::Rotation(const double q0, const double q1, const double q2, const double q3) + : Rotation() { this->setValue(q0, q1, q2, q3); } Rotation::Rotation(const Vector3d & rotateFrom, const Vector3d & rotateTo) + : Rotation() { this->setValue(rotateFrom, rotateTo); } Rotation::Rotation(const Rotation& rot) + : Rotation() { this->quat[0] = rot.quat[0]; this->quat[1] = rot.quat[1]; diff --git a/src/Gui/DocumentRecovery.cpp b/src/Gui/DocumentRecovery.cpp index 402f77776d..0305ddea48 100644 --- a/src/Gui/DocumentRecovery.cpp +++ b/src/Gui/DocumentRecovery.cpp @@ -157,7 +157,7 @@ public: QString label; QString fileName; QString tooltip; - Status status; + Status status = Unknown; }; Ui_DocumentRecovery ui; bool recovered;