Fix CodeChecker warnings

Ensure move where it makes sense, and remove it where it doesnt

Change-Id: I988d7ff44f1d7898a967130fa53ed6ec5690e778
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
Allan Sandfeld Jensen 2024-03-11 10:12:47 +01:00
parent 1c9e155b05
commit fdb219b68e
2 changed files with 6 additions and 7 deletions

View File

@ -25,12 +25,11 @@ QT_BEGIN_NAMESPACE
class Q_GUI_EXPORT QColorTrc class Q_GUI_EXPORT QColorTrc
{ {
public: public:
QColorTrc() noexcept : m_type(Type::Uninitialized) QColorTrc() noexcept : m_type(Type::Uninitialized) { }
{ } QColorTrc(const QColorTransferFunction &fun) : m_type(Type::Function), m_fun(fun) { }
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(const QColorTransferTable &table) : m_type(Type::Table), m_table(table) QColorTrc(QColorTransferTable &&table) noexcept : m_type(Type::Table), m_table(std::move(table)) { }
{ }
enum class Type { enum class Type {
Uninitialized, Uninitialized,

View File

@ -549,7 +549,7 @@ static quint32 parseTRC(const QByteArrayView &tagData, QColorTrc &gamma, QColorT
static_assert(sizeof(GenericTagData) == 2 * sizeof(quint32_be), static_assert(sizeof(GenericTagData) == 2 * sizeof(quint32_be),
"GenericTagData has padding. The following code is a subject to UB."); "GenericTagData has padding. The following code is a subject to UB.");
qFromBigEndian<quint16>(tagData.constData() + valueOffset, curv.valueCount, tabl.data()); qFromBigEndian<quint16>(tagData.constData() + valueOffset, curv.valueCount, tabl.data());
QColorTransferTable table = QColorTransferTable(curv.valueCount, std::move(tabl), type); QColorTransferTable table(curv.valueCount, tabl, type);
QColorTransferFunction curve; QColorTransferFunction curve;
if (!table.checkValidity()) { if (!table.checkValidity()) {
qCWarning(lcIcc) << "Invalid curv table"; qCWarning(lcIcc) << "Invalid curv table";