From 64f7965d80f4b71d47d5a6e4ae551ef3d22ceecb Mon Sep 17 00:00:00 2001
From: "joreland@mysql.com" <>
Date: Thu, 11 Nov 2004 22:39:24 +0100
Subject: [PATCH] wl1744 - ndb win port improve ndb_global.h

---
 configure.in                |  2 +-
 ndb/include/ndb_global.h.in | 38 +++++++++++++++++++++++--------------
 2 files changed, 25 insertions(+), 15 deletions(-)

diff --git a/configure.in b/configure.in
index 55cd7edfca8..a4dfdfb9333 100644
--- a/configure.in
+++ b/configure.in
@@ -771,7 +771,7 @@ AC_CHECK_HEADERS(fcntl.h float.h floatingpoint.h ieeefp.h limits.h \
  strings.h string.h synch.h sys/mman.h sys/socket.h netinet/in.h arpa/inet.h \
  sys/timeb.h sys/types.h sys/un.h sys/vadvise.h sys/wait.h term.h \
  unistd.h utime.h sys/utime.h termio.h termios.h sched.h crypt.h alloca.h \
- sys/ioctl.h malloc.h sys/malloc.h linux/config.h)
+ sys/ioctl.h malloc.h sys/malloc.h linux/config.h sys/resource.h sys/param.h)
 
 #--------------------------------------------------------------------
 # Check for system libraries. Adds the library to $LIBS
diff --git a/ndb/include/ndb_global.h.in b/ndb/include/ndb_global.h.in
index af7f9383461..d89bf9c29d2 100644
--- a/ndb/include/ndb_global.h.in
+++ b/ndb/include/ndb_global.h.in
@@ -10,17 +10,20 @@
 #if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32)
 #define NDB_WIN32
 #include <winsock2.h>
-#include <my_global.h>
-#include <m_ctype.h>
-
 #define PATH_MAX 256
 #define DIR_SEPARATOR "\\"
 #define MYSQLCLUSTERDIR "c:\\mysql\\mysql-cluster"
-
+#define snprintf _snprintf
+#define vsnprintf _vsnprintf
+#define HAVE_STRCASECMP
+#define strcasecmp(a,b) _strcmpi(a,b)
+#define strncasecmp(a,b) _strncmpi(a,b)
 #pragma warning(disable: 4503 4786)
-
 #else
 #undef NDB_WIN32
+#define DIR_SEPARATOR "/"
+#endif
+
 #include <my_global.h>
 #include <my_alarm.h>
 
@@ -29,18 +32,24 @@
 #endif
 #include <m_string.h>
 #include <m_ctype.h>
-#include <ndb_types.h>
 #include <ctype.h>
+
 #ifdef HAVE_STDARG_H
 #include <stdarg.h>
 #endif
+
 #ifdef TIME_WITH_SYS_TIME
 #include <time.h>
 #endif
+
 #ifdef HAVE_FCNTL_H
 #include <fcntl.h>
 #endif
+
+#ifdef HAVE_SYS_PARAM_H
 #include <sys/param.h>
+#endif
+
 #ifdef HAVE_SYS_STAT_H
   #if defined(__cplusplus) && defined(_APP32_64BIT_OFF_T) && defined(_INCLUDE_AES_SOURCE)
     #undef _INCLUDE_AES_SOURCE
@@ -50,18 +59,19 @@
     #include <sys/stat.h>
   #endif
 #endif
+
+#ifdef HAVE_SYS_RESOURCE_H
 #include <sys/resource.h>
+#endif
+
 #ifdef HAVE_SYS_WAIT_H
 #include <sys/wait.h>
 #endif
+
 #ifdef HAVE_SYS_MMAN_H
 #include <sys/mman.h>
 #endif
 
-#define DIR_SEPARATOR "/"
-
-#endif
-
 #ifndef HAVE_STRDUP
 extern char * strdup(const char *s);
 #endif
@@ -94,6 +104,10 @@ extern int ndb_init(void);
 extern void ndb_end(int);
 #define NDB_INIT(prog_name) {my_progname=(prog_name); ndb_init();}
 
+#ifdef  __cplusplus
+}
+#endif
+
 #ifdef SCO
 
 #ifndef PATH_MAX
@@ -102,8 +116,4 @@ extern void ndb_end(int);
 
 #endif /* SCO */
 
-#ifdef  __cplusplus
-}
-#endif
-
 #endif
-- 
2.30.9