From 5c54c8e57935a5641fc8a48b09b2f32be0fddb44 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Fri, 14 May 2010 16:10:53 +0000
Subject: [PATCH] fix htonl on win32

---
 contrib/mpeg_encode/bitio.cpp           | 3 ---
 contrib/mpeg_encode/headers/byteorder.h | 8 ++++++++
 contrib/mpeg_encode/headers/general.h   | 5 ++++-
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/contrib/mpeg_encode/bitio.cpp b/contrib/mpeg_encode/bitio.cpp
index 1805a1aef7..69b5303dea 100644
--- a/contrib/mpeg_encode/bitio.cpp
+++ b/contrib/mpeg_encode/bitio.cpp
@@ -13,8 +13,6 @@
  *									     *
  *===========================================================================*/
 
-#define htonl(x) (x) // gmsh
-
 /*
  * Copyright (c) 1995 The Regents of the University of California.
  * All rights reserved.
@@ -89,7 +87,6 @@
 #include "bitio.h"
 #include "mtypes.h"
 
-
 /*===============================*
  * INTERNAL PROCEDURE prototypes *
  *===============================*/
diff --git a/contrib/mpeg_encode/headers/byteorder.h b/contrib/mpeg_encode/headers/byteorder.h
index ac97874eb8..3dc75f1d31 100644
--- a/contrib/mpeg_encode/headers/byteorder.h
+++ b/contrib/mpeg_encode/headers/byteorder.h
@@ -72,5 +72,13 @@
 #else
     /* let in.h handle it, if possible */                  
 #include <sys/types.h>
+
+// gmsh: for windows
+#if !defined(WIN32) || defined(__CYGWIN__)
+#include <netinet/in.h>
+#else
+#include <winsock.h>
+#endif
+
 #endif /* FORCE_LITTLE_ENDIAN */
 #endif /* FORCE_BIG_ENDIAN */
diff --git a/contrib/mpeg_encode/headers/general.h b/contrib/mpeg_encode/headers/general.h
index 5c1dc02c9c..a4782c897b 100644
--- a/contrib/mpeg_encode/headers/general.h
+++ b/contrib/mpeg_encode/headers/general.h
@@ -115,7 +115,10 @@ int pclose();
  * TYPE DEFINITIONS *
  *==================*/
 
-typedef int boolean;
+// gmsh: cannot use a typedef because windows does, too -> use a #define 
+//typedef int boolean;
+#define boolean int
+
 /* this is for JPEG stuff */
 #define BOOLEAN_DEFINED
 #define HAVE_BOOLEAN
-- 
GitLab