[MOAB-dev] r3806 - MOAB/trunk/itaps/imesh

smithrm at mcs.anl.gov smithrm at mcs.anl.gov
Fri Apr 23 11:16:18 CDT 2010


Author: smithrm
Date: 2010-04-23 11:16:18 -0500 (Fri, 23 Apr 2010)
New Revision: 3806

Modified:
   MOAB/trunk/itaps/imesh/iMesh_MOAB.cpp
   MOAB/trunk/itaps/imesh/testc_cbind.c
Log:
Fixes for MOAB Trac Ticket #160:
o Added check of tag_values_size parameter in iMesh_setArrData.
o Fixed test that was passing wrong tag_values_size in vertex_int_tag_test.


Modified: MOAB/trunk/itaps/imesh/iMesh_MOAB.cpp
===================================================================
--- MOAB/trunk/itaps/imesh/iMesh_MOAB.cpp	2010-04-22 23:29:30 UTC (rev 3805)
+++ MOAB/trunk/itaps/imesh/iMesh_MOAB.cpp	2010-04-23 16:16:18 UTC (rev 3806)
@@ -1913,6 +1913,17 @@
       RETURN(iBase_SUCCESS);
     }
 
+    int tag_size;
+    iMesh_getTagSizeBytes(instance, tag_handle, &tag_size, err);
+    // Check err manually and just return if not iBase_SUCCESS to not step on
+    // the error set in iMesh_getTagSizeBytes().
+    if (iBase_SUCCESS != *err)
+      return;
+
+    if (tag_values_size != (tag_size * entity_handles_size)) {
+      ERROR(iBase_INVALID_ARGUMENT,"iMesh_setArrData: bad tag_values_size passed.");
+    }
+
     ErrorCode result = MBI->tag_set_data(TAG_HANDLE(tag_handle), 
                                            CONST_HANDLE_ARRAY_PTR(entity_handles),
                                            entity_handles_size,

Modified: MOAB/trunk/itaps/imesh/testc_cbind.c
===================================================================
--- MOAB/trunk/itaps/imesh/testc_cbind.c	2010-04-22 23:29:30 UTC (rev 3805)
+++ MOAB/trunk/itaps/imesh/testc_cbind.c	2010-04-23 16:16:18 UTC (rev 3806)
@@ -1320,7 +1320,7 @@
 
     /* put a value in the first vertex and retrieve */
   iMesh_setArrData(mesh, &dum_vert, 1, *int_tag, 
-                   (const char*)(&dum_val), sizeof(iBase_EntityHandle), &result);
+                   (const char*)(&dum_val), sizeof(int), &result);
   if (iBase_SUCCESS != result) {
     printf("Failed to set int tag (val=11) in vertex_int_tag_test.\n");
     return FALSE;

















More information about the moab-dev mailing list