Re: Fix error checking in dlls/ddraw/executebuffer.c

2009-06-20 Thread Paul Vriens

Gerald Pfeifer wrote:

I believe, after looking at the ranges of D3DLIGHTSTATETYPE, that
the below is the actual intention of this code (to ensure we are
in range).

Gerald

ChangeLog:
Fix error checking in IDirect3DExecuteBufferImpl_Execute().

diff --git a/dlls/ddraw/executebuffer.c b/dlls/ddraw/executebuffer.c
index 73e0657..6d6d304 100644
--- a/dlls/ddraw/executebuffer.c
+++ b/dlls/ddraw/executebuffer.c
@@ -249,7 +249,7 @@ 
IDirect3DExecuteBufferImpl_Execute(IDirect3DExecuteBufferImpl *This,
 
 		TRACE((%08x,%08x)\n, ci-u1.dlstLightStateType, ci-u2.dwArg[0]);
 
-		if (!ci-u1.dlstLightStateType  (ci-u1.dlstLightStateType  D3DLIGHTSTATE_COLORVERTEX))

+   if (!ci-u1.dlstLightStateType || (ci-u1.dlstLightStateType 
 D3DLIGHTSTATE_COLORVERTEX))
ERR(Unexpected Light State Type\n);


Would:

if ((ci-u1.dlstLightStateType  D3DLIGHTSTATE_MATERIAL) || 
(ci-u1.dlstLightStateType  D3DLIGHTSTATE_COLORVERTEX))


be easier to read? (Matter of taste I guess).

--
Cheers,

Paul.




Re: Fix error checking in dlls/ddraw/executebuffer.c

2009-06-20 Thread Gerald Pfeifer
On Sat, 20 Jun 2009, Paul Vriens wrote:
  -   if (!ci-u1.dlstLightStateType  
 (ci-u1.dlstLightStateType  D3DLIGHTSTATE_COLORVERTEX))
 +if (!ci-u1.dlstLightStateType || 
 (ci-u1.dlstLightStateType  D3DLIGHTSTATE_COLORVERTEX))
 Would:
 
 if ((ci-u1.dlstLightStateType  D3DLIGHTSTATE_MATERIAL) ||
 (ci-u1.dlstLightStateType  D3DLIGHTSTATE_COLORVERTEX))
 
 be easier to read? (Matter of taste I guess).

I found the existing check (with the bug fixed ;-) easier to understand, 
but as you say it's a matter of taste and I do not feel strongly about it.

Gerald