From 3598fb505d92891de36f3a283f90ab7b013a19c6 Mon Sep 17 00:00:00 2001
From: Oliver Schmidt
Date: Sun, 19 Aug 2018 00:01:40 +0200
Subject: [PATCH] Fixed Visual C++ build (and some style adjustments).
---
include/sys/stat.h | 7 +++----
src/sim65/paravirt.c | 25 ++++++++-----------------
2 files changed, 11 insertions(+), 21 deletions(-)
diff --git a/include/sys/stat.h b/include/sys/stat.h
index ab0640150..c7e003808 100644
--- a/include/sys/stat.h
+++ b/include/sys/stat.h
@@ -2,7 +2,7 @@
/* */
/* 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
/*****************************************************************************/
diff --git a/src/sim65/paravirt.c b/src/sim65/paravirt.c
index 3e43f26ea..55caeeb94 100644
--- a/src/sim65/paravirt.c
+++ b/src/sim65/paravirt.c
@@ -36,7 +36,6 @@
#include
#include
#include
-#include
#include
#if defined(_WIN32)
# define O_INITIAL O_BINARY
@@ -51,18 +50,10 @@
# include
#endif
#ifndef S_IREAD
-# ifdef _WIN32
-# define S_IREAD _S_IREAD
-# else
-# define S_IREAD S_IRUSR
-# endif
+# define S_IREAD S_IRUSR
#endif
#ifndef S_IWRITE
-# ifdef _WIN32
-# define S_IWRITE _S_IWRITE
-# else
-# define S_IWRITE S_IWUSR
-# endif
+# define S_IWRITE S_IWUSR
#endif
/* common */
@@ -185,18 +176,18 @@ static void PVOpen (CPURegs* Regs)
{
char Path[1024];
int OFlag = O_INITIAL;
+ int OMode = 0;
unsigned RetVal, I = 0;
- mode_t OMode = 0;
unsigned Mode = PopParam (Regs->YR - 4);
unsigned Flags = PopParam (2);
unsigned Name = PopParam (2);
if (Regs->YR - 4 < 2) {
- /* If the caller did not supply the mode argument,
- ** use a reasonable default.
+ /* If the caller didn't supply the mode
+ ** argument, use a reasonable default.
*/
- Mode = 0x1 | 0x2;
+ Mode = 0x01 | 0x02;
}
do {
@@ -230,10 +221,10 @@ static void PVOpen (CPURegs* Regs)
OFlag |= O_EXCL;
}
- if (Mode & 0x1) {
+ if (Mode & 0x01) {
OMode |= S_IREAD;
}
- if (Mode & 0x2) {
+ if (Mode & 0x02) {
OMode |= S_IWRITE;
}
--
2.39.5