[PATCH] winex11.drv: WORD and BYTE swapped in 555->1 bit converter (Coverity)

Marcus Meissner meissner at suse.de
Mon Oct 24 00:51:30 CDT 2011


Hi,

Coverity saw that the shifts and masks resulted in constants,
which was due the srcpixel being actually a WORD (instead of wrongly
a BYTE). dstpixel however is a BYTE, not a WORD.

CID 4841.

Ciao, Marcus
---
 dlls/winex11.drv/dib.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/dlls/winex11.drv/dib.c b/dlls/winex11.drv/dib.c
index a1ce9bb..b70dcfa 100644
--- a/dlls/winex11.drv/dib.c
+++ b/dlls/winex11.drv/dib.c
@@ -594,12 +594,13 @@ static void X11DRV_DIB_GetImageBits_1( int lines, BYTE *dstbits,
                 } else if (bmpImage->blue_mask==0x7c00) {
                     /* ==== bgr 555 bmp -> pal 1 dib ==== */
                     for (h=0; h<lines; h++) {
-                        WORD dstval;
+                        BYTE dstval;
                         srcpixel=srcbits;
                         dstbyte=dstbits;
                         dstval=0;
                         for (x=0; x<width; x++) {
-                            BYTE srcval;
+                            WORD srcval;
+
                             srcval=*srcpixel++;
                             dstval|=(X11DRV_DIB_GetNearestIndex
                                      (colors, 2,
-- 
1.7.1




More information about the wine-patches mailing list