[MOAB-dev] commit/MOAB: tautges: Removing some warnings.

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Wed Mar 12 10:32:22 CDT 2014


1 new commit in MOAB:

https://bitbucket.org/fathomteam/moab/commits/76a83e8282fc/
Changeset:   76a83e8282fc
Branch:      master
User:        tautges
Date:        2014-03-12 16:32:09
Summary:     Removing some warnings.

Affected #:  7 files

diff --git a/src/io/Tqdcfr.cpp b/src/io/Tqdcfr.cpp
index 701ff15..7416164 100644
--- a/src/io/Tqdcfr.cpp
+++ b/src/io/Tqdcfr.cpp
@@ -959,7 +959,7 @@ ErrorCode Tqdcfr::read_block(const unsigned int blindex,
      
     FREADD(blockh->attribOrder); num_read += sizeof(double);
     void const* tag_data[] = { &dbl_buf[0] };
-    int tag_sizes[] = { blockh->attribOrder };
+    int tag_sizes[] = { static_cast<int>(blockh->attribOrder) };
     result = mdbImpl->tag_set_by_ptr(block_attribs,&(blockh->setHandle),1,tag_data,tag_sizes);
     if (MB_SUCCESS != result) return result;
   }
@@ -1932,7 +1932,8 @@ ErrorCode Tqdcfr::BlockHeader::read_info_header(const double data_version,
       result = instance->mdbImpl->tag_get_handle(BLOCK_HEADER,3*sizeof(unsigned int),MB_TYPE_INTEGER,
 	bhTag_header,MB_TAG_CREAT|MB_TAG_SPARSE|MB_TAG_BYTES,&def_uint_zero[0]); 
       if (MB_SUCCESS != result) return result;
-      int block_header_data[] = { block_headers[i].blockCol, block_headers[i].blockMat, block_headers[i].blockDim }; 
+      int block_header_data[] = { static_cast<int>(block_headers[i].blockCol), static_cast<int>(block_headers[i].blockMat), 
+                                  static_cast<int>(block_headers[i].blockDim) }; 
       result = instance->mdbImpl->tag_set_data(bhTag_header,&(block_headers[i].setHandle), 1,
 					      block_header_data);
     }

