From bc935e9c51f7cdd339109f04085a0361e299455c Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Thu, 12 Jun 2008 11:52:00 +0000
Subject: [PATCH] fixes for vc++

---
 Common/GmshUI.h   | 4 ++--
 Fltk/GmshServer.h | 2 +-
 Fltk/Makefile     | 4 ++--
 Graphics/Makefile | 4 ++--
 Graphics/Mesh.cpp | 7 ++++---
 5 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/Common/GmshUI.h b/Common/GmshUI.h
index 3b16e4c976..b7fb6ed3b8 100644
--- a/Common/GmshUI.h
+++ b/Common/GmshUI.h
@@ -41,8 +41,8 @@
 # define GMSH_WINDOW_BOX FL_FLAT_BOX
 #endif
 
-// recent Cygwin releases define min/max macros! 
-#if defined(__CYGWIN__)
+// some Windows versions define min/max macros! 
+#if defined(WIN32)
 #undef min
 #undef max
 #endif
diff --git a/Fltk/GmshServer.h b/Fltk/GmshServer.h
index 5b733db9f2..ba15a631d1 100644
--- a/Fltk/GmshServer.h
+++ b/Fltk/GmshServer.h
@@ -97,7 +97,7 @@ class GmshServer {
     int sofar = 0;
     int remaining = bytes;
     do {
-      ssize_t len = recv(_sock, buf + sofar, remaining, 0);
+      int len = recv(_sock, buf + sofar, remaining, 0);
       if(len <= 0)
         return 0;
       sofar += len;
diff --git a/Fltk/Makefile b/Fltk/Makefile
index 554268b5cc..0ca2092b25 100644
--- a/Fltk/Makefile
+++ b/Fltk/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.188 2008-06-07 17:20:45 geuzaine Exp $
+# $Id: Makefile,v 1.189 2008-06-12 11:52:00 geuzaine Exp $
 #
 # Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 #
@@ -52,7 +52,7 @@ ${LIB}: ${OBJ}
 cpobj: ${OBJ} 
 	cp -f ${OBJ} ../lib/
 
-.cpp.o:
+.cpp${OBJEXT}:
 	${CXX} ${CFLAGS} ${DASH}c $<
 
 res:
diff --git a/Graphics/Makefile b/Graphics/Makefile
index 5dc9dde12e..e083debc16 100644
--- a/Graphics/Makefile
+++ b/Graphics/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.155 2008-06-07 17:20:47 geuzaine Exp $
+# $Id: Makefile,v 1.156 2008-06-12 11:52:00 geuzaine Exp $
 #
 # Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 #
@@ -58,7 +58,7 @@ ${LIB}: ${OBJ}
 cpobj: ${OBJ}
 	cp -f ${OBJ} ../lib/
 
-.cpp.o:
+.cpp${OBJEXT}:
 	${CXX} ${CFLAGS} ${DASH}c $<
 
 clean:
diff --git a/Graphics/Mesh.cpp b/Graphics/Mesh.cpp
index 2c8a565a01..535d2ada90 100644
--- a/Graphics/Mesh.cpp
+++ b/Graphics/Mesh.cpp
@@ -1,4 +1,4 @@
-// $Id: Mesh.cpp,v 1.221 2008-05-04 08:31:14 geuzaine Exp $
+// $Id: Mesh.cpp,v 1.222 2008-06-12 11:52:00 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -19,6 +19,7 @@
 // 
 // Please report all bugs and problems to <gmsh@geuz.org>.
 
+#include <math.h>
 #include "Message.h"
 #include "GmshUI.h"
 #include "GModel.h"
@@ -713,7 +714,7 @@ class initMeshGRegion {
       num += (12 * r->tetrahedra.size() + 24 * r->hexahedra.size() +
               18 * r->prisms.size() + 16 * r->pyramids.size()) / 4;
       if(CTX.mesh.use_cut_plane && CTX.mesh.cut_plane_draw_intersect)
-        num = (int)sqrt(num);
+        num = (int)sqrt((double)num);
       if(CTX.mesh.explode != 1.) num *= 4;
       if(_curved) num *= 2;
     }
@@ -726,7 +727,7 @@ class initMeshGRegion {
       num += (4 * r->tetrahedra.size() + 12 * r->hexahedra.size() +
               8 * r->prisms.size() + 6 * r->pyramids.size()) / 2;
       if(CTX.mesh.use_cut_plane && CTX.mesh.cut_plane_draw_intersect)
-        num = (int)sqrt(num);
+        num = (int)sqrt((double)num);
       if(CTX.mesh.explode != 1.) num *= 2;
       if(_curved) num *= 4;
     }
-- 
GitLab