1
0
mirror of https://github.com/cc65/cc65.git synced 2025-01-15 22:30:04 +00:00

Fixed Visual C++ build (and some style adjustments).

This commit is contained in:
Oliver Schmidt 2018-08-19 00:01:40 +02:00
parent 250e4ed9e0
commit 3598fb505d
2 changed files with 11 additions and 21 deletions

View File

@ -2,7 +2,7 @@
/* */ /* */
/* stat.h */ /* stat.h */
/* */ /* */
/* Constants for the mode argument of open */ /* Constants for the mode argument of open and creat */
/* */ /* */
/* */ /* */
/* */ /* */
@ -44,10 +44,9 @@
/* Must match the values in src/sim65/paravirt.c */ #define S_IREAD 0x01
#define S_IWRITE 0x02
#define S_IREAD 0x1
#define S_IWRITE 0x2
/*****************************************************************************/ /*****************************************************************************/

View File

@ -36,7 +36,6 @@
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#if defined(_WIN32) #if defined(_WIN32)
# define O_INITIAL O_BINARY # define O_INITIAL O_BINARY
@ -51,18 +50,10 @@
# include <unistd.h> # include <unistd.h>
#endif #endif
#ifndef S_IREAD #ifndef S_IREAD
# ifdef _WIN32 # define S_IREAD S_IRUSR
# define S_IREAD _S_IREAD
# else
# define S_IREAD S_IRUSR
# endif
#endif #endif
#ifndef S_IWRITE #ifndef S_IWRITE
# ifdef _WIN32 # define S_IWRITE S_IWUSR
# define S_IWRITE _S_IWRITE
# else
# define S_IWRITE S_IWUSR
# endif
#endif #endif
/* common */ /* common */
@ -185,18 +176,18 @@ static void PVOpen (CPURegs* Regs)
{ {
char Path[1024]; char Path[1024];
int OFlag = O_INITIAL; int OFlag = O_INITIAL;
int OMode = 0;
unsigned RetVal, I = 0; unsigned RetVal, I = 0;
mode_t OMode = 0;
unsigned Mode = PopParam (Regs->YR - 4); unsigned Mode = PopParam (Regs->YR - 4);
unsigned Flags = PopParam (2); unsigned Flags = PopParam (2);
unsigned Name = PopParam (2); unsigned Name = PopParam (2);
if (Regs->YR - 4 < 2) { if (Regs->YR - 4 < 2) {
/* If the caller did not supply the mode argument, /* If the caller didn't supply the mode
** use a reasonable default. ** argument, use a reasonable default.
*/ */
Mode = 0x1 | 0x2; Mode = 0x01 | 0x02;
} }
do { do {
@ -230,10 +221,10 @@ static void PVOpen (CPURegs* Regs)
OFlag |= O_EXCL; OFlag |= O_EXCL;
} }
if (Mode & 0x1) { if (Mode & 0x01) {
OMode |= S_IREAD; OMode |= S_IREAD;
} }
if (Mode & 0x2) { if (Mode & 0x02) {
OMode |= S_IWRITE; OMode |= S_IWRITE;
} }