mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-08 12:20:06 +00:00
Fix compilation of posix-test on MinGW
This commit is contained in:
parent
ca2cadb1c6
commit
40681e6037
@ -73,7 +73,7 @@ enum FStatSimulation { NONE, MAX_SIZE, ERROR } fstat_sim;
|
||||
} \
|
||||
}
|
||||
|
||||
#ifndef _WIN32
|
||||
#ifndef _MSC_VER
|
||||
int test::open(const char *path, int oflag, int mode) {
|
||||
EMULATE_EINTR(open, -1);
|
||||
return ::open(path, oflag, mode);
|
||||
@ -87,7 +87,17 @@ int test::fstat(int fd, struct stat *buf) {
|
||||
buf->st_size = max_file_size();
|
||||
return result;
|
||||
}
|
||||
#else
|
||||
errno_t test::sopen_s(
|
||||
int* pfh, const char *filename, int oflag, int shflag, int pmode) {
|
||||
EMULATE_EINTR(open, EINTR);
|
||||
return _sopen_s(pfh, filename, oflag, shflag, pmode);
|
||||
}
|
||||
|
||||
static LONGLONG max_file_size() { return std::numeric_limits<LONGLONG>::max(); }
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32
|
||||
long test::sysconf(int name) {
|
||||
long result = ::sysconf(name);
|
||||
if (!sysconf_error)
|
||||
@ -97,14 +107,6 @@ long test::sysconf(int name) {
|
||||
return -1;
|
||||
}
|
||||
#else
|
||||
errno_t test::sopen_s(
|
||||
int* pfh, const char *filename, int oflag, int shflag, int pmode) {
|
||||
EMULATE_EINTR(open, EINTR);
|
||||
return _sopen_s(pfh, filename, oflag, shflag, pmode);
|
||||
}
|
||||
|
||||
static LONGLONG max_file_size() { return std::numeric_limits<LONGLONG>::max(); }
|
||||
|
||||
DWORD test::GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh) {
|
||||
if (fstat_sim == ERROR) {
|
||||
SetLastError(ERROR_ACCESS_DENIED);
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user