Differences From Artifact [4ff8100249]:
- File src/OFFile.m — part of check-in [c8f7b90082] at 2017-07-22 20:50:27 on branch trunk — Split OFDataArray into OFData and OFMutableData (user: js, size: 11687) [annotate] [blame] [check-ins using]
To Artifact [afef5a8ffe]:
- File
src/OFFile.m
— part of check-in
[23e57c5040]
at
2017-07-22 23:04:35
on branch trunk
— OFFile: Simplify mode
This removes "b" for binary and always uses binary, as there is no good
reason to not use binary. (user: js, size: 11065) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
105 106 107 108 109 110 111 112 113 114 115 | #ifndef OF_MORPHOS static int parseMode(const char *mode) { if (strcmp(mode, "r") == 0) return O_RDONLY; if (strcmp(mode, "w") == 0) return O_WRONLY | O_CREAT | O_TRUNC; if (strcmp(mode, "wx") == 0) return O_WRONLY | O_CREAT | O_EXCL | O_EXLOCK; | > > < < | < < | | | | | < < < < < < < < < < < < | 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | #ifndef OF_MORPHOS static int parseMode(const char *mode) { if (strcmp(mode, "r") == 0) return O_RDONLY; if (strcmp(mode, "r+") == 0) return O_RDWR; if (strcmp(mode, "w") == 0) return O_WRONLY | O_CREAT | O_TRUNC; if (strcmp(mode, "wx") == 0) return O_WRONLY | O_CREAT | O_EXCL | O_EXLOCK; if (strcmp(mode, "w+") == 0) return O_RDWR | O_CREAT | O_TRUNC; if (strcmp(mode, "w+x") == 0) return O_RDWR | O_CREAT | O_EXCL | O_EXLOCK; if (strcmp(mode, "a") == 0) return O_WRONLY | O_CREAT | O_APPEND; if (strcmp(mode, "a+") == 0) return O_RDWR | O_CREAT | O_APPEND; return -1; } #else static int parseMode(const char *mode, bool *append) { |
︙ | ︙ | |||
234 235 236 237 238 239 240 | void *pool = objc_autoreleasePoolPush(); int flags; #ifndef OF_MORPHOS if ((flags = parseMode([mode UTF8String])) == -1) @throw [OFInvalidArgumentException exception]; | | | 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 | void *pool = objc_autoreleasePoolPush(); int flags; #ifndef OF_MORPHOS if ((flags = parseMode([mode UTF8String])) == -1) @throw [OFInvalidArgumentException exception]; flags |= O_BINARY | O_CLOEXEC; # if defined(OF_WINDOWS) if ((handle = _wopen([path UTF16String], flags, _S_IREAD | _S_IWRITE)) == -1) # elif defined(OF_HAVE_OFF64_T) if ((handle = open64([path cStringWithEncoding: [OFLocalization encoding]], flags, 0666)) == -1) |
︙ | ︙ |