[MOAB-dev] r1765 - MOAB/trunk

kraftche at mcs.anl.gov kraftche at mcs.anl.gov
Tue Apr 15 08:59:33 CDT 2008


Author: kraftche
Date: 2008-04-15 08:59:33 -0500 (Tue, 15 Apr 2008)
New Revision: 1765

Modified:
   MOAB/trunk/MBBits.cpp
   MOAB/trunk/MBCore.cpp
   MOAB/trunk/MBMeshSet.cpp
   MOAB/trunk/MBReadUtil.cpp
   MOAB/trunk/MBSkinner.cpp
   MOAB/trunk/ReadGmsh.cpp
   MOAB/trunk/ReadHDF5.cpp
   MOAB/trunk/ReadNCDF.cpp
   MOAB/trunk/ReadSTL.cpp
   MOAB/trunk/ReadVtk.cpp
   MOAB/trunk/ReadVtk.hpp
   MOAB/trunk/Tqdcfr.cpp
   MOAB/trunk/WriteAns.cpp
   MOAB/trunk/WriteGmsh.cpp
   MOAB/trunk/WriteHDF5.cpp
   MOAB/trunk/WriteNCDF.cpp
   MOAB/trunk/WriteSLAC.cpp
   MOAB/trunk/WriteSTL.cpp
   MOAB/trunk/WriteTemplate.cpp
   MOAB/trunk/WriteVtk.cpp
Log:
fix warnings

Modified: MOAB/trunk/MBBits.cpp
===================================================================
--- MOAB/trunk/MBBits.cpp	2008-04-15 00:29:40 UTC (rev 1764)
+++ MOAB/trunk/MBBits.cpp	2008-04-15 13:59:33 UTC (rev 1765)
@@ -201,7 +201,7 @@
   MBErrorCode result = get_entities(tag_id, type, possibles);
   if (MB_SUCCESS != result || possibles.empty()) return result;
   MBErrorCode tmp_result;
-  unsigned char dum;
+  unsigned char dum = 0;
   for (MBRange::iterator it = possibles.begin(); it != possibles.end(); it++) {
     tmp_result = get_bits(tag_id, *it, dum);
     if (dum == bits) entities.insert(*it);
@@ -223,7 +223,7 @@
                         temp1.begin(), temp1.end(), mb_range_inserter(temp2));
   if (temp2.empty()) return result;
   
