From 7824d7b1df6e0c37cbfc3db43b2ee6b2a8eccbb4 Mon Sep 17 00:00:00 2001 From: wmayer Date: Tue, 2 Aug 2022 13:04:50 +0200 Subject: [PATCH] Base: fix several warnings reported by code analyzers --- src/Base/Console.cpp | 4 ++-- src/Base/Debugger.h | 9 +++++++-- src/Base/FutureWatcherProgress.h | 7 ++++++- src/Base/Interpreter.cpp | 20 ++++++++++---------- src/Base/Matrix.h | 8 +++++--- src/Base/Parameter.cpp | 8 ++++---- src/Base/Quantity.h | 2 +- src/Base/Unit.h | 2 +- src/Base/gzstream.h | 7 ++++--- 9 files changed, 40 insertions(+), 27 deletions(-) diff --git a/src/Base/Console.cpp b/src/Base/Console.cpp index 82a3c32188..2185877e99 100644 --- a/src/Base/Console.cpp +++ b/src/Base/Console.cpp @@ -446,7 +446,7 @@ ConsoleSingleton & ConsoleSingleton::Instance() //************************************************************************** // Python stuff -// ConsoleSingleton Methods // Methods structure +// ConsoleSingleton Methods structure PyMethodDef ConsoleSingleton::Methods[] = { {"PrintMessage", ConsoleSingleton::sPyMessage, METH_VARARGS, "PrintMessage(obj) -> None\n\n" @@ -479,7 +479,7 @@ PyMethodDef ConsoleSingleton::Methods[] = { {"GetObservers", ConsoleSingleton::sPyGetObservers, METH_VARARGS, "GetObservers() -> list of str\n\n" "Get the names of the current logging interfaces."}, - {nullptr, nullptr, 0, nullptr} /* Sentinel */ + {nullptr, nullptr, 0, nullptr} /* Sentinel */ }; namespace { diff --git a/src/Base/Debugger.h b/src/Base/Debugger.h index 9f4b27a17b..7f312be423 100644 --- a/src/Base/Debugger.h +++ b/src/Base/Debugger.h @@ -48,7 +48,7 @@ namespace Base { btn->setText("Continue"); btn->show(); Base::Debugger dbg; - connect(btn, SIGNAL(clicked()), &dbg, SLOT(quit())); + connect(btn, &QPushButton::clicked, &dbg, &Debugger::quit); dbg.exec(); \endcode \author Werner Mayer @@ -61,9 +61,14 @@ public: Debugger(QObject* parent=nullptr); ~Debugger() override; + Debugger(const Debugger&) = delete; + Debugger(Debugger&&) = delete; + Debugger& operator= (const Debugger&) = delete; + Debugger& operator= (Debugger&&) = delete; + void attach(); void detach(); - bool eventFilter(QObject*, QEvent*) override; + bool eventFilter(QObject* obj, QEvent* event) override; int exec(); public Q_SLOTS: diff --git a/src/Base/FutureWatcherProgress.h b/src/Base/FutureWatcherProgress.h index f2f802c23d..ad45a60530 100644 --- a/src/Base/FutureWatcherProgress.h +++ b/src/Base/FutureWatcherProgress.h @@ -39,8 +39,13 @@ public: FutureWatcherProgress(const char* text, unsigned int steps); ~FutureWatcherProgress() override; + FutureWatcherProgress(const FutureWatcherProgress&) = delete; + FutureWatcherProgress(FutureWatcherProgress&&) = delete; + FutureWatcherProgress& operator= (const FutureWatcherProgress&) = delete; + FutureWatcherProgress& operator= (FutureWatcherProgress&&) = delete; + private Q_SLOTS: - void progressValueChanged(int v); + void progressValueChanged(int value); private: Base::SequencerLauncher seq; diff --git a/src/Base/Interpreter.cpp b/src/Base/Interpreter.cpp index afe7601ad6..cfd600298a 100644 --- a/src/Base/Interpreter.cpp +++ b/src/Base/Interpreter.cpp @@ -686,11 +686,11 @@ int InterpreterSingleton::runCommandLine(const char *prompt) void InterpreterSingleton::runMethodVoid(PyObject *pobject, const char *method) { PyGILStateLocker locker; - if (PP_Run_Method(pobject , // object - method, // run method - nullptr, // no return type - nullptr, // so no return object - "()") // no arguments + if (PP_Run_Method(pobject , // object + method, // run method + nullptr, // no return type + nullptr, // so no return object + "()") // no arguments != 0) throw PyException(/*"Error running InterpreterSingleton::RunMethodVoid()"*/); @@ -701,11 +701,11 @@ PyObject* InterpreterSingleton::runMethodObject(PyObject *pobject, const char *m PyObject *pcO; PyGILStateLocker locker; - if (PP_Run_Method(pobject , // object - method, // run method - "O", // return type - &pcO, // return object - "()") // no arguments + if (PP_Run_Method(pobject , // object + method, // run method + "O", // return type + &pcO, // return object + "()") // no arguments != 0) throw PyException(); diff --git a/src/Base/Matrix.h b/src/Base/Matrix.h index 20adfbc200..3409720510 100644 --- a/src/Base/Matrix.h +++ b/src/Base/Matrix.h @@ -287,13 +287,15 @@ inline Matrix4D Matrix4D::operator * (const Matrix4D& rclMtrx) const Matrix4D clMat; unsigned short ie, iz, is; - for (iz = 0; iz < 4; iz++) + for (iz = 0; iz < 4; iz++) { for (is = 0; is < 4; is++) { clMat.dMtrx4D[iz][is] = 0; - for (ie = 0; ie < 4; ie++) - clMat.dMtrx4D[iz][is] += dMtrx4D[iz][ie] * + for (ie = 0; ie < 4; ie++) { + clMat.dMtrx4D[iz][is] += dMtrx4D[iz][ie] * rclMtrx.dMtrx4D[ie][is]; + } } + } return clMat; } diff --git a/src/Base/Parameter.cpp b/src/Base/Parameter.cpp index f62e2b13da..00a8defdeb 100644 --- a/src/Base/Parameter.cpp +++ b/src/Base/Parameter.cpp @@ -796,9 +796,9 @@ void ParameterGrp::RemoveBlob(const char* /*Name*/) DOMElement *pcElem = FindElement(_pGroupNode,"FCGrp",Name); // if not return if(!pcElem) - return; + return; else - _pGroupNode->removeChild(pcElem); + _pGroupNode->removeChild(pcElem); */ } @@ -1643,10 +1643,10 @@ short DOMPrintFilter::acceptNode(const DOMNode* node) const case DOMNode::ELEMENT_NODE: { // for element whose name is "person", skip it //if (XMLString::compareString(node->getNodeName(), element_person)==0) - // return DOMNodeFilter::FILTER_SKIP; + // return DOMNodeFilter::FILTER_SKIP; // for element whose name is "line", reject it //if (XMLString::compareString(node->getNodeName(), element_link)==0) - // return DOMNodeFilter::FILTER_REJECT; + // return DOMNodeFilter::FILTER_REJECT; // for rest, accept it return DOMNodeFilter::FILTER_ACCEPT; diff --git a/src/Base/Quantity.h b/src/Base/Quantity.h index e10dfb489d..4dbe9e7c3f 100644 --- a/src/Base/Quantity.h +++ b/src/Base/Quantity.h @@ -249,7 +249,7 @@ public: static Quantity MilliNewtonPerMeter; static Quantity KiloNewtonPerMeter; static Quantity MegaNewtonPerMeter; - + static Quantity Pascal; static Quantity KiloPascal; static Quantity MegaPascal; diff --git a/src/Base/Unit.h b/src/Base/Unit.h index de865ac651..50a51b8c32 100644 --- a/src/Base/Unit.h +++ b/src/Base/Unit.h @@ -131,7 +131,7 @@ public: static Unit YoungsModulus; static Unit Stiffness; - + static Unit Force; static Unit Work; static Unit Power; diff --git a/src/Base/gzstream.h b/src/Base/gzstream.h index eb2e75c19d..4f6222a54a 100644 --- a/src/Base/gzstream.h +++ b/src/Base/gzstream.h @@ -18,11 +18,11 @@ // ============================================================================ // // File : gzstream.h -// Revision : Revision: 1.5 +// Revision : Revision: 1.5 // Revision_date : Date: 2002/04/26 23:30:15 // Author(s) : Deepak Bandyopadhyay, Lutz Kettner -// -// Standard streambuf implementation following Nicolai Josuttis, "The +// +// Standard streambuf implementation following Nicolai Josuttis, "The // Standard C++ Library". // ============================================================================ @@ -31,6 +31,7 @@ #include #include +#include #ifdef _MSC_VER using std::ostream;