diff options
Diffstat (limited to 'src/win32')
| -rw-r--r-- | src/win32/mingw-compat.h | 18 | ||||
| -rw-r--r-- | src/win32/msvc-compat.h | 52 |
2 files changed, 70 insertions, 0 deletions
diff --git a/src/win32/mingw-compat.h b/src/win32/mingw-compat.h new file mode 100644 index 000000000..64d780b16 --- /dev/null +++ b/src/win32/mingw-compat.h @@ -0,0 +1,18 @@ +#ifndef INCLUDE_mingw_compat__ +#define INCLUDE_mingw_compat__ + +#if defined(__MINGW32__) + +/* use a 64-bit file offset type */ +# define lseek _lseeki64 +# define stat _stati64 +# define fstat _fstati64 + +/* stat: file mode type testing macros */ +# define _S_IFLNK 0120000 +# define S_IFLNK _S_IFLNK +# define S_ISLNK(m) (((m) & _S_IFMT) == _S_IFLNK) + +#endif + +#endif /* INCLUDE_mingw_compat__ */ diff --git a/src/win32/msvc-compat.h b/src/win32/msvc-compat.h new file mode 100644 index 000000000..df3e62d11 --- /dev/null +++ b/src/win32/msvc-compat.h @@ -0,0 +1,52 @@ +#ifndef INCLUDE_msvc_compat__ +#define INCLUDE_msvc_compat__ + +#if defined(_MSC_VER) + +/* access() mode parameter #defines */ +# define F_OK 0 /* existence check */ +# define W_OK 2 /* write mode check */ +# define R_OK 4 /* read mode check */ + +# define lseek _lseeki64 +# define stat _stat64 +# define fstat _fstat64 + +/* stat: file mode type testing macros */ +# define _S_IFLNK 0120000 +# define S_IFLNK _S_IFLNK + +# define S_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR) +# define S_ISREG(m) (((m) & _S_IFMT) == _S_IFREG) +# define S_ISFIFO(m) (((m) & _S_IFMT) == _S_IFIFO) +# define S_ISLNK(m) (((m) & _S_IFMT) == _S_IFLNK) + +# define mode_t unsigned short + +/* case-insensitive string comparison */ +# define strcasecmp _stricmp +# define strncasecmp _strnicmp + +#if (_MSC_VER >= 1600) +# include <stdint.h> +#else +/* add some missing <stdint.h> typedef's */ +typedef signed char int8_t; +typedef unsigned char uint8_t; + +typedef short int16_t; +typedef unsigned short uint16_t; + +typedef long int32_t; +typedef unsigned long uint32_t; + +typedef long long int64_t; +typedef unsigned long long uint64_t; + +typedef long long intmax_t; +typedef unsigned long long uintmax_t; +#endif + +#endif + +#endif /* INCLUDE_msvc_compat__ */ |
