Fix compilation of posix-test on MinGW

This commit is contained in:
vitaut
2015-05-06 07:29:58 -07:00
parent ca2cadb1c6
commit 40681e6037
2 changed files with 22 additions and 14 deletions
+11 -5
View File
@@ -31,26 +31,32 @@
#include <errno.h>
#include <stdio.h>
#ifndef _WIN32
struct stat;
#else
#ifdef _WIN32
# include <windows.h>
#endif
#ifndef _MSC_VER
struct stat;
#endif
namespace test {
#if !defined(_WIN32) || defined(__MINGW32__)
#ifndef _MSC_VER
// Size type for read and write.
typedef size_t size_t;
typedef ssize_t ssize_t;
int open(const char *path, int oflag, int mode);
int fstat(int fd, struct stat *buf);
long sysconf(int name);
#else
typedef unsigned size_t;
typedef int ssize_t;
errno_t sopen_s(
int* pfh, const char *filename, int oflag, int shflag, int pmode);
#endif
#ifndef _WIN32
long sysconf(int name);
#else
DWORD GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh);
#endif