mirror of
https://github.com/fmtlib/fmt.git
synced 2025-04-16 05:42:19 +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) {
|
int test::open(const char *path, int oflag, int mode) {
|
||||||
EMULATE_EINTR(open, -1);
|
EMULATE_EINTR(open, -1);
|
||||||
return ::open(path, oflag, mode);
|
return ::open(path, oflag, mode);
|
||||||
@ -87,7 +87,17 @@ int test::fstat(int fd, struct stat *buf) {
|
|||||||
buf->st_size = max_file_size();
|
buf->st_size = max_file_size();
|
||||||
return result;
|
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 test::sysconf(int name) {
|
||||||
long result = ::sysconf(name);
|
long result = ::sysconf(name);
|
||||||
if (!sysconf_error)
|
if (!sysconf_error)
|
||||||
@ -97,14 +107,6 @@ long test::sysconf(int name) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#else
|
#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) {
|
DWORD test::GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh) {
|
||||||
if (fstat_sim == ERROR) {
|
if (fstat_sim == ERROR) {
|
||||||
SetLastError(ERROR_ACCESS_DENIED);
|
SetLastError(ERROR_ACCESS_DENIED);
|
||||||
|
@ -31,26 +31,32 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifdef _WIN32
|
||||||
struct stat;
|
|
||||||
#else
|
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef _MSC_VER
|
||||||
|
struct stat;
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace test {
|
namespace test {
|
||||||
|
|
||||||
#if !defined(_WIN32) || defined(__MINGW32__)
|
#ifndef _MSC_VER
|
||||||
// Size type for read and write.
|
// Size type for read and write.
|
||||||
typedef size_t size_t;
|
typedef size_t size_t;
|
||||||
typedef ssize_t ssize_t;
|
typedef ssize_t ssize_t;
|
||||||
int open(const char *path, int oflag, int mode);
|
int open(const char *path, int oflag, int mode);
|
||||||
int fstat(int fd, struct stat *buf);
|
int fstat(int fd, struct stat *buf);
|
||||||
long sysconf(int name);
|
|
||||||
#else
|
#else
|
||||||
typedef unsigned size_t;
|
typedef unsigned size_t;
|
||||||
typedef int ssize_t;
|
typedef int ssize_t;
|
||||||
errno_t sopen_s(
|
errno_t sopen_s(
|
||||||
int* pfh, const char *filename, int oflag, int shflag, int pmode);
|
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);
|
DWORD GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user