aboutsummaryrefslogtreecommitdiff
path: root/compat/msvc.h
diff options
context:
space:
mode:
authorFrank Li <lznuaa@gmail.com>2009-09-16 10:20:25 +0200
committerJunio C Hamano <gitster@pobox.com>2009-09-18 20:00:42 -0700
commitd75f8e61315cc502c34aec6600db00a7c7192ffd (patch)
tree7f422cee37e8095bae10c5a9869e010a65492ed3 /compat/msvc.h
parent16fe1e03694e75a3923c3a757ec946aa6098aec7 (diff)
downloadgit-d75f8e61315cc502c34aec6600db00a7c7192ffd.tar.gz
git-d75f8e61315cc502c34aec6600db00a7c7192ffd.tar.xz
Add platform files for porting to MSVC
Add msvc.c and msvc.h to build git under MSVC. Signed-off-by: Frank Li <lznuaa@gmail.com> Signed-off-by: Marius Storm-Olsen <mstormo@gmail.com> Acked-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'compat/msvc.h')
-rw-r--r--compat/msvc.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/compat/msvc.h b/compat/msvc.h
new file mode 100644
index 000000000..6daf313e8
--- /dev/null
+++ b/compat/msvc.h
@@ -0,0 +1,55 @@
+#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>
+
+/* porting function */
+#define inline __inline
+#define __inline__ __inline
+#define __attribute__(x)
+#define va_copy(dst, src) ((dst) = (src))
+
+static __inline int strcasecmp (const char *s1, const char *s2)
+{
+ int size1 = strlen(s1);
+ int sisz2 = strlen(s2);
+ return _strnicmp(s1, s2, sisz2 > size1 ? sisz2 : size1);
+}
+
+#undef ERROR
+#undef stat
+#undef _stati64
+#include "compat/mingw.h"
+#undef stat
+#define stat _stati64
+#define _stat64(x,y) mingw_lstat(x,y)
+
+/*
+ Even though _stati64 is normally just defined at _stat64
+ on Windows, we specify it here as a proper struct to avoid
+ compiler warnings about macro redefinition due to magic in
+ mingw.h. Struct taken from ReactOS (GNU GPL license).
+*/
+struct _stati64 {
+ _dev_t st_dev;
+ _ino_t st_ino;
+ unsigned short st_mode;
+ short st_nlink;
+ short st_uid;
+ short st_gid;
+ _dev_t st_rdev;
+ __int64 st_size;
+ time_t st_atime;
+ time_t st_mtime;
+ time_t st_ctime;
+};
+#endif