1
0
forked from Mirror/wren

Add a few comments.

This commit is contained in:
Bob Nystrom
2016-03-16 07:27:03 -07:00
parent 6f0ee7e52b
commit 1478d6b7e2

View File

@ -10,13 +10,20 @@
#include <stdio.h>
#include <fcntl.h>
// Windows doesn't define all of the Unix permission and mode flags by default,
// so map them ourselves.
#if defined(WIN32) || defined(WIN64)
#include <sys\stat.h>
#define S_IRUSR _S_IREAD
#define S_IWUSR _S_IWRITE
#define O_SYNC 0
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
#include <sys\stat.h>
// Map to Windows permission flags.
#define S_IRUSR _S_IREAD
#define S_IWUSR _S_IWRITE
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
// Not supported on Windows.
#define O_SYNC 0
#endif
typedef struct sFileRequestData
@ -203,9 +210,7 @@ static int mapFileFlags(int flags)
if (flags & 0x01) result |= O_RDONLY;
if (flags & 0x02) result |= O_WRONLY;
if (flags & 0x04) result |= O_RDWR;
#ifdef O_SYNC
if (flags & 0x08) result |= O_SYNC;
#endif
if (flags & 0x10) result |= O_CREAT;
if (flags & 0x20) result |= O_TRUNC;
if (flags & 0x40) result |= O_EXCL;