[MOAB-dev] r3100 - in MOAB/trunk: . test/perf tools/iMesh

kraftche at cae.wisc.edu kraftche at cae.wisc.edu
Mon Aug 10 16:08:12 CDT 2009


Author: kraftche
Date: 2009-08-10 16:08:12 -0500 (Mon, 10 Aug 2009)
New Revision: 3100

Modified:
   MOAB/trunk/OBBTest.cpp
   MOAB/trunk/test/perf/perf.cpp
   MOAB/trunk/tools/iMesh/testc_cbind.c
Log:
fix 'type-punned pointer' warnings

Modified: MOAB/trunk/OBBTest.cpp
===================================================================
--- MOAB/trunk/OBBTest.cpp	2009-08-10 19:25:59 UTC (rev 3099)
+++ MOAB/trunk/OBBTest.cpp	2009-08-10 21:08:12 UTC (rev 3100)
@@ -1237,14 +1237,14 @@
   const MBCartVect axis[3] = { box.scaled_axis(0),
                                box.scaled_axis(1),
                                box.scaled_axis(2) };
-  const MBCartVect* verts = reinterpret_cast<const MBCartVect*>(coords);
   double min[3], max[3];
-  MBCartVect v = verts[0] - box.center;
+  MBCartVect v = MBCartVect(coords) - box.center;
   min[0] = max[0] = box.scaled_axis(0) % v;
   min[1] = max[1] = box.scaled_axis(1) % v;
   min[2] = max[2] = box.scaled_axis(2) % v;
   for (i = 1; i < 21; ++i) {
-    MBCartVect v = verts[i] - box.center;
+    MBCartVect vi( coords + 3*i );
+    MBCartVect v = vi - box.center;
     for (int j = 0; j < 3; ++j) {
       double d = (axis[j] % v) / (axis[j] % axis[j]);
       if (d < min[j])

Modified: MOAB/trunk/test/perf/perf.cpp
===================================================================
--- MOAB/trunk/test/perf/perf.cpp	2009-08-10 19:25:59 UTC (rev 3099)
+++ MOAB/trunk/test/perf/perf.cpp	2009-08-10 21:08:12 UTC (rev 3100)
@@ -471,10 +471,11 @@
   int num_elems = nelem*nelem*nelem;
   MBEntityHandle vstart, estart;
 
-  MBReadUtilIface* readMeshIface;
   // get the read interface
-  gMB->query_interface("MBReadUtilIface", reinterpret_cast<void**>(&readMeshIface));
-
+  void* ptr = 0;
+  gMB->query_interface("MBReadUtilIface", &ptr);
+  MBReadUtilIface* readMeshIface = reinterpret_cast<MBReadUtilIface*>(ptr);
+  
   // create a sequence to hold the node coordinates
   // get the current number of entities and start at the next slot
   std::vector<double*> coord_arrays;

Modified: MOAB/trunk/tools/iMesh/testc_cbind.c
===================================================================
--- MOAB/trunk/tools/iMesh/testc_cbind.c	2009-08-10 19:25:59 UTC (rev 3099)
+++ MOAB/trunk/tools/iMesh/testc_cbind.c	2009-08-10 21:08:12 UTC (rev 3100)
@@ -1282,7 +1282,7 @@
   iBase_EntityHandle dum_vert = verts[0];
   
   int dum_val = 11, dum_val2;
-  void *dum_val2_ptr = &dum_val2;
+  char *dum_val2_ptr = (char*)&dum_val2;
   int dum_val2_alloc = sizeof(int), dum_val2_size;
 
     /* create a tag */
@@ -1304,7 +1304,7 @@
   }
 
   iMesh_getArrData(mesh, &dum_vert, 1, *int_tag,
-                   (char**)(&dum_val2_ptr), &dum_val2_alloc, &dum_val2_size, &result);
+                   &dum_val2_ptr, &dum_val2_alloc, &dum_val2_size, &result);
   if (iBase_SUCCESS != result || dum_val2 != 11) {
     printf("Failed to get int tag (val=11) in vertex_int_tag_test.\n");
     return FALSE;
@@ -1327,7 +1327,7 @@
   }
 
   iMesh_getArrData(mesh, &dum_vert, 1, *int_tag,
-                   (char**)(&dum_val2_ptr), &dum_val2_alloc, &dum_val2_size, &result);
+                   &dum_val2_ptr, &dum_val2_alloc, &dum_val2_size, &result);
   if (iBase_SUCCESS != result) {
     printf("Failed to get int tag (val=12) in vertex_int_tag_test.\n");
     return FALSE;
@@ -1351,7 +1351,7 @@
 
   iBase_EntityHandle dum_vert = verts[0];
   double dum_val = 1.0e6, dum_val2;
-  void *dum_val2_ptr = &dum_val2;
+  char *dum_val2_ptr = (char*)&dum_val2;
   int dum_val2_alloc = sizeof(double), dum_val2_size;
   
     /* create a tag */
@@ -1424,7 +1424,7 @@
   int result;
   iBase_EntityHandle dum_vert = verts[0];
   struct TagStruct dum_struct = {3.0e12, 2, 3}, dum_struct2;
-  void *dum_struct2_ptr = &dum_struct2;
+  char *dum_struct2_ptr = (char*)&dum_struct2;
   int dum_struct_alloc = sizeof(struct TagStruct), dum_struct_size;
 
     /* create a tag */
@@ -1448,7 +1448,7 @@
   }
 
   iMesh_getArrData(mesh, &dum_vert, 1, *struct_tag,
-                   (char**)(&dum_struct2_ptr), &dum_struct_alloc, &dum_struct_size, &result);
+                   &dum_struct2_ptr, &dum_struct_alloc, &dum_struct_size, &result);
   if (iBase_SUCCESS != result) {
     printf("Failed to get struct tag in vertex_struct_tag_test.\n");
     return FALSE;
@@ -1559,7 +1559,7 @@
 {
   int result;
   int dum_val = 11, dum_val2;
-  void *dum_val2_ptr = &dum_val2;
+  char *dum_val2_ptr = (char*)&dum_val2;
   int dum_val2_alloc = sizeof(int), dum_val2_size;
 
     /* create a tag */
@@ -1624,7 +1624,7 @@
 {
   int result;
   double dum_val = 1.0e6, dum_val2;
-  void *dum_val2_ptr = &dum_val2;
+  char *dum_val2_ptr = (char*)&dum_val2;
   int dum_val2_alloc = sizeof(double), dum_val2_size;
 
     /* create a tag */
@@ -1689,7 +1689,7 @@
 {
   int result;
   struct TagStruct dum_struct = {3.0e12, 2, 3}, dum_struct2;
-  void *dum_struct2_ptr = &dum_struct2;
+  char *dum_struct2_ptr = (char*)&dum_struct2;
   int dum_struct_alloc = sizeof(struct TagStruct), dum_struct_size;
 
     /* create a tag */
@@ -1712,7 +1712,7 @@
   }
 
   iMesh_getEntSetData(mesh, root_set, *struct_tag,
-                      (char**)(&dum_struct2_ptr), &dum_struct_alloc, &dum_struct_size, &result);
+                      &dum_struct2_ptr, &dum_struct_alloc, &dum_struct_size, &result);
   if (iBase_SUCCESS != result) {
     printf("Failed to get struct tag in entityset_struct_tag_test.\n");
     return FALSE;
@@ -1953,7 +1953,7 @@
 {
   int result;
   struct TagStruct dum_struct = {3.0e12, 2, 3}, dum_struct2;
-  void *dum_struct2_ptr = &dum_struct2;
+  char *dum_struct2_ptr = (char*)&dum_struct2;
   int dum_struct_alloc = sizeof(struct TagStruct), dum_struct_size;
 
     /* create a tag */
@@ -1976,7 +1976,7 @@
   }
 
   iMesh_getEntSetData(mesh, root_set, *struct_tag,
-                      (char**)(&dum_struct2_ptr), &dum_struct_alloc, &dum_struct_size, &result);
+                      &dum_struct2_ptr, &dum_struct_alloc, &dum_struct_size, &result);
   if (iBase_SUCCESS != result) {
     printf("Failed to get struct tag in mesh_struct_tag_test.\n");
     return FALSE;



More information about the moab-dev mailing list