[PATCH 1/5] d3dx9_36/tests: Avoid the non-portable NAN macro.

Henri Verbeet hverbeet at codeweavers.com
Tue Aug 3 03:13:30 CDT 2010


Just zeroing the arrays should be good enough for getting reliable results.
---
 dlls/d3dx9_36/tests/mesh.c |   17 ++---------------
 1 files changed, 2 insertions(+), 15 deletions(-)

diff --git a/dlls/d3dx9_36/tests/mesh.c b/dlls/d3dx9_36/tests/mesh.c
index bffcb2b..87003d1 100644
--- a/dlls/d3dx9_36/tests/mesh.c
+++ b/dlls/d3dx9_36/tests/mesh.c
@@ -68,16 +68,14 @@ static void free_mesh(struct mesh *mesh)
 
 static BOOL new_mesh(struct mesh *mesh, DWORD number_of_vertices, DWORD number_of_faces)
 {
-    int i;
-
-    mesh->vertices = HeapAlloc(GetProcessHeap(), 0, number_of_vertices * sizeof(*mesh->vertices));
+    mesh->vertices = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, number_of_vertices * sizeof(*mesh->vertices));
     if (!mesh->vertices)
     {
         return FALSE;
     }
     mesh->number_of_vertices = number_of_vertices;
 
-    mesh->faces = HeapAlloc(GetProcessHeap(), 0, number_of_faces * sizeof(*mesh->faces));
+    mesh->faces = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, number_of_faces * sizeof(*mesh->faces));
     if (!mesh->faces)
     {
         HeapFree(GetProcessHeap(), 0, mesh->vertices);
@@ -85,17 +83,6 @@ static BOOL new_mesh(struct mesh *mesh, DWORD number_of_vertices, DWORD number_o
     }
     mesh->number_of_faces = number_of_faces;
 
-    /* fill with nonsense data to make sure no comparison succeed by chance */
-    for (i = 0; i < number_of_vertices; i++)
-    {
-        mesh->vertices[i].position.x = NAN; mesh->vertices[i].position.y = NAN; mesh->vertices[i].position.z = NAN;
-        mesh->vertices[i].normal.x = NAN; mesh->vertices[i].normal.y = NAN; mesh->vertices[i].normal.z = NAN;
-    }
-    for (i = 0; i < number_of_faces; i++)
-    {
-        mesh->faces[i][0] = -1; mesh->faces[i][1] = -1; mesh->faces[i][2] = -1;
-    }
-
     return TRUE;
 }
 
-- 
1.7.1




More information about the wine-patches mailing list