aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compat/mingw.c2
-rw-r--r--compat/mingw.h2
-rw-r--r--compat/msvc.h7
-rw-r--r--compat/win32.h2
-rw-r--r--compat/winansi.c1
-rw-r--r--git-compat-util.h6
-rw-r--r--thread-utils.c5
7 files changed, 13 insertions, 12 deletions
diff --git a/compat/mingw.c b/compat/mingw.c
index 34ee427ba..6b5b5b2c7 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -3,6 +3,8 @@
#include <conio.h>
#include "../strbuf.h"
+#include <shellapi.h>
+
static int err_win_to_posix(DWORD winerr)
{
int error = ENOSYS;
diff --git a/compat/mingw.h b/compat/mingw.h
index bcd23b0a4..5b5258bce 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -41,6 +41,7 @@ struct passwd {
extern char *getpass(const char *prompt);
+#ifndef POLLIN
struct pollfd {
int fd; /* file descriptor */
short events; /* requested events */
@@ -48,6 +49,7 @@ struct pollfd {
};
#define POLLIN 1
#define POLLHUP 2
+#endif
typedef void (__cdecl *sig_handler_t)(int);
struct sigaction {
diff --git a/compat/msvc.h b/compat/msvc.h
index 6daf313e8..53a6d30c0 100644
--- a/compat/msvc.h
+++ b/compat/msvc.h
@@ -1,13 +1,6 @@
#ifndef __MSVC__HEAD
#define __MSVC__HEAD
-/* Define minimize windows version */
-#define WINVER 0x0500
-#define _WIN32_WINNT 0x0500
-#define _WIN32_WINDOWS 0x0410
-#define _WIN32_IE 0x0700
-#define NTDDI_VERSION NTDDI_WIN2KSP1
-#include <winsock2.h>
#include <direct.h>
#include <process.h>
#include <malloc.h>
diff --git a/compat/win32.h b/compat/win32.h
index e8c178d8c..8ce91048d 100644
--- a/compat/win32.h
+++ b/compat/win32.h
@@ -2,7 +2,9 @@
#define WIN32_H
/* common Win32 functions for MinGW and Cygwin */
+#ifndef WIN32 /* Not defined by Cygwin */
#include <windows.h>
+#endif
static inline int file_attr_to_st_mode (DWORD attr)
{
diff --git a/compat/winansi.c b/compat/winansi.c
index 9217c24b4..dedce2104 100644
--- a/compat/winansi.c
+++ b/compat/winansi.c
@@ -2,7 +2,6 @@
* Copyright 2008 Peter Harris <git@peter.is-a-geek.org>
*/
-#include <windows.h>
#include "../git-compat-util.h"
/*
diff --git a/git-compat-util.h b/git-compat-util.h
index 8ea444fdc..8d6e29cde 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -65,6 +65,12 @@
#define _NETBSD_SOURCE 1
#define _SGI_SOURCE 1
+#ifdef WIN32 /* Both MinGW and MSVC */
+#define WIN32_LEAN_AND_MEAN /* stops windows.h including winsock.h */
+#include <winsock2.h>
+#include <windows.h>
+#endif
+
#include <unistd.h>
#include <stdio.h>
#include <sys/stat.h>
diff --git a/thread-utils.c b/thread-utils.c
index 55e7e2904..4f9c829c2 100644
--- a/thread-utils.c
+++ b/thread-utils.c
@@ -1,9 +1,6 @@
#include "cache.h"
-#ifdef _WIN32
-# define WIN32_LEAN_AND_MEAN
-# include <windows.h>
-#elif defined(hpux) || defined(__hpux) || defined(_hpux)
+#if defined(hpux) || defined(__hpux) || defined(_hpux)
# include <sys/pstat.h>
#endif