-  unsigned char dum;
+  unsigned char dum = 0;
   MBErrorCode tmp_result;
   for (MBRange::iterator it = temp2.begin(); it != temp2.end(); it++) {
     tmp_result = get_bits(tag_id, *it, dum);

Modified: MOAB/trunk/MBCore.cpp
===================================================================
--- MOAB/trunk/MBCore.cpp	2008-04-15 00:29:40 UTC (rev 1764)
+++ MOAB/trunk/MBCore.cpp	2008-04-15 13:59:33 UTC (rev 1765)
@@ -1813,11 +1813,10 @@
                                     MBRange &entity_handles ) 
 {
     // Create vertices
-  MBReadUtilIface *read_iface;
-  MBErrorCode result = 
-    this->query_interface("MBReadUtilIface", 
-                          reinterpret_cast<void**>(&read_iface));
+  void* tmp_ptr;
+  MBErrorCode result = this->query_interface("MBReadUtilIface", &tmp_ptr );
   if (MB_SUCCESS != result) return result;
+  MBReadUtilIface *read_iface = reinterpret_cast<MBReadUtilIface*>(tmp_ptr);
   
   std::vector<double*> arrays;
   MBEntityHandle start_handle_out = 0;
@@ -2766,24 +2765,27 @@
     result = this->tag_get_size(*vit, this_size);
     if (MB_SUCCESS != result || (int) sizeof(double) < this_size) continue;
       // use double since this is largest single-valued tag
-    double this_val;
-    result = this->tag_get_data(*vit, &ms_handle, 1, &this_val);
-    if (MB_SUCCESS != result) continue;
+    double dbl_val;
+    int int_val;
+    MBEntityHandle hdl_val;
     std::string tag_name;
     result = this->tag_get_name(*vit, tag_name);
     if (MB_SUCCESS != result) continue;
     switch (this_data_type) {
       case MB_TYPE_INTEGER:
-        std::cout << indent_prefix << tag_name << " = " 
-                  << *((int*)&this_val) << std::endl;
+        result = this->tag_get_data(*vit, &ms_handle, 1, &int_val);
+        if (MB_SUCCESS != result) continue;
+        std::cout << indent_prefix << tag_name << " = " << int_val << std::endl;
         break;
       case MB_TYPE_DOUBLE:
-        std::cout << indent_prefix << tag_name << " = " 
-                  << this_val << std::endl;
+        result = this->tag_get_data(*vit, &ms_handle, 1, &dbl_val);
+        if (MB_SUCCESS != result) continue;
+        std::cout << indent_prefix << tag_name << " = " << dbl_val << std::endl;
         break;
       case MB_TYPE_HANDLE:
-        std::cout << indent_prefix << tag_name << " = " 
-                  << *((MBEntityID*)&this_val) << std::endl;
+        result = this->tag_get_data(*vit, &ms_handle, 1, &hdl_val);
+        if (MB_SUCCESS != result) continue;
+        std::cout << indent_prefix << tag_name << " = " << hdl_val << std::endl;
         break;
       case MB_TYPE_BIT:
       case MB_TYPE_OPAQUE:

Modified: MOAB/trunk/MBMeshSet.cpp
===================================================================
--- MOAB/trunk/MBMeshSet.cpp	2008-04-15 00:29:40 UTC (rev 1764)
+++ MOAB/trunk/MBMeshSet.cpp	2008-04-15 13:59:33 UTC (rev 1765)
@@ -227,26 +227,26 @@
 
 int MBMeshSet::add_parent( MBEntityHandle parent )
 { 
-  int result;
+  int result = 0;
   mParentCount = insert_in_vector( (Count)mParentCount, parentMeshSets, parent, result );
   return result;
 }
 int MBMeshSet::add_child( MBEntityHandle child )
 { 
-  int result;
+  int result = 0;
   mChildCount = insert_in_vector( (Count)mChildCount, childMeshSets, child, result );
   return result;
 }
 
 int MBMeshSet::remove_parent( MBEntityHandle parent )
 { 
-  int result;
+  int result = 0;
   mParentCount = remove_from_vector( (Count)mParentCount, parentMeshSets, parent, result );
   return result;
 }
 int MBMeshSet::remove_child( MBEntityHandle child )
 { 
-  int result;
+  int result = 0;
   mChildCount = remove_from_vector( (Count)mChildCount, childMeshSets, child, result );
   return result;
 }

Modified: MOAB/trunk/MBReadUtil.cpp
===================================================================
--- MOAB/trunk/MBReadUtil.cpp	2008-04-15 00:29:40 UTC (rev 1764)
+++ MOAB/trunk/MBReadUtil.cpp	2008-04-15 13:59:33 UTC (rev 1765)
@@ -151,7 +151,7 @@
 
   if (seq->start_handle() > start_handle ||
       seq->end_handle() < start_handle ||
-      seq->end_handle() - start_handle + 1 < num_sets)
+      seq->end_handle() - start_handle + 1 < (MBEntityHandle)num_sets)
     return MB_FAILURE;
     
   return MB_SUCCESS;

Modified: MOAB/trunk/MBSkinner.cpp
===================================================================
--- MOAB/trunk/MBSkinner.cpp	2008-04-15 00:29:40 UTC (rev 1764)
+++ MOAB/trunk/MBSkinner.cpp	2008-04-15 13:59:33 UTC (rev 1765)
@@ -163,8 +163,7 @@
   {
     adj = new std::vector<MBEntityHandle>;
     adj->push_back(entity);
-    MBErrorCode result = thisMB->tag_set_data(mAdjTag, iter, 1, &adj);
-    assert(MB_SUCCESS == result);
+    thisMB->tag_set_data(mAdjTag, iter, 1, &adj);
   }
 }
 

