[education/rkward] rkward: Silence a few cppcheck warnings

Thomas Friedrichsmeier null at kde.org
Sun Apr 17 13:16:14 BST 2022


Git commit cbaed246d20472849ab001b15a801e71a56865b3 by Thomas Friedrichsmeier.
Committed on 17/04/2022 at 12:14.
Pushed by tfry into branch 'master'.

Silence a few cppcheck warnings

M  +2    -5    rkward/agents/rkprintagent.cpp
M  +2    -2    rkward/agents/rkprintagent.h
M  +6    -6    rkward/core/robject.h
M  +0    -1    rkward/dataeditor/rkvareditmodel.cpp
M  +1    -1    rkward/dataeditor/rkvareditmodel.h
M  +1    -0    rkward/misc/rkfindbar.cpp

https://invent.kde.org/education/rkward/commit/cbaed246d20472849ab001b15a801e71a56865b3

diff --git a/rkward/agents/rkprintagent.cpp b/rkward/agents/rkprintagent.cpp
index 9d760c3d..50cfa23d 100644
--- a/rkward/agents/rkprintagent.cpp
+++ b/rkward/agents/rkprintagent.cpp
@@ -22,7 +22,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
 
 #include "../debug.h"
 
-RKPrintAgent::RKPrintAgent () : QObject () {
+RKPrintAgent::RKPrintAgent(const QString &file, KParts::ReadOnlyPart *provider, bool delete_file) : QObject(), file(file), provider(provider), delete_file(delete_file) {
 	RK_TRACE (APP)
 }
 
@@ -71,10 +71,7 @@ void RKPrintAgent::printPostscript (const QString &file, bool delete_file) {
 		return;
 	}
 
-	RKPrintAgent *agent = new RKPrintAgent ();
-	agent->file = file;
-	agent->delete_file = delete_file;
-	agent->provider = provider;
+	RKPrintAgent *agent = new RKPrintAgent(file, provider, delete_file);
 
 	// very hacky heuristic to try to find out, whether the print action is synchronous or asynchronous. If the latter, delete after half an hour. If the former delete after printing.
 	QElapsedTimer ts;
diff --git a/rkward/agents/rkprintagent.h b/rkward/agents/rkprintagent.h
index 8f506965..b708ec57 100644
--- a/rkward/agents/rkprintagent.h
+++ b/rkward/agents/rkprintagent.h
@@ -20,8 +20,8 @@ public:
 	 *  @param delete_file : Try to delete the file after printing. Note: This is not guaranteed to work. */
 	static void printPostscript (const QString &file, bool delete_file=false);
 protected:
-	RKPrintAgent ();
-	~RKPrintAgent ();
+	RKPrintAgent(const QString &file, KParts::ReadOnlyPart *provider, bool delete_file);
+	~RKPrintAgent();
 
 	QString file;
 	KParts::ReadOnlyPart *provider;
diff --git a/rkward/core/robject.h b/rkward/core/robject.h
index be4d1fe5..37ba6554 100644
--- a/rkward/core/robject.h
+++ b/rkward/core/robject.h
@@ -57,12 +57,12 @@ public:
 		Character=3 << 14,
 		Logical=4 << 14,
 		DataTypeMask=Numeric | Factor | Character | Logical,
-		PseudoObject = 1 << 26, /** < The object is an internal representation, only, and does not exist in R. Currently, this is the case only for the slots-pseudo object */
-		Updating=1 << 27, /** < The object is about to be updated from R */
-		Incomplete=1 << 28,	/** < The information on this object is not complete (typically, it's children have not been scanned, yet). */
-		NonVisibleObject=1 << 29,	/** < the object is not listed in the object list. Currently, this is only the case for row.names()-objects */
-		NeedDataUpdate=1 << 30,	/** < the object's data should be (re-) fetched from R. The main purpose of this flag is to make sure the data is synced *after* the structure has been synced */
-		Pending=1 << 31		/** < the object is pending, i.e. it has been created in the object list, but we have not seen it in R, yet. This is used by data editors to create the illusion that a new object was added immediately, while in fact it takes some time to create it in the backend. */
+		PseudoObject = 1 << 25, /** < The object is an internal representation, only, and does not exist in R. Currently, this is the case only for the slots-pseudo object */
+		Updating=1 << 26, /** < The object is about to be updated from R */
+		Incomplete=1 << 27,	/** < The information on this object is not complete (typically, it's children have not been scanned, yet). */
+		NonVisibleObject=1 << 28,	/** < the object is not listed in the object list. Currently, this is only the case for row.names()-objects */
+		NeedDataUpdate=1 << 29,	/** < the object's data should be (re-) fetched from R. The main purpose of this flag is to make sure the data is synced *after* the structure has been synced */
+		Pending=1 << 30		/** < the object is pending, i.e. it has been created in the object list, but we have not seen it in R, yet. This is used by data editors to create the illusion that a new object was added immediately, while in fact it takes some time to create it in the backend. */
 	};
 
 	enum RDataType {
diff --git a/rkward/dataeditor/rkvareditmodel.cpp b/rkward/dataeditor/rkvareditmodel.cpp
index 52c83b76..ac0bfd28 100644
--- a/rkward/dataeditor/rkvareditmodel.cpp
+++ b/rkward/dataeditor/rkvareditmodel.cpp
@@ -25,7 +25,6 @@ RKVarEditModel::RKVarEditModel (QObject *parent) : RKVarEditModelBase (parent),
 
 	meta_model = 0;
 	trailing_rows = trailing_cols = 0;
-	var_col_offset = 0;
 	edit_blocks = 0;
 	rownames = 0;
 	header_locked = false;
diff --git a/rkward/dataeditor/rkvareditmodel.h b/rkward/dataeditor/rkvareditmodel.h
index 3e08d576..b525dbd2 100644
--- a/rkward/dataeditor/rkvareditmodel.h
+++ b/rkward/dataeditor/rkvareditmodel.h
@@ -25,7 +25,7 @@ class RKRowNames;
 @author Thomas Friedrichsmeier */
 class RKVarEditModelBase : public QAbstractTableModel {
 public:
-	explicit RKVarEditModelBase (QObject *parent) : QAbstractTableModel (parent) {};
+	explicit RKVarEditModelBase (QObject *parent) : QAbstractTableModel (parent), var_col_offset(0) {};
 	virtual ~RKVarEditModelBase () {};
 
 	virtual RKTextMatrix getTextMatrix (const QItemSelectionRange& range) const = 0;
diff --git a/rkward/misc/rkfindbar.cpp b/rkward/misc/rkfindbar.cpp
index 6d8ca527..d25c1edf 100644
--- a/rkward/misc/rkfindbar.cpp
+++ b/rkward/misc/rkfindbar.cpp
@@ -92,6 +92,7 @@ QCheckBox* RKFindBar::getOption (const RKFindBar::FindOptions option) {
 			action = new QCheckBox (i18n ("Highlight all matches"), this);
 		} else {
 			RK_ASSERT (false);
+			return nullptr;
 		}
 		connect (action, &QCheckBox::stateChanged, this, &RKFindBar::searchChanged);
 		default_actions.insert (option, action);


More information about the rkward-tracker mailing list