From fa4d01ae128dd5605910bafda580e856239e36c6 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid <albert.astals.cid@kdab.com> Date: Fri, 4 Oct 2019 17:42:31 +0200 Subject: [PATCH] Small performance improvements suggested by clang-tidy * Add const & to function parameters * Add const & to variables assigned from functions returning const & Change-Id: Idc141bd48f37eae92a4d1775caade3c977a42391 Reviewed-by: VaL Doroshchuk <valentyn.doroshchuk@qt.io> --- src/gsttools/qgstutils.cpp | 2 +- src/plugins/alsa/qalsaaudiodeviceinfo.cpp | 2 +- src/plugins/alsa/qalsaaudiodeviceinfo.h | 2 +- src/plugins/gstreamer/mediacapture/qgstreameraudioencode.cpp | 4 ++-- src/plugins/gstreamer/mediacapture/qgstreamervideoencode.cpp | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/gsttools/qgstutils.cpp b/src/gsttools/qgstutils.cpp index ac8808115..f8a9d79c1 100644 --- a/src/gsttools/qgstutils.cpp +++ b/src/gsttools/qgstutils.cpp @@ -1309,7 +1309,7 @@ void QGstUtils::setMetaData(GstElement *element, const QMap<QByteArray, QVariant for (auto it = data.cbegin(), end = data.cend(); it != end; ++it) { const QString tagName = QString::fromLatin1(it.key()); - const QVariant tagValue = it.value(); + const QVariant &tagValue = it.value(); switch (tagValue.type()) { case QVariant::String: diff --git a/src/plugins/alsa/qalsaaudiodeviceinfo.cpp b/src/plugins/alsa/qalsaaudiodeviceinfo.cpp index 5e8edc3fc..474fd6bde 100644 --- a/src/plugins/alsa/qalsaaudiodeviceinfo.cpp +++ b/src/plugins/alsa/qalsaaudiodeviceinfo.cpp @@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE -QAlsaAudioDeviceInfo::QAlsaAudioDeviceInfo(QByteArray dev, QAudio::Mode mode) +QAlsaAudioDeviceInfo::QAlsaAudioDeviceInfo(const QByteArray &dev, QAudio::Mode mode) { handle = 0; diff --git a/src/plugins/alsa/qalsaaudiodeviceinfo.h b/src/plugins/alsa/qalsaaudiodeviceinfo.h index 21e30f49b..65675df54 100644 --- a/src/plugins/alsa/qalsaaudiodeviceinfo.h +++ b/src/plugins/alsa/qalsaaudiodeviceinfo.h @@ -74,7 +74,7 @@ class QAlsaAudioDeviceInfo : public QAbstractAudioDeviceInfo { Q_OBJECT public: - QAlsaAudioDeviceInfo(QByteArray dev,QAudio::Mode mode); + QAlsaAudioDeviceInfo(const QByteArray &dev,QAudio::Mode mode); ~QAlsaAudioDeviceInfo(); bool testSettings(const QAudioFormat& format) const; diff --git a/src/plugins/gstreamer/mediacapture/qgstreameraudioencode.cpp b/src/plugins/gstreamer/mediacapture/qgstreameraudioencode.cpp index 98aaded72..1a35c5cf6 100644 --- a/src/plugins/gstreamer/mediacapture/qgstreameraudioencode.cpp +++ b/src/plugins/gstreamer/mediacapture/qgstreameraudioencode.cpp @@ -205,8 +205,8 @@ GstElement *QGstreamerAudioEncode::createEncoder() QMap<QString, QVariant> options = m_options.value(codec); for (auto it = options.cbegin(), end = options.cend(); it != end; ++it) { - QString option = it.key(); - QVariant value = it.value(); + const QString &option = it.key(); + const QVariant &value = it.value(); switch (value.type()) { case QVariant::Int: diff --git a/src/plugins/gstreamer/mediacapture/qgstreamervideoencode.cpp b/src/plugins/gstreamer/mediacapture/qgstreamervideoencode.cpp index 4cc0e5f25..a2ed1d288 100644 --- a/src/plugins/gstreamer/mediacapture/qgstreamervideoencode.cpp +++ b/src/plugins/gstreamer/mediacapture/qgstreamervideoencode.cpp @@ -196,8 +196,8 @@ GstElement *QGstreamerVideoEncode::createEncoder() QMap<QString,QVariant> options = m_options.value(codec); for (auto it = options.cbegin(), end = options.cend(); it != end; ++it) { - QString option = it.key(); - QVariant value = it.value(); + const QString &option = it.key(); + const QVariant &value = it.value(); switch (value.type()) { case QVariant::Int: -- GitLab