From fdb219b68ecf0de3a79a339c21ca7064a93679eb Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 11 Mar 2024 10:12:47 +0100 Subject: [PATCH] Fix CodeChecker warnings Ensure move where it makes sense, and remove it where it doesnt Change-Id: I988d7ff44f1d7898a967130fa53ed6ec5690e778 Reviewed-by: Edward Welbourne --- src/gui/painting/qcolortrc_p.h | 11 +++++------ src/gui/painting/qicc.cpp | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/gui/painting/qcolortrc_p.h b/src/gui/painting/qcolortrc_p.h index f86d9e86218..d1ad1987dfe 100644 --- a/src/gui/painting/qcolortrc_p.h +++ b/src/gui/painting/qcolortrc_p.h @@ -25,12 +25,11 @@ QT_BEGIN_NAMESPACE class Q_GUI_EXPORT QColorTrc { public: - QColorTrc() noexcept : m_type(Type::Uninitialized) - { } - QColorTrc(const QColorTransferFunction &fun) : m_type(Type::Function), m_fun(fun) - { } - QColorTrc(const QColorTransferTable &table) : m_type(Type::Table), m_table(table) - { } + QColorTrc() noexcept : m_type(Type::Uninitialized) { } + QColorTrc(const QColorTransferFunction &fun) : m_type(Type::Function), m_fun(fun) { } + QColorTrc(const QColorTransferTable &table) : m_type(Type::Table), m_table(table) { } + QColorTrc(QColorTransferFunction &&fun) noexcept : m_type(Type::Function), m_fun(std::move(fun)) { } + QColorTrc(QColorTransferTable &&table) noexcept : m_type(Type::Table), m_table(std::move(table)) { } enum class Type { Uninitialized, diff --git a/src/gui/painting/qicc.cpp b/src/gui/painting/qicc.cpp index 48555702617..bd47efdfc0d 100644 --- a/src/gui/painting/qicc.cpp +++ b/src/gui/painting/qicc.cpp @@ -549,7 +549,7 @@ static quint32 parseTRC(const QByteArrayView &tagData, QColorTrc &gamma, QColorT static_assert(sizeof(GenericTagData) == 2 * sizeof(quint32_be), "GenericTagData has padding. The following code is a subject to UB."); qFromBigEndian(tagData.constData() + valueOffset, curv.valueCount, tabl.data()); - QColorTransferTable table = QColorTransferTable(curv.valueCount, std::move(tabl), type); + QColorTransferTable table(curv.valueCount, tabl, type); QColorTransferFunction curve; if (!table.checkValidity()) { qCWarning(lcIcc) << "Invalid curv table";