Possible issue in dlls/d3dx9_36/surface.c?

Gerald Pfeifer gerald at pfeifer.com
Sat Apr 2 16:54:26 CDT 2011


Matteo et al,

there is some code in dlls/d3dx9_36/surface.c which GCC struggles with
(in the sense of warning about it), and so do I, so I am wondering whether
you can have a look?

Specifically, in point_filter_simple_data we have:

       DWORD val = 0, pixel;

       /* extract source color components */
       if(srcformat->type == FORMAT_ARGB) {
           pixel = dword_from_bytes(srcptr, srcformat->bytes_per_pixel);
           get_relevant_argb_components(&conv_info, pixel, channels);
       }

So, pixel is uninitialized, except when we have FORMAT_ARGB.

However, directly below we then have

       /* recombine the components */
       if(destformat->type == FORMAT_ARGB) val = make_argb_color(&conv_info, channels);

       if(colorkey) {
           get_relevant_argb_components(&ck_conv_info, pixel, channels);

where pixel is passed to get_relevant_argb_components.  This is guarded
by colorkey, a parameter to this function, so indeed I can see pixel being
unused here.


(I'd naively propose a patch like the one below; this may not be 
sufficient though.)

Gerald


diff --git a/dlls/d3dx9_36/surface.c b/dlls/d3dx9_36/surface.c
index a3e6e68..cc36818 100644
--- a/dlls/d3dx9_36/surface.c
+++ b/dlls/d3dx9_36/surface.c
@@ -701,7 +701,7 @@ static void copy_simple_data(CONST BYTE *src, UINT srcpitch, POINT srcsize,
         DWORD val = 0;
 
         for(x = 0;x < minwidth;x++) {
-            DWORD pixel;
+            DWORD pixel = 0xFFFFFFFF;
 
             /* extract source color components */
             if(srcformat->type == FORMAT_ARGB) {
@@ -768,7 +768,7 @@ static void point_filter_simple_data(CONST BYTE *src, UINT srcpitch, POINT srcsi
 
         for(x = 0;x < destsize.x;x++) {
             const BYTE *srcptr = bufptr + (x * srcsize.x / destsize.x) * srcformat->bytes_per_pixel;
-            DWORD val = 0, pixel;
+            DWORD val = 0, pixel = 0xFFFFFFFF;
 
             /* extract source color components */
             if(srcformat->type == FORMAT_ARGB) {



More information about the wine-devel mailing list