From 723ba16eb657b4369d3d67727ae271bec6d8bfad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20St=C3=B6neberg?= Date: Fri, 6 Oct 2023 09:57:16 +0200 Subject: [PATCH] fixed some "Parameter can be made pointer/reference to const" Rider warnings (#5516) --- gui/projectfile.cpp | 2 +- gui/projectfile.h | 2 +- gui/resultstree.cpp | 4 ++-- gui/resultstree.h | 4 ++-- gui/threadhandler.cpp | 2 +- gui/threadhandler.h | 2 +- gui/xmlreportv2.cpp | 2 +- gui/xmlreportv2.h | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/gui/projectfile.cpp b/gui/projectfile.cpp index 49f7157f8..a0bd18810 100644 --- a/gui/projectfile.cpp +++ b/gui/projectfile.cpp @@ -248,7 +248,7 @@ bool ProjectFile::read(const QString &filename) return projectTagFound; } -void ProjectFile::readRootPath(QXmlStreamReader &reader) +void ProjectFile::readRootPath(const QXmlStreamReader &reader) { QXmlStreamAttributes attribs = reader.attributes(); QString name = attribs.value(QString(), CppcheckXml::RootPathNameAttrib).toString(); diff --git a/gui/projectfile.h b/gui/projectfile.h index 50d87ea56..f9b366306 100644 --- a/gui/projectfile.h +++ b/gui/projectfile.h @@ -426,7 +426,7 @@ protected: * @brief Read optional root path from XML. * @param reader XML stream reader. */ - void readRootPath(QXmlStreamReader &reader); + void readRootPath(const QXmlStreamReader &reader); void readBuildDir(QXmlStreamReader &reader); diff --git a/gui/resultstree.cpp b/gui/resultstree.cpp index 3870fd64c..f0cfdab78 100644 --- a/gui/resultstree.cpp +++ b/gui/resultstree.cpp @@ -721,7 +721,7 @@ void ResultsTree::contextMenuEvent(QContextMenuEvent * e) } } -void ResultsTree::startApplication(QStandardItem *target, int application) +void ResultsTree::startApplication(const QStandardItem *target, int application) { //If there are no applications specified, tell the user about it if (mApplications->getApplicationCount() == 0) { @@ -1132,7 +1132,7 @@ void ResultsTree::quickStartApplication(const QModelIndex &index) startApplication(mModel.itemFromIndex(index)); } -QString ResultsTree::getFilePath(QStandardItem *target, bool fullPath) +QString ResultsTree::getFilePath(const QStandardItem *target, bool fullPath) { if (target) { // Make sure we are working with the first column diff --git a/gui/resultstree.h b/gui/resultstree.h index 8a8a79642..23f7053b3 100644 --- a/gui/resultstree.h +++ b/gui/resultstree.h @@ -344,7 +344,7 @@ protected: * @param application Index of the application to open with. Giving -1 * (default value) will open the default application. */ - void startApplication(QStandardItem *target, int application = -1); + void startApplication(const QStandardItem *target, int application = -1); /** * @brief Helper function returning the filename/full path of the error tree item \a target. @@ -352,7 +352,7 @@ protected: * @param target The error tree item containing the filename/full path * @param fullPath Whether or not to retrieve the full path or only the filename. */ - static QString getFilePath(QStandardItem *target, bool fullPath); + static QString getFilePath(const QStandardItem *target, bool fullPath); /** * @brief Context menu event (user right clicked on the tree) diff --git a/gui/threadhandler.cpp b/gui/threadhandler.cpp index 6e99afe04..b6fd53d25 100644 --- a/gui/threadhandler.cpp +++ b/gui/threadhandler.cpp @@ -194,7 +194,7 @@ void ThreadHandler::stop() } } -void ThreadHandler::initialize(ResultsView *view) +void ThreadHandler::initialize(const ResultsView *view) { connect(&mResults, &ThreadResult::progress, view, &ResultsView::progress); diff --git a/gui/threadhandler.h b/gui/threadhandler.h index cdf2a6f02..903999da5 100644 --- a/gui/threadhandler.h +++ b/gui/threadhandler.h @@ -64,7 +64,7 @@ public: * * @param view View to show error results */ - void initialize(ResultsView *view); + void initialize(const ResultsView *view); /** * @brief Load settings diff --git a/gui/xmlreportv2.cpp b/gui/xmlreportv2.cpp index e6b199398..152f3127e 100644 --- a/gui/xmlreportv2.cpp +++ b/gui/xmlreportv2.cpp @@ -196,7 +196,7 @@ QList XmlReportV2::read() return errors; } -ErrorItem XmlReportV2::readError(QXmlStreamReader *reader) +ErrorItem XmlReportV2::readError(const QXmlStreamReader *reader) { /* Error example from the core program in xml diff --git a/gui/xmlreportv2.h b/gui/xmlreportv2.h index e09e64692..d8ac04f77 100644 --- a/gui/xmlreportv2.h +++ b/gui/xmlreportv2.h @@ -79,7 +79,7 @@ protected: * @brief Read and parse error item from XML stream. * @param reader XML stream reader to use. */ - ErrorItem readError(QXmlStreamReader *reader); + ErrorItem readError(const QXmlStreamReader *reader); private: /**