[MOAB-dev] r1308 - MOAB/trunk/tools/iMesh

kraftche at mcs.anl.gov kraftche at mcs.anl.gov
Wed Oct 10 14:31:47 CDT 2007


Author: kraftche
Date: 2007-10-10 14:31:47 -0500 (Wed, 10 Oct 2007)
New Revision: 1308

Modified:
   MOAB/trunk/tools/iMesh/iMesh_MOAB.cpp
Log:
fix valgrind issues

Modified: MOAB/trunk/tools/iMesh/iMesh_MOAB.cpp
===================================================================
--- MOAB/trunk/tools/iMesh/iMesh_MOAB.cpp	2007-10-10 16:32:10 UTC (rev 1307)
+++ MOAB/trunk/tools/iMesh/iMesh_MOAB.cpp	2007-10-10 19:31:47 UTC (rev 1308)
@@ -249,7 +249,7 @@
 
 void iMesh_dtor(iMesh_Instance instance, int *err) 
 {
-  delete dynamic_cast<MBiMesh*>(MBI);
+  delete MBI;
   RETURN(iBase_SUCCESS);
 }
    
@@ -286,17 +286,10 @@
                  int *err, const int name_len, int options_len) 
 {
     // get filename & attempt to NULL-terminate
-  char tmp_filename[1024];
-  strncpy(tmp_filename, name, name_len);
-  tmp_filename[1023] = '\0';
-  char *tmp_pos = strchr(tmp_filename, '.');
-  if (NULL != tmp_pos) {
-    tmp_pos = strchr(tmp_pos, ' ');
-    if (NULL != tmp_pos) *tmp_pos = '\0';
-  }
-  
-  MBErrorCode result = MBI->write_mesh(tmp_filename, CONST_HANDLE_ARRAY_PTR(&handle), 1);
+  std::string tmp_filename( name, name_len );
 
+  MBErrorCode result = MBI->write_mesh(tmp_filename.c_str(), CONST_HANDLE_ARRAY_PTR(&handle), 1);
+
   if (MB_SUCCESS != result) {
     std::string msg("iMesh_save:ERROR saving a mesh, with error type: ");
     msg += MBI->get_error_string(result);




More information about the moab-dev mailing list