builtin-mailinfo.c: check error status from rewind and ftruncate
[git/spearce.git] / compat / msvc.h
blob9c753a560fcadb44a6e4afb22828584b6fd20db3
1 #ifndef __MSVC__HEAD
2 #define __MSVC__HEAD
4 #include <direct.h>
5 #include <process.h>
6 #include <malloc.h>
8 /* porting function */
9 #define inline __inline
10 #define __inline__ __inline
11 #define __attribute__(x)
12 #define va_copy(dst, src) ((dst) = (src))
13 #define strncasecmp _strnicmp
14 #define ftruncate _chsize
16 static __inline int strcasecmp (const char *s1, const char *s2)
18 int size1 = strlen(s1);
19 int sisz2 = strlen(s2);
20 return _strnicmp(s1, s2, sisz2 > size1 ? sisz2 : size1);
23 #undef ERROR
24 #undef stat
25 #undef _stati64
26 #include "compat/mingw.h"
27 #undef stat
28 #define stat _stati64
29 #define _stat64(x,y) mingw_lstat(x,y)
32 Even though _stati64 is normally just defined at _stat64
33 on Windows, we specify it here as a proper struct to avoid
34 compiler warnings about macro redefinition due to magic in
35 mingw.h. Struct taken from ReactOS (GNU GPL license).
37 struct _stati64 {
38 _dev_t st_dev;
39 _ino_t st_ino;
40 unsigned short st_mode;
41 short st_nlink;
42 short st_uid;
43 short st_gid;
44 _dev_t st_rdev;
45 __int64 st_size;
46 time_t st_atime;
47 time_t st_mtime;
48 time_t st_ctime;
50 #endif