]> git.sur5r.net Git - cc65/commitdiff
Fixed Visual C++ build (and some style adjustments).
authorOliver Schmidt <ol.sc@web.de>
Sat, 18 Aug 2018 22:01:40 +0000 (00:01 +0200)
committerOliver Schmidt <ol.sc@web.de>
Sat, 18 Aug 2018 22:01:40 +0000 (00:01 +0200)
include/sys/stat.h
src/sim65/paravirt.c

index ab06401506dedec3acd907295fa5a889e23ac4ff..c7e003808f54e46d63650ac364a60041dcb3e843 100644 (file)
@@ -2,7 +2,7 @@
 /*                                                                           */
 /*                                  stat.h                                   */
 /*                                                                           */
-/*                   Constants for the mode argument of open                 */
+/*              Constants for the mode argument of open and creat            */
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
 
 
 
-/* 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
 
 
 /*****************************************************************************/
index 3e43f26ea930667839f7f0c4e865d822922b89d7..55caeeb9464b7a4a53004c5e0f6fd21287a86828 100644 (file)
@@ -36,7 +36,6 @@
 #include <string.h>
 #include <stdlib.h>
 #include <fcntl.h>
-#include <sys/types.h>
 #include <sys/stat.h>
 #if defined(_WIN32)
 #  define O_INITIAL O_BINARY
 #  include <unistd.h>
 #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;
     }