diff options
author | Jan Holthuis <jan.holthuis@ruhr-uni-bochum.de> | 2020-11-17 20:02:14 +0100 |
---|---|---|
committer | Jan Holthuis <jan.holthuis@ruhr-uni-bochum.de> | 2020-11-19 19:46:54 +0100 |
commit | 4e1bebf0f5e06ecdd99c41771e7b4ee19c0cdcf3 (patch) | |
tree | d0e98cee9eef416282049092ea93b0b2b6eb417d /src/skin | |
parent | 133ea1e3d6547964f014144eee15590ea449c7af (diff) |
Pass non-trivial/large function args by reference
Fixes a bunch of `-Wclazy-function-args-by-ref` warnings. See
https://github.com/KDE/clazy/blob/master/docs/checks/README-function-args-by-ref.md
for details.
Most of these changes are automated, using the clazy fixit by setting
the `CLAZY_EXPORT_FIXES` before compilation and then running:
$ mkdir /tmp/patch
$ find ../src -iname "*.yaml" -exec mv {} /tmp/patch \;
$ clang-apply-replacements /tmp/patch
Diffstat (limited to 'src/skin')
-rw-r--r-- | src/skin/colorschemeparser.cpp | 10 | ||||
-rw-r--r-- | src/skin/colorschemeparser.h | 5 | ||||
-rw-r--r-- | src/skin/skincontext.h | 4 | ||||
-rw-r--r-- | src/skin/skinloader.cpp | 2 | ||||
-rw-r--r-- | src/skin/skinloader.h | 2 | ||||
-rw-r--r-- | src/skin/tooltips.cpp | 4 | ||||
-rw-r--r-- | src/skin/tooltips.h | 4 |
7 files changed, 16 insertions, 15 deletions
diff --git a/src/skin/colorschemeparser.cpp b/src/skin/colorschemeparser.cpp index c750e66f8b..ce0a221d00 100644 --- a/src/skin/colorschemeparser.cpp +++ b/src/skin/colorschemeparser.cpp @@ -13,10 +13,10 @@ #include "skin/legacyskinparser.h" #include "skin/skincontext.h" -void ColorSchemeParser::setupLegacyColorSchemes(QDomElement docElem, - UserSettingsPointer pConfig, - QString* pStyle, - SkinContext* pContext) { +void ColorSchemeParser::setupLegacyColorSchemes(const QDomElement& docElem, + UserSettingsPointer pConfig, + QString* pStyle, + SkinContext* pContext) { QDomNode schemesNode = docElem.namedItem("Schemes"); bool bSelectedColorSchemeFound = false; @@ -71,7 +71,7 @@ void ColorSchemeParser::setupLegacyColorSchemes(QDomElement docElem, } } -ImgSource* ColorSchemeParser::parseFilters(QDomNode filt) { +ImgSource* ColorSchemeParser::parseFilters(const QDomNode& filt) { ImgSource* ret = new ImgLoader(); if (!filt.hasChildNodes()) { diff --git a/src/skin/colorschemeparser.h b/src/skin/colorschemeparser.h index 61f63d188b..6decd79a92 100644 --- a/src/skin/colorschemeparser.h +++ b/src/skin/colorschemeparser.h @@ -10,12 +10,13 @@ class ImgSource; class ColorSchemeParser { public: static void setupLegacyColorSchemes( - QDomElement docElem, + const QDomElement& docElem, UserSettingsPointer pConfig, QString* pStyle, SkinContext* pContext); + private: - static ImgSource* parseFilters(QDomNode filter); + static ImgSource* parseFilters(const QDomNode& filter); ColorSchemeParser() { } ~ColorSchemeParser() { } }; diff --git a/src/skin/skincontext.h b/src/skin/skincontext.h index d89e7d9205..044878f3f4 100644 --- a/src/skin/skincontext.h +++ b/src/skin/skincontext.h @@ -239,11 +239,11 @@ class SkinContext { QDebug logWarning(const char* file, const int line, const QDomNode& node) const; - void defineSingleton(QString objectName, QWidget* widget) { + void defineSingleton(const QString& objectName, QWidget* widget) { return m_pSharedState->singletons.insertSingleton(objectName, widget); } - QWidget* getSingletonWidget(QString objectName) const { + QWidget* getSingletonWidget(const QString& objectName) const { return m_pSharedState->singletons.getSingletonWidget(objectName); } diff --git a/src/skin/skinloader.cpp b/src/skin/skinloader.cpp index abc5a45db0..2cd7e9f5fb 100644 --- a/src/skin/skinloader.cpp +++ b/src/skin/skinloader.cpp @@ -145,7 +145,7 @@ LaunchImage* SkinLoader::loadLaunchImage(QWidget* pParent) { return pLaunchImage; } -QString SkinLoader::pickResizableSkin(QString oldSkin) const { +QString SkinLoader::pickResizableSkin(const QString& oldSkin) const { if (oldSkin.contains("latenight", Qt::CaseInsensitive)) { return "LateNight"; } diff --git a/src/skin/skinloader.h b/src/skin/skinloader.h index 2892ce903c..9b3796508f 100644 --- a/src/skin/skinloader.h +++ b/src/skin/skinloader.h @@ -41,7 +41,7 @@ class SkinLoader { QList<QDir> getSkinSearchPaths() const; private: - QString pickResizableSkin(QString oldSkin) const; + QString pickResizableSkin(const QString& oldSkin) const; UserSettingsPointer m_pConfig; }; diff --git a/src/skin/tooltips.cpp b/src/skin/tooltips.cpp index bb4be75bdd..87cbd48918 100644 --- a/src/skin/tooltips.cpp +++ b/src/skin/tooltips.cpp @@ -7,7 +7,7 @@ Tooltips::Tooltips() { Tooltips::~Tooltips() { } -QString Tooltips::tooltipForId(QString id) const { +QString Tooltips::tooltipForId(const QString& id) const { // We always add a separator at the end. QString joined = m_tooltips.value(id, QStringList()).join(tooltipSeparator()); if (joined.length() > 0) { @@ -20,7 +20,7 @@ QString Tooltips::tooltipSeparator() const { return "\n"; } -QList<QString>& Tooltips::add(QString id) { +QList<QString>& Tooltips::add(const QString& id) { return m_tooltips[id]; } diff --git a/src/skin/tooltips.h b/src/skin/tooltips.h index fdbfbc8308..35b2fc05ec 100644 --- a/src/skin/tooltips.h +++ b/src/skin/tooltips.h @@ -10,12 +10,12 @@ class Tooltips : public QObject { public: Tooltips(); virtual ~Tooltips(); - QString tooltipForId(QString id) const; + QString tooltipForId(const QString& id) const; private: void addStandardTooltips(); QString tooltipSeparator() const; - QList<QString>& add(QString id); + QList<QString>& add(const QString& id); QHash<QString, QStringList> m_tooltips; }; |