dlls/wined3d/basetexture.c

Gerald Pfeifer gerald at pfeifer.com
Sat Dec 29 02:32:43 CST 2007


Current snapshots of GCC 4.3 issue the following warning (with -Wextra,
for example)

  basetexture.c:437: warning: comparison of unsigned expression < 0 is always false
  basetexture.c:438: warning: comparison of unsigned expression < 0 is always false

Indeed WINED3DTEXF_NONE is 0 and thus the comparison is a noop.  I see
three ways to handle this:

 1. the straightforward patch below,
 2. adding an  #ifdef WINED3DTEXF_NONE > 0  around those two conditions, 
 3. living with the warning.

I'm not particularily fond of any of these three but would like to avoid 
the third one because this very compiler warning has already found us a 
quite a couple of bugs.  I'll be happy to provide a patch for the second
options or any other alternative you can think of.

Thoughts?

Gerald

ChangeLog:
Remove noop check in IWineD3DBaseTextureImpl_Appl().

Index: dlls/wined3d/basetexture.c
===================================================================
RCS file: /home/wine/wine/dlls/wined3d/basetexture.c,v
retrieving revision 1.49
diff -u -3 -p -r1.49 basetexture.c
--- dlls/wined3d/basetexture.c	29 Nov 2007 16:32:47 -0000	1.49
+++ dlls/wined3d/basetexture.c	29 Dec 2007 08:24:37 -0000
@@ -434,9 +434,7 @@ void WINAPI IWineD3DBaseTextureImpl_Appl
         This->baseTexture.states[WINED3DTEXSTA_MINFILTER] = samplerStates[WINED3DSAMP_MINFILTER];
         This->baseTexture.states[WINED3DTEXSTA_MAXMIPLEVEL] = samplerStates[WINED3DSAMP_MAXMIPLEVEL];
 
-        if (This->baseTexture.states[WINED3DTEXSTA_MINFILTER] < WINED3DTEXF_NONE ||
-            This->baseTexture.states[WINED3DTEXSTA_MIPFILTER] < WINED3DTEXF_NONE ||
-            This->baseTexture.states[WINED3DTEXSTA_MINFILTER] > WINED3DTEXF_ANISOTROPIC ||
+        if (This->baseTexture.states[WINED3DTEXSTA_MINFILTER] > WINED3DTEXF_ANISOTROPIC ||
             This->baseTexture.states[WINED3DTEXSTA_MIPFILTER] > WINED3DTEXF_LINEAR)
         {
 



More information about the wine-patches mailing list