dlls/winex11.drv/dib.c: initialize two warnings (RESEND)

Gerald Pfeifer gerald at pfeifer.com
Sat Oct 31 19:11:09 CDT 2009


On Sat, 31 Oct 2009, Alexandre Julliard wrote:
> No, because the error case causes the caller function to return without
> using them. The idea was to reorder the code so that gcc can figure this
> out, as it does already in the other cases.

Got it!  Sorry for missing your good point initially, Alexandre,
and find a tested patch below. 

Gerald


ChangeLog:
Handle error situation earlier in X11DRV_GetDIBits().

diff --git a/dlls/winex11.drv/dib.c b/dlls/winex11.drv/dib.c
index 1fc8812..587c7c7 100644
--- a/dlls/winex11.drv/dib.c
+++ b/dlls/winex11.drv/dib.c
@@ -4096,6 +4096,11 @@ INT CDECL X11DRV_GetDIBits( X11DRV_PDEVICE *physDev, HBITMAP hbitmap, UINT start
   if (!(obj_size = GetObjectW( hbitmap, sizeof(dib), &dib ))) return 0;
 
   bitmap_type = DIB_GetBitmapInfo( (BITMAPINFOHEADER*)info, &width, &tempHeight, &descr.infoBpp, &descr.compression);
+  if (bitmap_type == -1)
+  {
+      ERR("Invalid bitmap\n");
+      return 0;
+  }
 
   if (physBitmap->pixmap_depth > 1)
   {
@@ -4107,11 +4112,6 @@ INT CDECL X11DRV_GetDIBits( X11DRV_PDEVICE *physDev, HBITMAP hbitmap, UINT start
     palette[1] = peWhite;
   }
 
-  if (bitmap_type == -1)
-  {
-      ERR("Invalid bitmap\n");
-      return 0;
-  }
   descr.lines = tempHeight;
   core_header = (bitmap_type == 0);
   colorPtr = (LPBYTE) info + (WORD) info->bmiHeader.biSize;



More information about the wine-patches mailing list