Marcus Meissner : d3dx9_36: Fixed memset of a -2 32bit value (Coverity).

Alexandre Julliard julliard at winehq.org
Mon Aug 22 13:29:03 CDT 2011


Module: wine
Branch: master
Commit: 9ac18eabb9f4adb1d9806ef76360bdb714219b6f
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=9ac18eabb9f4adb1d9806ef76360bdb714219b6f

Author: Marcus Meissner <marcus at jet.franken.de>
Date:   Sat Aug  6 13:13:28 2011 +0200

d3dx9_36: Fixed memset of a -2 32bit value (Coverity).

---

 dlls/d3dx9_36/tests/mesh.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/dlls/d3dx9_36/tests/mesh.c b/dlls/d3dx9_36/tests/mesh.c
index 39c78e6..a68e9c5 100644
--- a/dlls/d3dx9_36/tests/mesh.c
+++ b/dlls/d3dx9_36/tests/mesh.c
@@ -5384,7 +5384,7 @@ static void test_convert_adjacency_to_point_reps(void)
         }
 
         /* Convert adjacency to point representation */
-        memset(point_reps, -1, tc[i].num_vertices * sizeof(*point_reps));
+        for (j = 0; j < tc[i].num_vertices; j++) point_reps[j] = -1;
         hr = mesh->lpVtbl->ConvertAdjacencyToPointReps(mesh, tc[i].adjacency, point_reps);
         ok(hr == D3D_OK, "ConvertAdjacencyToPointReps failed case %d. "
            "Got %x expected D3D_OK\n", i, hr);
@@ -5921,7 +5921,8 @@ static void test_convert_point_reps_to_adjacency(void)
         }
 
         /* Convert point representation to adjacency*/
-        memset(adjacency, -2, VERTS_PER_FACE * tc[i].num_faces * sizeof(*adjacency));
+        for (j = 0; j < VERTS_PER_FACE * tc[i].num_faces; j++) adjacency[j] = -2;
+
         hr = mesh->lpVtbl->ConvertPointRepsToAdjacency(mesh, tc[i].point_reps, adjacency);
         ok(hr == D3D_OK, "ConvertPointRepsToAdjacency failed case %d. "
            "Got %x expected D3D_OK\n", i, hr);
@@ -5935,7 +5936,7 @@ static void test_convert_point_reps_to_adjacency(void)
         }
 
         /* NULL point representation is considered identity. */
-        memset(adjacency, -2, VERTS_PER_FACE * tc[i].num_faces * sizeof(*adjacency));
+        for (j = 0; j < VERTS_PER_FACE * tc[i].num_faces; j++) adjacency[j] = -2;
         hr = mesh_null_check->lpVtbl->ConvertPointRepsToAdjacency(mesh, NULL, adjacency);
         ok(hr == D3D_OK, "ConvertPointRepsToAdjacency NULL point_reps. "
                      "Got %x expected D3D_OK\n", hr);




More information about the wine-cvs mailing list