winedos: Fix the type of res in VGA_DoSetMode.

It should be HRESULT instead of LRESULT.

Add explicit "!= S_OK" to expressions that use HRESULTs as booleans.
This commit is contained in:
Rob Shearman 2008-09-12 13:01:09 +01:00 committed by Alexandre Julliard
parent 89a3ad7626
commit c4179cf64e
1 changed files with 14 additions and 11 deletions

View File

@ -405,7 +405,7 @@ static void WINAPI VGA_DoExit(ULONG_PTR arg)
static void WINAPI VGA_DoSetMode(ULONG_PTR arg) static void WINAPI VGA_DoSetMode(ULONG_PTR arg)
{ {
LRESULT res; HRESULT res;
ModeSet *par = (ModeSet *)arg; ModeSet *par = (ModeSet *)arg;
par->ret=1; par->ret=1;
@ -422,7 +422,7 @@ static void WINAPI VGA_DoSetMode(ULONG_PTR arg)
} }
res = pDirectDrawCreate(NULL,&lpddraw,NULL); res = pDirectDrawCreate(NULL,&lpddraw,NULL);
if (!lpddraw) { if (!lpddraw) {
ERR("DirectDraw is not available (res = %lx)\n",res); ERR("DirectDraw is not available (res = 0x%x)\n",res);
return; return;
} }
if (!vga_hwnd) { if (!vga_hwnd) {
@ -439,33 +439,36 @@ static void WINAPI VGA_DoSetMode(ULONG_PTR arg)
else else
SetWindowPos(vga_hwnd,0,0,0,par->Xres,par->Yres,SWP_NOMOVE|SWP_NOZORDER); SetWindowPos(vga_hwnd,0,0,0,par->Xres,par->Yres,SWP_NOMOVE|SWP_NOZORDER);
if ((res=IDirectDraw_SetCooperativeLevel(lpddraw,vga_hwnd,DDSCL_FULLSCREEN|DDSCL_EXCLUSIVE))) { res=IDirectDraw_SetCooperativeLevel(lpddraw,vga_hwnd,DDSCL_FULLSCREEN|DDSCL_EXCLUSIVE);
ERR("Could not set cooperative level to exclusive (%lx)\n",res); if (res != S_OK) {
ERR("Could not set cooperative level to exclusive (0x%x)\n",res);
} }
if ((res=IDirectDraw_SetDisplayMode(lpddraw,par->Xres,par->Yres,par->Depth))) { res=IDirectDraw_SetDisplayMode(lpddraw,par->Xres,par->Yres,par->Depth);
ERR("DirectDraw does not support requested display mode (%dx%dx%d), res = %lx!\n",par->Xres,par->Yres,par->Depth,res); if (res != S_OK) {
ERR("DirectDraw does not support requested display mode (%dx%dx%d), res = 0x%x!\n",par->Xres,par->Yres,par->Depth,res);
IDirectDraw_Release(lpddraw); IDirectDraw_Release(lpddraw);
lpddraw=NULL; lpddraw=NULL;
return; return;
} }
res=IDirectDraw_CreatePalette(lpddraw,DDPCAPS_8BIT,NULL,&lpddpal,NULL); res=IDirectDraw_CreatePalette(lpddraw,DDPCAPS_8BIT,NULL,&lpddpal,NULL);
if (res) { if (res != S_OK) {
ERR("Could not create palette (res = %lx)\n",res); ERR("Could not create palette (res = 0x%x)\n",res);
IDirectDraw_Release(lpddraw); IDirectDraw_Release(lpddraw);
lpddraw=NULL; lpddraw=NULL;
return; return;
} }
if ((res=IDirectDrawPalette_SetEntries(lpddpal,0,0,256,vga_def_palette))) { if ((res=IDirectDrawPalette_SetEntries(lpddpal,0,0,256,vga_def_palette))) {
ERR("Could not set default palette entries (res = %lx)\n", res); ERR("Could not set default palette entries (res = 0x%x)\n", res);
} }
memset(&sdesc,0,sizeof(sdesc)); memset(&sdesc,0,sizeof(sdesc));
sdesc.dwSize=sizeof(sdesc); sdesc.dwSize=sizeof(sdesc);
sdesc.dwFlags = DDSD_CAPS; sdesc.dwFlags = DDSD_CAPS;
sdesc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; sdesc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
if (IDirectDraw_CreateSurface(lpddraw,&sdesc,&lpddsurf,NULL)||(!lpddsurf)) { res=IDirectDraw_CreateSurface(lpddraw,&sdesc,&lpddsurf,NULL);
if (res != S_OK || !lpddsurf) {
ERR("DirectDraw surface is not available\n"); ERR("DirectDraw surface is not available\n");
IDirectDraw_Release(lpddraw); IDirectDraw_Release(lpddraw);
lpddraw=NULL; lpddraw=NULL;
@ -600,7 +603,7 @@ static LPSTR VGA_Lock(unsigned*Pitch,unsigned*Height,unsigned*Width,unsigned*Dep
{ {
if (!lpddraw) return NULL; if (!lpddraw) return NULL;
if (!lpddsurf) return NULL; if (!lpddsurf) return NULL;
if (IDirectDrawSurface_Lock(lpddsurf,NULL,&sdesc,0,0)) { if (IDirectDrawSurface_Lock(lpddsurf,NULL,&sdesc,0,0) != S_OK) {
ERR("could not lock surface!\n"); ERR("could not lock surface!\n");
return NULL; return NULL;
} }