From 90c2b37fd7e6598b32376dcbcaa9d7518f17d93f Mon Sep 17 00:00:00 2001 From: Jacques Germishuys Date: Sat, 5 Jul 2014 21:22:56 +0200 Subject: [PATCH 1/7] in_addr is defined in , include before --- src/netops.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/netops.c b/src/netops.c index 8a60299c2..fceb4fb74 100644 --- a/src/netops.c +++ b/src/netops.c @@ -13,6 +13,7 @@ # include # include #else +# include # include # ifdef _MSC_VER # pragma comment(lib, "ws2_32") From b8365f21684ea062ed03d948993426a7f202e542 Mon Sep 17 00:00:00 2001 From: Jacques Germishuys Date: Sat, 5 Jul 2014 21:24:26 +0200 Subject: [PATCH 2/7] strnlen() is only available from Visual Studio 2005+ --- src/strnlen.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/strnlen.h b/src/strnlen.h index fdd7fe39c..eecfe3c02 100644 --- a/src/strnlen.h +++ b/src/strnlen.h @@ -7,7 +7,8 @@ #ifndef INCLUDE_strlen_h__ #define INCLUDE_strlen_h__ -#if defined(__MINGW32__) || defined(__sun) || defined(__APPLE__) || defined(__MidnightBSD__) +#if defined(__MINGW32__) || defined(__sun) || defined(__APPLE__) || defined(__MidnightBSD__) ||\ + (defined(_MSC_VER) && _MSC_VER < 1500) # define NO_STRNLEN #endif From ab864e9c7156e76863a2375d8117a049cb90bf1b Mon Sep 17 00:00:00 2001 From: Jacques Germishuys Date: Sat, 5 Jul 2014 21:25:20 +0200 Subject: [PATCH 3/7] _stat64 is a function, __stat64 is the structure --- src/win32/msvc-compat.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/win32/msvc-compat.h b/src/win32/msvc-compat.h index 50865ed17..f79acaacc 100644 --- a/src/win32/msvc-compat.h +++ b/src/win32/msvc-compat.h @@ -15,7 +15,7 @@ # define R_OK 4 /* read mode check */ # define lseek _lseeki64 -# define stat _stat64 +# define stat __stat64 # define fstat _fstat64 /* stat: file mode type testing macros */ From cde32d4d28ae14e583853d07cdaf19ef9ee2dd25 Mon Sep 17 00:00:00 2001 From: Jacques Germishuys Date: Sat, 5 Jul 2014 21:25:55 +0200 Subject: [PATCH 4/7] Variadic macros is only available from Visual Studio 2005+ --- src/trace.h | 10 +++++++++- src/win32/msvc-compat.h | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/trace.h b/src/trace.h index 4d4e3bf53..486084d01 100644 --- a/src/trace.h +++ b/src/trace.h @@ -46,8 +46,16 @@ GIT_INLINE(void) git_trace__write_fmt( #else +GIT_INLINE(void) git_trace__null( + git_trace_level_t level, + const char *fmt, ...) +{ + GIT_UNUSED(level); + GIT_UNUSED(fmt); +} + #define git_trace_level() ((void)0) -#define git_trace(lvl, ...) ((void)0) +#define git_trace git_trace__null #endif diff --git a/src/win32/msvc-compat.h b/src/win32/msvc-compat.h index f79acaacc..fa4e2912c 100644 --- a/src/win32/msvc-compat.h +++ b/src/win32/msvc-compat.h @@ -38,7 +38,7 @@ typedef SSIZE_T ssize_t; /* define snprintf using variadic macro support if available */ -#if _MSC_VER >= 1400 +#if _MSC_VER >= 1500 # define snprintf(BUF, SZ, FMT, ...) _snprintf_s(BUF, SZ, _TRUNCATE, FMT, __VA_ARGS__) #else # define snprintf _snprintf From 491ad0de59e1002acf9919d84557345e964b9d06 Mon Sep 17 00:00:00 2001 From: Jacques Germishuys Date: Sat, 5 Jul 2014 21:26:35 +0200 Subject: [PATCH 5/7] qsort_r is only available from Visual Studio 2005+ --- src/util.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/util.c b/src/util.c index f9d37e4f4..5c305950f 100644 --- a/src/util.c +++ b/src/util.c @@ -613,7 +613,8 @@ void git__qsort_r( defined(__OpenBSD__) || defined(__NetBSD__) || \ defined(__gnu_hurd__) || defined(__ANDROID_API__) || \ defined(__sun) || defined(__CYGWIN__) || \ - (__GLIBC__ == 2 && __GLIBC_MINOR__ < 8) + (__GLIBC__ == 2 && __GLIBC_MINOR__ < 8) || \ + (defined(_MSC_VER) && _MSC_VER < 1500) git__insertsort_r(els, nel, elsize, NULL, cmp, payload); #elif defined(GIT_WIN32) git__qsort_r_glue glue = { cmp, payload }; From 72090514b14ef5d11828c960a905fe07ce68ae88 Mon Sep 17 00:00:00 2001 From: Jacques Germishuys Date: Sat, 5 Jul 2014 21:27:21 +0200 Subject: [PATCH 6/7] Secure CRT is only available from Visual Studio 2005+ --- src/win32/posix.h | 2 +- src/win32/posix_w32.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/win32/posix.h b/src/win32/posix.h index 2cbea1807..22ea6a531 100644 --- a/src/win32/posix.h +++ b/src/win32/posix.h @@ -19,7 +19,7 @@ # define EAFNOSUPPORT (INT_MAX-1) #endif -#ifdef _MSC_VER +#if defined(_MSC_VER) && _MSC_VER >= 1500 # define p_ftruncate(fd, sz) _chsize_s(fd, sz) #else /* MinGW */ # define p_ftruncate(fd, sz) _chsize(fd, sz) diff --git a/src/win32/posix_w32.c b/src/win32/posix_w32.c index fbadb1c9e..fb8246558 100644 --- a/src/win32/posix_w32.c +++ b/src/win32/posix_w32.c @@ -543,7 +543,7 @@ char *p_realpath(const char *orig_path, char *buffer) int p_vsnprintf(char *buffer, size_t count, const char *format, va_list argptr) { -#ifdef _MSC_VER +#if defined(_MSC_VER) && _MSC_VER >= 1500 int len; if (count == 0 || @@ -570,7 +570,7 @@ int p_snprintf(char *buffer, size_t count, const char *format, ...) int p_mkstemp(char *tmp_path) { -#if defined(_MSC_VER) +#if defined(_MSC_VER) && _MSC_VER >= 1500 if (_mktemp_s(tmp_path, strlen(tmp_path) + 1) != 0) return -1; #else From 59ceb432f310de9f26b368ae1b8cdee395e52a50 Mon Sep 17 00:00:00 2001 From: Jacques Germishuys Date: Sat, 5 Jul 2014 21:27:47 +0200 Subject: [PATCH 7/7] Define IO_REPARSE_TAG_SYMLINK if its not defined by WinNT.h --- src/win32/posix_w32.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/win32/posix_w32.c b/src/win32/posix_w32.c index fb8246558..a74fcaad1 100644 --- a/src/win32/posix_w32.c +++ b/src/win32/posix_w32.c @@ -19,6 +19,10 @@ # define FILE_NAME_NORMALIZED 0 #endif +#ifndef IO_REPARSE_TAG_SYMLINK +#define IO_REPARSE_TAG_SYMLINK (0xA000000CL) +#endif + /* Options which we always provide to _wopen. * * _O_BINARY - Raw access; no translation of CR or LF characters