1#ifndef __MSVC__HEAD
2#define __MSVC__HEAD
3
4#include <direct.h>
5#include <process.h>
6#include <malloc.h>
7
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
15
16static __inline int strcasecmp (const char *s1, const char *s2)
17{
18 int size1 = strlen(s1);
19 int sisz2 = strlen(s2);
20 return _strnicmp(s1, s2, sisz2 > size1 ? sisz2 : size1);
21}
22
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)
30
31/*
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).
36*/
37struct _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;
49};
50#endif