diff --git a/CMakeLists.txt b/CMakeLists.txt index 720868fb1e5e708a713b4f1788dc1cc9ea6179e9..f299839ed89d58cb59cf686fd790a5f10ca56766 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -160,7 +160,7 @@ include(CheckCXXCompilerFlag) if(MSVC) # remove annoying warning about bool/int cast performance - set(GMSH_CONFIG_PRAGMAS "#pragma warning(disable:4800)") + set(GMSH_CONFIG_PRAGMAS "#pragma warning(disable:4800 4244 4267)") if(ENABLE_MSVC_STATIC_RUNTIME) foreach(VAR CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE @@ -975,12 +975,12 @@ endif(NOOPT) # force full warnings to encourage everybody to write clean(er) code check_cxx_compiler_flag("-Wall" WALL) -if(WALL) +if(WALL AND NOT MSVC) file(GLOB_RECURSE WALL_SRC Common/*.cpp Fltk/*.cpp FunctionSpace/*.cpp Geo/*.cpp Graphics/*.cpp Mesh/*.cpp Numeric/*.cpp Parser/*.cpp Plugin/*.cpp Post/*.cpp Qt/*.cpp Solver/*.cpp contrib/onelab/*.cpp) set_source_files_properties(${WALL_SRC} COMPILE_FLAGS "-Wall") -endif(WALL) +endif(WALL AND NOT MSVC) list(SORT CONFIG_OPTIONS) set(GMSH_CONFIG_OPTIONS "") diff --git a/Common/StringUtils.cpp b/Common/StringUtils.cpp index 46d3ceee51e2115dc9c892d4438b189f9def9143..22ada724fe850c67a01bc48c08fb808806375ae5 100644 --- a/Common/StringUtils.cpp +++ b/Common/StringUtils.cpp @@ -91,8 +91,8 @@ std::string FixRelativePath(const std::string &reference, const std::string &in) std::vector<std::string> SplitFileName(const std::string &fileName) { // returns [path, baseName, extension] - int idot = fileName.find_last_of('.'); - int islash = fileName.find_last_of("/\\"); + int idot = (int)fileName.find_last_of('.'); + int islash = (int)fileName.find_last_of("/\\"); if(idot == (int)std::string::npos) idot = -1; if(islash == (int)std::string::npos) islash = -1; std::vector<std::string> s(3); @@ -125,7 +125,7 @@ void ReplaceSubStringInPlace(const std::string &olds, const std::string &news, std::string &str) { while(1){ - int pos = str.find(olds.c_str()); + int pos = (int)str.find(olds.c_str()); if(pos == (int)std::string::npos) break; str.replace(pos, olds.size(), news.c_str()); } diff --git a/Common/VertexArray.h b/Common/VertexArray.h index 2ff312791b4b3789061e9ebcdf307c986e69ddc1..75f1aae7b1198870cfaf6308af65d71a4cd0eb5a 100644 --- a/Common/VertexArray.h +++ b/Common/VertexArray.h @@ -118,7 +118,7 @@ class BarycenterHash { public: std::size_t operator()(const Barycenter &b) const { - return b.x()+b.y()+b.z(); + return (std::size_t)(b.x() + b.y() + b.z()); } }; @@ -155,11 +155,11 @@ class VertexArray{ VertexArray(int numVerticesPerElement, int numElements); ~VertexArray(){} // return the number of vertices in the array - int getNumVertices() { return _vertices.size() / 3; } + int getNumVertices() { return (int)_vertices.size() / 3; } // return the number of vertices per element int getNumVerticesPerElement() { return _numVerticesPerElement; } // return the number of element pointers - int getNumElementPointers() { return _elements.size(); } + int getNumElementPointers() { return (int)_elements.size(); } // return a pointer to the raw vertex array (warning: 1) we don't // range check 2) calling this if _vertices.size() == 0 will cause // some compilers to throw an exception) diff --git a/Geo/MVertexBoundaryLayerData.cpp b/Geo/MVertexBoundaryLayerData.cpp index 255a8a85c150d4fcc5801ce56e55ceba2b41a7b4..4ff6e7d2179864e877042ff80a7910dabca27868 100644 --- a/Geo/MVertexBoundaryLayerData.cpp +++ b/Geo/MVertexBoundaryLayerData.cpp @@ -18,7 +18,7 @@ std::vector<MVertex*>* MVertexBoundaryLayerData::getChildren(int i) int MVertexBoundaryLayerData::getNumChildren(int i) { if (i < (int)this->children.size() && i >= 0) { - return this->children[i].size(); + return (int)this->children[i].size(); } else { return -1; @@ -27,7 +27,7 @@ int MVertexBoundaryLayerData::getNumChildren(int i) int MVertexBoundaryLayerData::getNumChildrenFamilies() { - return this->children.size(); + return (int)this->children.size(); } void MVertexBoundaryLayerData::addChildrenFamily(std::vector<MVertex*> family)