wined3d: Fix a "ordered comparison of pointer with integer zero".

Michael Stefaniuc mstefani at redhat.de
Mon Dec 10 16:55:18 CST 2007


gcc -Wextra gives this warning.
Adding a negative number (loadBaseVertexIndex is < 0 in this code path
and stride is unsigned) to a pointer (unsigned "number") and comparing
the result to < 0 is odd at best.

I hope my fix is right.
---
 dlls/wined3d/drawprim.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c
index e70f025..5b3a2e5 100644
--- a/dlls/wined3d/drawprim.c
+++ b/dlls/wined3d/drawprim.c
@@ -197,7 +197,7 @@ void primitiveDeclarationConvertToStridedData(
                 WARN("loadBaseVertexIndex is < 0 (%d), not using vbos\n", This->stateBlock->loadBaseVertexIndex);
                 streamVBO = 0;
                 data = ((IWineD3DVertexBufferImpl *) This->stateBlock->streamSource[element->Stream])->resource.allocatedMemory;
-                if(data + This->stateBlock->loadBaseVertexIndex * stride < 0) {
+                if((UINT_PTR)data < -This->stateBlock->loadBaseVertexIndex * stride) {
                     FIXME("System memory vertex data load offset is negative!\n");
                 }
             }
-- 
1.5.3.7
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20071210/9ec4282b/attachment.pgp 


More information about the wine-patches mailing list