[MOAB-dev] r2990 - MOAB/trunk

kraftche at cae.wisc.edu kraftche at cae.wisc.edu
Fri Jul 10 10:13:08 CDT 2009


Author: kraftche
Date: 2009-07-10 10:13:07 -0500 (Fri, 10 Jul 2009)
New Revision: 2990

Modified:
   MOAB/trunk/WriteHDF5.cpp
Log:
add a few asserts checking array bounds, the number of values in a list of ranges is a multiple of two, etc.

Modified: MOAB/trunk/WriteHDF5.cpp
===================================================================
--- MOAB/trunk/WriteHDF5.cpp	2009-07-10 15:11:56 UTC (rev 2989)
+++ MOAB/trunk/WriteHDF5.cpp	2009-07-10 15:13:07 UTC (rev 2990)
@@ -418,8 +418,7 @@
   }
   else
   {
-    std::vector<MBEntityHandle> passed_export_list(num_sets);
-    memcpy( &passed_export_list[0], set_array, sizeof(MBEntityHandle)*num_sets );
+    std::vector<MBEntityHandle> passed_export_list(set_array, set_array+num_sets);
     result = gather_mesh_info( passed_export_list );
     if (MB_SUCCESS != result) 
       return result;
@@ -554,6 +553,7 @@
 
       // Group entities by connectivity length
     bins.clear();
+    assert(dim >= 0 && dim <= 4);
     std::pair<MBRange::const_iterator,MBRange::const_iterator> p = ranges[dim].equal_range(type);
     MBRange::const_iterator i = p.first;
     while (i != p.second) {
@@ -922,8 +922,10 @@
         bool blocked_list;
         rval = range_to_blocked_list( set_contents, id_list, blocked_list );
         CHK_MB_ERR_2C(rval, set_table, writeSetContents, content_table, status);
-
-        assert (blocked_list && id_list.size() < (unsigned long)data_size);
+        
+        assert (blocked_list);
+        assert (id_list.size() < (unsigned long)data_size);
+        assert (id_list.size() % 2 == 0);
         flags |= mhdf_SET_RANGE_BIT;
         data_size = id_list.size();
         ++comp;
@@ -2343,6 +2345,7 @@
       
       if (blocked_list)
       {
+        assert (set_contents_ids % 2 == 0);
         contents_length_set = set_contents_ids.size();
         compressed_sets.insert( *iter );
       }



More information about the moab-dev mailing list