Modified: MOAB/trunk/ReadGmsh.cpp
===================================================================
--- MOAB/trunk/ReadGmsh.cpp	2008-04-15 00:29:40 UTC (rev 1764)
+++ MOAB/trunk/ReadGmsh.cpp	2008-04-15 13:59:33 UTC (rev 1765)
@@ -40,13 +40,17 @@
 ReadGmsh::ReadGmsh(MBInterface* impl)
     : mdbImpl(impl)
 {
-  mdbImpl->query_interface("MBReadUtilIface", reinterpret_cast<void**>(&readMeshIface));
+  void* ptr = 0;
+  mdbImpl->query_interface("MBReadUtilIface", &ptr);
+  readMeshIface = reinterpret_cast<MBReadUtilIface*>(ptr);
 }
 
 ReadGmsh::~ReadGmsh()
 {
-  if (readMeshIface)
-   mdbImpl->release_interface("MBReadUtilIface", reinterpret_cast<void**>(&readMeshIface));
+  if (readMeshIface) {
+    mdbImpl->release_interface("MBReadUtilIface", readMeshIface);
+    readMeshIface = 0;
+  }
 }
 
 // Type info indexed by type id used in file format.

Modified: MOAB/trunk/ReadHDF5.cpp
===================================================================
--- MOAB/trunk/ReadHDF5.cpp	2008-04-15 00:29:40 UTC (rev 1764)
+++ MOAB/trunk/ReadHDF5.cpp	2008-04-15 13:59:33 UTC (rev 1765)
@@ -81,12 +81,14 @@
     return MB_FAILURE;
   }
   
-  rval = iFace->query_interface( "MBReadUtilIface", (void**)&readUtil );
+  void* ptr = 0;
+  rval = iFace->query_interface( "MBReadUtilIface", &ptr );
   if (MB_SUCCESS != rval)
   {
     H5Tclose( handleType );
     return rval;
   }
+  readUtil = reinterpret_cast<MBReadUtilIface*>(ptr);
   
   setSet.first_id = 0;
   setSet.type2 = mhdf_set_type_handle();