diff --git a/src/parallel/WriteHDF5Parallel.cpp b/src/parallel/WriteHDF5Parallel.cpp
index 20a36a3..be692ba 100644
--- a/src/parallel/WriteHDF5Parallel.cpp
+++ b/src/parallel/WriteHDF5Parallel.cpp
@@ -118,6 +118,7 @@ const char* mpi_err_str( int errorcode ) {
 
 template <typename T> inline 
 void VALGRIND_MAKE_VEC_UNDEFINED( std::vector<T>& v ) {
+  if (v.size()) {}
     VALGRIND_MAKE_MEM_UNDEFINED( &v[0], v.size() * sizeof(T) );
 }
 

diff --git a/tools/mbcoupler/Coupler.cpp b/tools/mbcoupler/Coupler.cpp
index b496441..afee8af 100644
--- a/tools/mbcoupler/Coupler.cpp
+++ b/tools/mbcoupler/Coupler.cpp
@@ -483,10 +483,13 @@ ErrorCode Coupler::test_local_box(double *xyz,
 {
   std::vector<EntityHandle> entities;
   std::vector<CartVect> nat_coords;
-  bool canWrite;
+  bool canWrite = false;
   if (tl) {
     canWrite = tl->get_writeEnabled();
-    if(!canWrite) tl->enableWriteAccess();
+    if(!canWrite) {
+      tl->enableWriteAccess();
+      canWrite = true;
+    }
   }
 
   if (rel_eps && !abs_eps) {
@@ -833,7 +836,7 @@ ErrorCode Coupler::interp_field(EntityHandle elem,
   else
   {
     double vfields[27]; // will work for linear hex, quadratic hex or Tets
-    moab::Element::Map *elemMap;
+    moab::Element::Map *elemMap = NULL;
     int num_verts = 0;
     // get the EntityType
     // get the tag values at the vertices
@@ -1533,7 +1536,7 @@ int Coupler::get_group_integ_vals(std::vector< std::vector<iBase_EntityHandle> >
       iMesh_getEntTopo(iMeshInst, (*iter_j), &topo_type, &err);
       ERRORR("Failed to get topology for entity.", err);
 
-      moab::Element::Map *elemMap;
+      moab::Element::Map *elemMap = NULL;
       int num_verts = 0;
       if (topo_type == iMesh_HEXAHEDRON) {
         elemMap = new moab::Element::LinearHex();

diff --git a/tools/mbcoupler/mbcoupler_test.cpp b/tools/mbcoupler/mbcoupler_test.cpp
index c5c826f..20be50d 100644
--- a/tools/mbcoupler/mbcoupler_test.cpp
+++ b/tools/mbcoupler/mbcoupler_test.cpp
@@ -131,8 +131,8 @@ int main(int argc, char **argv)
   if (!dbgFile.empty()) {
     std::stringstream dfname;
     dfname << dbgFile << rank << ".txt";
-    std::freopen(dfname.str().c_str(), "a", stdout);
-    std::freopen(dfname.str().c_str(), "a", stderr);
+    if (!std::freopen(dfname.str().c_str(), "a", stdout)) return false;
+    if (!std::freopen(dfname.str().c_str(), "a", stderr)) return false;
   }
 
   // create MOAB instance based on that

diff --git a/tools/mbcoupler/ssn_test.cpp b/tools/mbcoupler/ssn_test.cpp
index 21adf72..a7e4188 100644
--- a/tools/mbcoupler/ssn_test.cpp
+++ b/tools/mbcoupler/ssn_test.cpp
@@ -102,8 +102,8 @@ int main(int argc, char **argv) {
   // Create an ofstream to write output.  One file each for each proc.
   std::stringstream fname;
   fname << argv[0] << rank << ".out";
-  std::freopen(fname.str().c_str(), "a", stdout);
-  std::freopen(fname.str().c_str(), "a", stderr);
+  if (!std::freopen(fname.str().c_str(), "a", stdout)) return false;
+  if (!std::freopen(fname.str().c_str(), "a", stderr)) return false;
 
   // Create the moab instance
   Interface *mbi = new Core();

diff --git a/tools/mbcslam/Intx2Mesh.cpp b/tools/mbcslam/Intx2Mesh.cpp
index 9859d00..e055beb 100644
--- a/tools/mbcslam/Intx2Mesh.cpp
+++ b/tools/mbcslam/Intx2Mesh.cpp
@@ -782,7 +782,7 @@ ErrorCode Intx2Mesh::create_departure_mesh_2nd_alg(EntityHandle & euler_set, Ent
     {
       // construct the conn quad
       EntityHandle new_conn[MAXEDGES];
-      int nnodes;
+      int nnodes = -1;
       for (int j=0; j<max_edges; j++)
       {
         int vgid = TLq.vi_rd[sizeTuple*i+2+j];// vertex global ID
@@ -1072,7 +1072,7 @@ ErrorCode Intx2Mesh::create_departure_mesh_3rd_alg(EntityHandle & lagr_set,
     {
       // construct the conn quad
       EntityHandle new_conn[MAXEDGES];
-      int nnodes;
+      int nnodes = -1;
       for (int j = 0; j < max_edges; j++)
       {
         int vgid = TLq.vi_rd[sizeTuple * i + 2 + j]; // vertex global ID

diff --git a/tools/mcnpmit/main.cpp b/tools/mcnpmit/main.cpp
index eca4b85..cc2d19a 100644
--- a/tools/mcnpmit/main.cpp
+++ b/tools/mcnpmit/main.cpp
@@ -136,7 +136,7 @@ int main(int argc, char **argv) {
   char line[10000];
 
   // Used only when reading a mesh file to get vertex info
-  double *cfd_coords;
+  double *cfd_coords = NULL;
   moab::Range::iterator cfd_iter;
   moab::EntityHandle meshset;

Repository URL: https://bitbucket.org/fathomteam/moab/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.


More information about the moab-dev mailing list