Skip to content

Commit e2c821d

Browse files
committed
Redefine some macros for better portability
1 parent 0a665de commit e2c821d

File tree

1 file changed

+6
-16
lines changed

1 file changed

+6
-16
lines changed

src/io/IOUtil.hpp

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,26 +36,16 @@ limitations under the License.
3636
#include <dirent.h>
3737
#endif
3838

39+
// Note stat64/lstat64 are deprecated on MacOS/Linux
40+
// Use _FILE_OFFSET_BITS and stat/lstat instead
3941

40-
#ifdef _MSC_VER
42+
#ifdef _WIN32
4143
#define STAT _stat64
42-
#else
43-
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__APPLE__) || defined(__MINGW32__)
44-
#define STAT stat
45-
#else
46-
#define STAT stat64
47-
#endif
48-
#endif
49-
50-
51-
#ifdef _MSC_VER
5244
#define LSTAT _stat64
5345
#else
54-
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__APPLE__) || defined(__MINGW32__)
55-
#define LSTAT lstat
56-
#else
57-
#define LSTAT lstat64
58-
#endif
46+
#define _FILE_OFFSET_BITS 64
47+
#define STAT stat
48+
#define LSTAT lstat
5949
#endif
6050

6151
#if defined(__MINGW32__)

0 commit comments

Comments
 (0)