Modified: MOAB/trunk/ReadNCDF.cpp
===================================================================
--- MOAB/trunk/ReadNCDF.cpp	2008-04-15 00:29:40 UTC (rev 1764)
+++ MOAB/trunk/ReadNCDF.cpp	2008-04-15 13:59:33 UTC (rev 1765)
@@ -66,8 +66,10 @@
 {
   assert(impl != NULL);
   reset();
-  std::string iface_name = "MBReadUtilIface";
-  impl->query_interface(iface_name, reinterpret_cast<void**>(&readMeshIface));
+  
+  void* ptr = 0;
+  impl->query_interface( "MBReadUtilIface", &ptr );
+  readMeshIface = reinterpret_cast<MBReadUtilIface*>(ptr);
 
   // initialize in case tag_get_handle fails below
   mMaterialSetTag  = 0;

Modified: MOAB/trunk/ReadSTL.cpp
===================================================================
--- MOAB/trunk/ReadSTL.cpp	2008-04-15 00:29:40 UTC (rev 1764)
+++ MOAB/trunk/ReadSTL.cpp	2008-04-15 13:59:33 UTC (rev 1765)
@@ -55,13 +55,17 @@
 ReadSTL::ReadSTL(MBInterface* impl)
     : mdbImpl(impl)
 {
-  mdbImpl->query_interface("MBReadUtilIface", reinterpret_cast<void**>(&readMeshIface));
+  void* ptr = 0;
+  mdbImpl->query_interface("MBReadUtilIface", &ptr);
+  readMeshIface = reinterpret_cast<MBReadUtilIface*>(ptr);
 }
 
 ReadSTL::~ReadSTL()
 {
-  if (readMeshIface)
-   mdbImpl->release_interface("MBReadUtilIface", reinterpret_cast<void**>(&readMeshIface));
+  if (readMeshIface) {
+    mdbImpl->release_interface("MBReadUtilIface", readMeshIface);
+    readMeshIface = 0;
+  }
 }
 
 // Used to put points in an STL tree-based container

Modified: MOAB/trunk/ReadVtk.cpp
===================================================================
--- MOAB/trunk/ReadVtk.cpp	2008-04-15 00:29:40 UTC (rev 1764)
+++ MOAB/trunk/ReadVtk.cpp	2008-04-15 13:59:33 UTC (rev 1765)
@@ -36,9 +36,19 @@
 ReadVtk::ReadVtk(MBInterface* impl)
     : mdbImpl(impl)
 {
-  impl->query_interface("MBReadUtilIface", reinterpret_cast<void**>(&readMeshIface));
+  void* ptr = 0;
+  mdbImpl->query_interface("MBReadUtilIface", &ptr);
+  readMeshIface = reinterpret_cast<MBReadUtilIface*>(ptr);
 }
 
+ReadVtk::~ReadVtk()
+{
+  if (readMeshIface) {
+    mdbImpl->release_interface("MBReadUtilIface", readMeshIface);
+    readMeshIface = 0;
+  }
+}
+
 const char* const vtk_type_names[] = { "bit",
                                        "char",
                                        "unsigned_char",

Modified: MOAB/trunk/ReadVtk.hpp
===================================================================
--- MOAB/trunk/ReadVtk.hpp	2008-04-15 00:29:40 UTC (rev 1764)
+++ MOAB/trunk/ReadVtk.hpp	2008-04-15 13:59:33 UTC (rev 1765)
@@ -40,7 +40,7 @@
   ReadVtk(MBInterface* impl = NULL);
 
    //! Destructor
-  virtual ~ReadVtk() {}
+  virtual ~ReadVtk();
 
 protected:
 

Modified: MOAB/trunk/Tqdcfr.cpp
===================================================================
--- MOAB/trunk/Tqdcfr.cpp	2008-04-15 00:29:40 UTC (rev 1764)
+++ MOAB/trunk/Tqdcfr.cpp	2008-04-15 13:59:33 UTC (rev 1765)
@@ -154,9 +154,10 @@
 {
   assert(NULL != impl);
   mdbImpl = impl;
-  std::string iface_name = "MBReadUtilIface";
-  impl->query_interface(iface_name, reinterpret_cast<void**>(&readUtilIface));
-  assert(NULL != readUtilIface);
+  void* ptr = 0;
+  impl->query_interface( "MBReadUtilIface", &ptr );
+  assert(NULL != ptr);
+  readUtilIface = reinterpret_cast<MBReadUtilIface*>(ptr);
 
   currVHandleOffset = -1;
   for (MBEntityType this_type = MBVERTEX; this_type < MBMAXTYPE; this_type++)
@@ -1100,10 +1101,12 @@
 
   for (std::vector<unsigned int>::iterator vit = md_entry->mdIntArrayValue.begin();
        vit != md_entry->mdIntArrayValue.end(); vit++) {
+#ifndef NDEBUG
     MBEntityHandle fixed_v = (cubMOABVertexMap ? 
                               (*cubMOABVertexMap)[*vit] : 
                               (MBEntityHandle) currVHandleOffset+*vit);
     assert(fixed_v >= *dum_range.begin() && fixed_v <= *dum_range.rbegin());
+#endif
     fixed_flags[*vit - *dum_range.begin()] = 1;
   }
 
@@ -1178,7 +1181,7 @@
     FREADI(total_conn);
 
       // post-process connectivity into handles
-    MBEntityHandle new_handle, dum_handle;
+    MBEntityHandle new_handle;
     for (unsigned int j = 0; j < total_conn; j++) {
       if (NULL == cubMOABVertexMap)
         new_handle = (MBEntityHandle) currVHandleOffset+uint_buf[j];
@@ -1191,9 +1194,12 @@
                0 != (*cubMOABVertexMap)[uint_buf[j]]);
         new_handle = (*cubMOABVertexMap)[uint_buf[j]];
       }
+#ifndef NDEBUG
+      MBEntityHandle dum_handle;
       assert(MB_SUCCESS == 
              mdbImpl->handle_from_id(MBVERTEX, mdbImpl->id_from_handle(new_handle), 
                                      dum_handle));
+#endif
       conn[j] = new_handle;
     }
 

Modified: MOAB/trunk/WriteAns.cpp
===================================================================
--- MOAB/trunk/WriteAns.cpp	2008-04-15 00:29:40 UTC (rev 1764)
+++ MOAB/trunk/WriteAns.cpp	2008-04-15 13:59:33 UTC (rev 1765)
@@ -54,8 +54,9 @@
 {
   assert(impl != NULL);
 
-  std::string iface_name = "MBWriteUtilIface";
-  impl->query_interface(iface_name, reinterpret_cast<void**>(&mWriteIface));
+  void* ptr = 0;
+  impl->query_interface( "MBWriteUtilIface", &ptr );
+  mWriteIface = reinterpret_cast<MBWriteUtilIface*>(ptr);
 
     // initialize in case tag_get_handle fails below
   //! get and cache predefined tag handles

Modified: MOAB/trunk/WriteGmsh.cpp
===================================================================
--- MOAB/trunk/WriteGmsh.cpp	2008-04-15 00:29:40 UTC (rev 1764)
+++ MOAB/trunk/WriteGmsh.cpp	2008-04-15 13:59:33 UTC (rev 1765)
@@ -19,7 +19,9 @@
 WriteGmsh::WriteGmsh(MBInterface *impl) 
     : mbImpl(impl)
 {
-  impl->query_interface("MBWriteUtilIface", reinterpret_cast<void**>(&mWriteIface));
+  void* ptr = 0;
+  impl->query_interface("MBWriteUtilIface", &ptr);
+  mWriteIface = reinterpret_cast<MBWriteUtilIface*>(ptr);
 }
 
 WriteGmsh::~WriteGmsh() 

Modified: MOAB/trunk/WriteHDF5.cpp
===================================================================
--- MOAB/trunk/WriteHDF5.cpp	2008-04-15 00:29:40 UTC (rev 1764)
+++ MOAB/trunk/WriteHDF5.cpp	2008-04-15 13:59:33 UTC (rev 1765)
@@ -281,18 +281,19 @@
   //register_known_tag_types( iFace ); 
  
     // Get the util interface
-  rval = iFace->query_interface( "MBWriteUtilIface", (void**)&writeUtil );
+  void* ptr = 0;
+  rval = iFace->query_interface( "MBWriteUtilIface", &ptr );
   CHK_MB_ERR_0(rval);
 
   idMap.clear();
   
   if (MB_SUCCESS != rval)
   {
-    iFace->release_interface( "MBWriteUtilIFace", writeUtil );
     writeUtil = 0;
     return rval;
   }
 
+  writeUtil = reinterpret_cast<MBWriteUtilIface*>(ptr);
   return MB_SUCCESS;
 }
   

Modified: MOAB/trunk/WriteNCDF.cpp
===================================================================
--- MOAB/trunk/WriteNCDF.cpp	2008-04-15 00:29:40 UTC (rev 1764)
+++ MOAB/trunk/WriteNCDF.cpp	2008-04-15 13:59:33 UTC (rev 1765)
@@ -57,8 +57,9 @@
 {
   assert(impl != NULL);
 
-  std::string iface_name = "MBWriteUtilIface";
-  impl->query_interface(iface_name, reinterpret_cast<void**>(&mWriteIface));
+  void* ptr = 0;
+  impl->query_interface( "MBWriteUtilIface", &ptr );
+  mWriteIface = reinterpret_cast<MBWriteUtilIface*>(ptr);
 
   // initialize in case tag_get_handle fails below
   //! get and cache predefined tag handles

Modified: MOAB/trunk/WriteSLAC.cpp
===================================================================
--- MOAB/trunk/WriteSLAC.cpp	2008-04-15 00:29:40 UTC (rev 1764)
+++ MOAB/trunk/WriteSLAC.cpp	2008-04-15 13:59:33 UTC (rev 1765)
@@ -57,8 +57,9 @@
 {
   assert(impl != NULL);
 
-  std::string iface_name = "MBWriteUtilIface";
-  impl->query_interface(iface_name, reinterpret_cast<void**>(&mWriteIface));
+  void* ptr = 0;
+  impl->query_interface( "MBWriteUtilIface", &ptr );
+  mWriteIface = reinterpret_cast<MBWriteUtilIface*>(ptr);
 
   // initialize in case tag_get_handle fails below
   //! get and cache predefined tag handles

Modified: MOAB/trunk/WriteSTL.cpp
===================================================================
--- MOAB/trunk/WriteSTL.cpp	2008-04-15 00:29:40 UTC (rev 1764)
+++ MOAB/trunk/WriteSTL.cpp	2008-04-15 13:59:33 UTC (rev 1765)
@@ -65,7 +65,9 @@
 WriteSTL::WriteSTL(MBInterface *impl) 
     : mbImpl(impl)
 {
-  impl->query_interface("MBWriteUtilIface", reinterpret_cast<void**>(&mWriteIface));
+  void* ptr = 0;
+  impl->query_interface( "MBWriteUtilIface", &ptr );
+  mWriteIface = reinterpret_cast<MBWriteUtilIface*>(ptr);
 }
 
 WriteSTL::~WriteSTL() 

Modified: MOAB/trunk/WriteTemplate.cpp
===================================================================
--- MOAB/trunk/WriteTemplate.cpp	2008-04-15 00:29:40 UTC (rev 1764)
+++ MOAB/trunk/WriteTemplate.cpp	2008-04-15 13:59:33 UTC (rev 1765)
@@ -53,8 +53,9 @@
 {
   assert(impl != NULL);
 
-  std::string iface_name = "MBWriteUtilIface";
-  impl->query_interface(iface_name, reinterpret_cast<void**>(&mWriteIface));
+  void* ptr = 0;
+  impl->query_interface( "MBWriteUtilIface", &ptr );
+  mWriteIface = reinterpret_cast<MBWriteUtilIface*>(ptr);
 
   // initialize in case tag_get_handle fails below
   //! get and cache predefined tag handles

Modified: MOAB/trunk/WriteVtk.cpp
===================================================================
--- MOAB/trunk/WriteVtk.cpp	2008-04-15 00:29:40 UTC (rev 1764)
+++ MOAB/trunk/WriteVtk.cpp	2008-04-15 13:59:33 UTC (rev 1765)
@@ -56,7 +56,9 @@
 {
   assert(impl != NULL);
 
-  impl->query_interface("MBWriteUtilIface", reinterpret_cast<void**>(&writeTool));
+  void* ptr = 0;
+  impl->query_interface( "MBWriteUtilIface", &ptr );
+  writeTool = reinterpret_cast<MBWriteUtilIface*>(ptr);
   
   MBErrorCode result = impl->tag_get_handle(GLOBAL_ID_TAG_NAME, globalId);
   if (MB_TAG_NOT_FOUND == result)




More information about the moab-dev mailing list