From 7afc9b1d3c81924256fa0a9c8d0259d0c14fa182 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Thu, 11 Apr 2013 12:24:59 +0000
Subject: [PATCH] for mscv

---
 CMakeLists.txt                   | 6 +++---
 Common/StringUtils.cpp           | 6 +++---
 Common/VertexArray.h             | 6 +++---
 Geo/MVertexBoundaryLayerData.cpp | 4 ++--
 4 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 720868fb1e..f299839ed8 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 46d3ceee51..22ada724fe 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 2ff312791b..75f1aae7b1 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 255a8a85c1..4ff6e7d217 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)
-- 
GitLab