From d7cd50b34731357a30421bbd8561d7fa2e576ded Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 14 Oct 2016 18:22:14 +0200 Subject: QDDSHandler: fix Coverity warning re:swapped arguments Coverity was clever enough to see that the arguments to qRgba() were swapped, but too dumb to understand the comment right above. Fix the warning by explicitly swapping b and r, and then passing the arguments in the correct order. Coverity-Id: 22421 Change-Id: I87f98ea2bc8745c85fda5dbf0b03a505866ed4ae Reviewed-by: Giuseppe D'Angelo --- src/plugins/imageformats/dds/qddshandler.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/plugins/imageformats/dds/qddshandler.cpp') diff --git a/src/plugins/imageformats/dds/qddshandler.cpp b/src/plugins/imageformats/dds/qddshandler.cpp index bfd18cd..81e967b 100644 --- a/src/plugins/imageformats/dds/qddshandler.cpp +++ b/src/plugins/imageformats/dds/qddshandler.cpp @@ -990,7 +990,8 @@ static QImage readA2W10V10U10(QDataStream &s, quint32 width, quint32 height) quint8 b = qint8((tmp & 0x000003ff) >> 0 >> 2) + 128; quint8 a = 0xff * ((tmp & 0xc0000000) >> 30) / 3; // dunno why we should swap b and r here - line[x] = qRgba(b, g, r, a); + std::swap(b, r); + line[x] = qRgba(r, g, b, a); } } -- cgit v1.2.3 From 7e7aa7a6591222a11a7268f6c73b724a7da1b880 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 15 Oct 2016 00:53:41 +0200 Subject: QWebpHandler/QDDSHandler: init all fields Coverity complained about uninitialised members of m_features in QWebpHandler, and m_header and m_header10 in QDDSHandler, so force value-initialization, in this case zero-initialization, by explicitly adding the fields to the ctor-init-list. Coverity-Id: 21998 Coverity-Id: 22032 Change-Id: Ie45023eda82b7034a0b3e33bab4fb23465cdc7cf Reviewed-by: Giuseppe D'Angelo --- src/plugins/imageformats/dds/qddshandler.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/plugins/imageformats/dds/qddshandler.cpp') diff --git a/src/plugins/imageformats/dds/qddshandler.cpp b/src/plugins/imageformats/dds/qddshandler.cpp index 81e967b..f146b95 100644 --- a/src/plugins/imageformats/dds/qddshandler.cpp +++ b/src/plugins/imageformats/dds/qddshandler.cpp @@ -1368,7 +1368,9 @@ static int formatByName(const QByteArray &name) } QDDSHandler::QDDSHandler() : + m_header(), m_format(FormatA8R8G8B8), + m_header10(), m_currentImage(0), m_scanState(ScanNotScanned) { -- cgit v1.2.3