summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2014-09-20 17:47:31 +0200
committerGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2014-09-22 18:57:12 +0200
commit8f622fef415cacb50f826268282a276502dcc607 (patch)
tree6e419b1baa8c832baef0c373349ae8e5148b95d7
parentfb8c7953026e12cf97150b5397bdfb9e32d1ca5b (diff)
Prevent a Coverity warning about a dangerous code path
Coverity warns that we may access the gray array without initializing it. The array is initialized if d (the source image depth) is 8. However, when doing ordered dithering, we don't check that depth any more and just use the array. There are instead checks in place for the other dither modes; the one for ordered has been commented out before public history. So, for the love of kittens, put the check back. Change-Id: I1cc5ced8edbb626777e54e9f4e58f152c6b28ddc Reviewed-by: Gunnar Sletta <gunnar@sletta.org> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
-rw-r--r--src/gui/image/qimage_conversions.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/gui/image/qimage_conversions.cpp b/src/gui/image/qimage_conversions.cpp
index f2f71b4bad..66fe9ec3a8 100644
--- a/src/gui/image/qimage_conversions.cpp
+++ b/src/gui/image/qimage_conversions.cpp
@@ -1047,8 +1047,7 @@ void dither_to_Mono(QImageData *dst, const QImageData *src,
dst_data += dst_bpl;
src_data += src_bpl;
}
- } else
- /* (d == 8) */ {
+ } else if (d == 8) {
for (int i=0; i<h; i++) {
const uchar *p = src_data;
const uchar *end = p + w;