dlls/wined3d/device.c simplification

Gerald Pfeifer gerald at pfeifer.com
Tue Jan 1 07:25:28 CST 2008


PaletteNumber is of type UINT here.  This patch simplifies three
conditions and avoid three compiler warnings with -Wtype-limits.

With this patch there are only two warnings left in this area in
my local tree. :-)

Gerald

ChangeLog:
Simplify three checks based on the unsignedness of variables.

Index: dlls/wined3d/device.c
===================================================================
RCS file: /home/wine/wine/dlls/wined3d/device.c,v
retrieving revision 1.739
diff -u -3 -p -r1.739 device.c
--- dlls/wined3d/device.c	21 Dec 2007 13:30:23 -0000	1.739
+++ dlls/wined3d/device.c	1 Jan 2008 13:20:13 -0000
@@ -5337,7 +5332,7 @@ static HRESULT  WINAPI  IWineD3DDeviceIm
     IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
     int j;
     TRACE("(%p) : PaletteNumber %u\n", This, PaletteNumber);
-    if ( PaletteNumber < 0 || PaletteNumber >= MAX_PALETTES) {
+    if (PaletteNumber >= MAX_PALETTES) {
         WARN("(%p) : (%u) Out of range 0-%u, returning Invalid Call\n", This, PaletteNumber, MAX_PALETTES);
         return WINED3DERR_INVALIDCALL;
     }
@@ -5355,7 +5350,7 @@ static HRESULT  WINAPI  IWineD3DDeviceIm
     IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
     int j;
     TRACE("(%p) : PaletteNumber %u\n", This, PaletteNumber);
-    if ( PaletteNumber < 0 || PaletteNumber >= MAX_PALETTES) {
+    if (PaletteNumber >= MAX_PALETTES) {
         WARN("(%p) : (%u) Out of range 0-%u, returning Invalid Call\n", This, PaletteNumber, MAX_PALETTES);
         return WINED3DERR_INVALIDCALL;
     }
@@ -5372,7 +5367,7 @@ static HRESULT  WINAPI  IWineD3DDeviceIm
 static HRESULT  WINAPI  IWineD3DDeviceImpl_SetCurrentTexturePalette(IWineD3DDevice *iface, UINT PaletteNumber) {
     IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
     TRACE("(%p) : PaletteNumber %u\n", This, PaletteNumber);
-    if ( PaletteNumber < 0 || PaletteNumber >= MAX_PALETTES) {
+    if (PaletteNumber >= MAX_PALETTES) {
         WARN("(%p) : (%u) Out of range 0-%u, returning Invalid Call\n", This, PaletteNumber, MAX_PALETTES);
         return WINED3DERR_INVALIDCALL;
     }



More information about the wine-patches mailing list