Comment: | OFFile: Simplify mode
This removes "b" for binary and always uses binary, as there is no good |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
23e57c50408c2d3f080d3c4a18047585 |
User & Date: | js on 2017-07-22 23:04:35 |
Other Links: | manifest | tags |
2017-07-23
| ||
17:55 | Add +[OFString stringWithData:encoding:] check-in: 9aacc26542 user: js tags: trunk | |
2017-07-22
| ||
23:04 | OFFile: Simplify mode check-in: 23e57c5040 user: js tags: trunk | |
20:50 | Split OFDataArray into OFData and OFMutableData check-in: c8f7b90082 user: js tags: trunk | |
Modified generators/TableGenerator.m from [e7bcb6d1cb] to [c7bfffe23c].
︙ | ︙ | |||
261 262 263 264 265 266 267 | } while (!done); } - (void)writeTablesToFile: (OFString *)path { void *pool = objc_autoreleasePoolPush(); OFFile *file = [OFFile fileWithPath: path | | | 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 | } while (!done); } - (void)writeTablesToFile: (OFString *)path { void *pool = objc_autoreleasePoolPush(); OFFile *file = [OFFile fileWithPath: path mode: @"w"]; [file writeString: COPYRIGHT @"#include \"config.h\"\n" @"\n" @"#import \"OFString.h\"\n\n" @"static const of_unichar_t emptyPage[0x100] = { 0 };\n" @"static const char *emptyDecompositionPage[0x100] = { NULL };\n" |
︙ | ︙ | |||
707 708 709 710 711 712 713 | objc_autoreleasePoolPop(pool); } - (void)writeHeaderToFile: (OFString *)path { void *pool = objc_autoreleasePoolPush(); OFFile *file = [OFFile fileWithPath: path | | | 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 | objc_autoreleasePoolPop(pool); } - (void)writeHeaderToFile: (OFString *)path { void *pool = objc_autoreleasePoolPush(); OFFile *file = [OFFile fileWithPath: path mode: @"w"]; [file writeString: COPYRIGHT @"#import \"OFString.h\"\n\n"]; [file writeString: [OFString stringWithFormat: @"#define OF_UNICODE_UPPERCASE_TABLE_SIZE 0x%X\n" @"#define OF_UNICODE_LOWERCASE_TABLE_SIZE 0x%X\n" |
︙ | ︙ |
Modified src/OFApplication.m from [970d1b40a3] to [c9d4f7d315].
︙ | ︙ | |||
286 287 288 289 290 291 292 | path = [@"ENV:" stringByAppendingString: name]; if ([fileManager directoryExistsAtPath: path]) continue; file = [OFFile fileWithPath: path | | | 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 | path = [@"ENV:" stringByAppendingString: name]; if ([fileManager directoryExistsAtPath: path]) continue; file = [OFFile fileWithPath: path mode: @"r"]; value = [file readLineWithEncoding: encoding]; if (value != nil) [_environment setObject: value forKey: name]; objc_autoreleasePoolPop(pool2); |
︙ | ︙ |
Modified src/OFData.m from [e5c693e728] to [504d17c5e3].
︙ | ︙ | |||
212 213 214 215 216 217 218 | buffer = malloc(size); if (buffer == NULL) @throw [OFOutOfMemoryException exceptionWithRequestedSize: size]; @try { OFFile *file = [[OFFile alloc] initWithPath: path | | | 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 | buffer = malloc(size); if (buffer == NULL) @throw [OFOutOfMemoryException exceptionWithRequestedSize: size]; @try { OFFile *file = [[OFFile alloc] initWithPath: path mode: @"r"]; @try { [file readIntoBuffer: buffer exactLength: size]; } @finally { [file release]; } |
︙ | ︙ | |||
590 591 592 593 594 595 596 | return of_base64_encode(_items, _count * _itemSize); } #ifdef OF_HAVE_FILES - (void)writeToFile: (OFString *)path { OFFile *file = [[OFFile alloc] initWithPath: path | | | 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 | return of_base64_encode(_items, _count * _itemSize); } #ifdef OF_HAVE_FILES - (void)writeToFile: (OFString *)path { OFFile *file = [[OFFile alloc] initWithPath: path mode: @"w"]; @try { [file writeBuffer: _items length: _count * _itemSize]; } @finally { [file release]; } |
︙ | ︙ |
Modified src/OFFile.h from [d0fae452f5] to [cba6c42a3b].
︙ | ︙ | |||
45 46 47 48 49 50 51 | * @brief Creates a new OFFile with the specified path and mode. * * @param path The path to the file to open as a string * @param mode The mode in which the file should be opened.@n * Possible modes are: * Mode | Description * ---------------|------------------------------------- | | < | < | | | | | < | < | 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | * @brief Creates a new OFFile with the specified path and mode. * * @param path The path to the file to open as a string * @param mode The mode in which the file should be opened.@n * Possible modes are: * Mode | Description * ---------------|------------------------------------- * `r` | Read-only * `r+` | Read-write * `w` | Write-only, create or truncate * `wx` | Write-only, create or fail, exclusive * `w+` | Read-write, create or truncate * `w+x` | Read-write, create or fail, exclusive * `a` | Write-only, create or append * `a+` | Read-write, create or append * @return A new autoreleased OFFile */ + (instancetype)fileWithPath: (OFString *)path mode: (OFString *)mode; /*! * @brief Creates a new OFFile with the specified native file handle. |
︙ | ︙ |
Modified src/OFFile.m from [4ff8100249] to [afef5a8ffe].
︙ | ︙ | |||
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) |
︙ | ︙ |
Modified src/OFFileManager.m from [0f38891013] to [7bb3d63d81].
︙ | ︙ | |||
925 926 927 928 929 930 931 | if ((buffer = malloc(pageSize)) == NULL) @throw [OFOutOfMemoryException exceptionWithRequestedSize: pageSize]; @try { sourceFile = [OFFile fileWithPath: source | | | | 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 | if ((buffer = malloc(pageSize)) == NULL) @throw [OFOutOfMemoryException exceptionWithRequestedSize: pageSize]; @try { sourceFile = [OFFile fileWithPath: source mode: @"r"]; destinationFile = [OFFile fileWithPath: destination mode: @"w"]; while (![sourceFile isAtEndOfStream]) { size_t length; length = [sourceFile readIntoBuffer: buffer length: pageSize]; [destinationFile writeBuffer: buffer |
︙ | ︙ |
Modified src/OFString.m from [27f6116ecb] to [18c9b8230b].
︙ | ︙ | |||
962 963 964 965 966 967 968 | @try { fileSize = [[OFFileManager defaultManager] sizeOfFileAtPath: path]; } @catch (OFStatItemFailedException *e) { @throw [OFOpenItemFailedException exceptionWithPath: path | | | | 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 | @try { fileSize = [[OFFileManager defaultManager] sizeOfFileAtPath: path]; } @catch (OFStatItemFailedException *e) { @throw [OFOpenItemFailedException exceptionWithPath: path mode: @"r" errNo: errno]; } if (sizeof(of_offset_t) > sizeof(size_t) && fileSize > (of_offset_t)SIZE_MAX) @throw [OFOutOfRangeException exception]; file = [[OFFile alloc] initWithPath: path mode: @"r"]; @try { tmp = [self allocMemoryWithSize: (size_t)fileSize]; [file readIntoBuffer: tmp exactLength: (size_t)fileSize]; } @finally { |
︙ | ︙ | |||
2764 2765 2766 2767 2768 2769 2770 | - (void)writeToFile: (OFString *)path encoding: (of_string_encoding_t)encoding { void *pool = objc_autoreleasePoolPush(); OFFile *file; file = [OFFile fileWithPath: path | | | 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 | - (void)writeToFile: (OFString *)path encoding: (of_string_encoding_t)encoding { void *pool = objc_autoreleasePoolPush(); OFFile *file; file = [OFFile fileWithPath: path mode: @"w"]; [file writeString: self encoding: encoding]; objc_autoreleasePoolPop(pool); } #endif |
︙ | ︙ |
Modified src/OFTarArchive.m from [cd4c802a1e] to [4c3a4649ab].
︙ | ︙ | |||
48 49 50 51 52 53 54 | return self; } #ifdef OF_HAVE_FILES - initWithPath: (OFString *)path { OFFile *file = [[OFFile alloc] initWithPath: path | | | 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | return self; } #ifdef OF_HAVE_FILES - initWithPath: (OFString *)path { OFFile *file = [[OFFile alloc] initWithPath: path mode: @"r"]; @try { self = [self initWithStream: file]; } @finally { [file release]; } return self; |
︙ | ︙ |
Modified src/OFXMLParser.m from [dec1e593aa] to [913f851c54].
︙ | ︙ | |||
278 279 280 281 282 283 284 | } } #ifdef OF_HAVE_FILES - (void)parseFile: (OFString *)path { OFFile *file = [[OFFile alloc] initWithPath: path | | | 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 | } } #ifdef OF_HAVE_FILES - (void)parseFile: (OFString *)path { OFFile *file = [[OFFile alloc] initWithPath: path mode: @"r"]; @try { [self parseStream: file]; } @finally { [file release]; } } #endif |
︙ | ︙ |
Modified src/OFZIPArchive.m from [4d9edd8589] to [8c3891b987].
︙ | ︙ | |||
170 171 172 173 174 175 176 | return self; } #ifdef OF_HAVE_FILES - initWithPath: (OFString *)path { OFFile *file = [[OFFile alloc] initWithPath: path | | | 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 | return self; } #ifdef OF_HAVE_FILES - initWithPath: (OFString *)path { OFFile *file = [[OFFile alloc] initWithPath: path mode: @"r"]; @try { self = [self initWithSeekableStream: file]; } @finally { [file release]; } return self; |
︙ | ︙ | |||
327 328 329 330 331 332 333 | void *pool = objc_autoreleasePoolPush(); OFZIPArchiveEntry *entry = [_pathToEntryMap objectForKey: path]; OFZIPArchive_LocalFileHeader *localFileHeader; int64_t offset64; if (entry == nil) @throw [OFOpenItemFailedException exceptionWithPath: path | | | 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 | void *pool = objc_autoreleasePoolPush(); OFZIPArchiveEntry *entry = [_pathToEntryMap objectForKey: path]; OFZIPArchive_LocalFileHeader *localFileHeader; int64_t offset64; if (entry == nil) @throw [OFOpenItemFailedException exceptionWithPath: path mode: @"r" errNo: ENOENT]; [_lastReturnedStream close]; [_lastReturnedStream release]; _lastReturnedStream = nil; offset64 = [entry of_localFileHeaderOffset]; |
︙ | ︙ |
Modified tests/OFHMACTests.m from [b990fbedbe] to [2d71e6059d].
︙ | ︙ | |||
63 64 65 66 67 68 69 | "\xB7\xE8\x87\xC1\x73\x19\x63\xF6\xA2\x91\x8D\x7E\x2E\xCC\xEC\x99"; @implementation TestsAppDelegate (OFHMACTests) - (void)HMACTests { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFFile *f = [OFFile fileWithPath: @"testfile.bin" | | | 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | "\xB7\xE8\x87\xC1\x73\x19\x63\xF6\xA2\x91\x8D\x7E\x2E\xCC\xEC\x99"; @implementation TestsAppDelegate (OFHMACTests) - (void)HMACTests { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFFile *f = [OFFile fileWithPath: @"testfile.bin" mode: @"r"]; OFHMAC *HMAC_MD5, *HMAC_SHA1, *HMAC_RMD160; OFHMAC *HMAC_SHA256, *HMAC_SHA384, *HMAC_SHA512; TEST(@"+[HMACWithHashClass:] with MD5", (HMAC_MD5 = [OFHMAC HMACWithHashClass: [OFMD5Hash class]])) TEST(@"+[HMACWithHashClass:] with SHA-1", (HMAC_SHA1 = [OFHMAC HMACWithHashClass: [OFSHA1Hash class]])) |
︙ | ︙ |
Modified tests/OFMD5HashTests.m from [44be095d7c] to [6a07431a3b].
︙ | ︙ | |||
34 35 36 37 38 39 40 | @implementation TestsAppDelegate (OFMD5HashTests) - (void)MD5HashTests { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFMD5Hash *md5, *copy; OFFile *f = [OFFile fileWithPath: @"testfile.bin" | | | 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | @implementation TestsAppDelegate (OFMD5HashTests) - (void)MD5HashTests { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFMD5Hash *md5, *copy; OFFile *f = [OFFile fileWithPath: @"testfile.bin" mode: @"r"]; TEST(@"+[cryptoHash]", (md5 = [OFMD5Hash cryptoHash])) while (![f isAtEndOfStream]) { char buf[64]; size_t len = [f readIntoBuffer: buf length: 64]; |
︙ | ︙ |
Modified tests/OFRIPEMD160HashTests.m from [ae86eb7cb3] to [7335aa3290].
︙ | ︙ | |||
35 36 37 38 39 40 41 | @implementation TestsAppDelegate (OFRIPEMD160HashTests) - (void)RIPEMD160HashTests { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFRIPEMD160Hash *rmd160, *copy; OFFile *f = [OFFile fileWithPath: @"testfile.bin" | | | 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | @implementation TestsAppDelegate (OFRIPEMD160HashTests) - (void)RIPEMD160HashTests { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFRIPEMD160Hash *rmd160, *copy; OFFile *f = [OFFile fileWithPath: @"testfile.bin" mode: @"r"]; TEST(@"+[cryptoHash]", (rmd160 = [OFRIPEMD160Hash cryptoHash])) while (![f isAtEndOfStream]) { char buf[64]; size_t len = [f readIntoBuffer: buf length: 64]; |
︙ | ︙ |
Modified tests/OFSHA1HashTests.m from [33eb237c28] to [9caa66a935].
︙ | ︙ | |||
35 36 37 38 39 40 41 | @implementation TestsAppDelegate (SHA1HashTests) - (void)SHA1HashTests { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFSHA1Hash *sha1, *copy; OFFile *f = [OFFile fileWithPath: @"testfile.bin" | | | 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | @implementation TestsAppDelegate (SHA1HashTests) - (void)SHA1HashTests { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFSHA1Hash *sha1, *copy; OFFile *f = [OFFile fileWithPath: @"testfile.bin" mode: @"r"]; TEST(@"+[cryptoHash]", (sha1 = [OFSHA1Hash cryptoHash])) while (![f isAtEndOfStream]) { char buf[64]; size_t len = [f readIntoBuffer: buf length: 64]; |
︙ | ︙ |
Modified tests/OFSHA224HashTests.m from [f315d21aac] to [1ea77887a2].
︙ | ︙ | |||
35 36 37 38 39 40 41 | @implementation TestsAppDelegate (SHA224HashTests) - (void)SHA224HashTests { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFSHA224Hash *sha224, *copy; OFFile *f = [OFFile fileWithPath: @"testfile.bin" | | | 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | @implementation TestsAppDelegate (SHA224HashTests) - (void)SHA224HashTests { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFSHA224Hash *sha224, *copy; OFFile *f = [OFFile fileWithPath: @"testfile.bin" mode: @"r"]; TEST(@"+[cryptoHash]", (sha224 = [OFSHA224Hash cryptoHash])) while (![f isAtEndOfStream]) { char buf[64]; size_t len = [f readIntoBuffer: buf length: 64]; |
︙ | ︙ |
Modified tests/OFSHA256HashTests.m from [28da22207c] to [9d7a9504e6].
︙ | ︙ | |||
35 36 37 38 39 40 41 | @implementation TestsAppDelegate (SHA256HashTests) - (void)SHA256HashTests { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFSHA256Hash *sha256, *copy; OFFile *f = [OFFile fileWithPath: @"testfile.bin" | | | 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | @implementation TestsAppDelegate (SHA256HashTests) - (void)SHA256HashTests { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFSHA256Hash *sha256, *copy; OFFile *f = [OFFile fileWithPath: @"testfile.bin" mode: @"r"]; TEST(@"+[cryptoHash]", (sha256 = [OFSHA256Hash cryptoHash])) while (![f isAtEndOfStream]) { char buf[64]; size_t len = [f readIntoBuffer: buf length: 64]; |
︙ | ︙ |
Modified tests/OFSHA384HashTests.m from [1e9c862681] to [51fe039320].
︙ | ︙ | |||
36 37 38 39 40 41 42 | @implementation TestsAppDelegate (SHA384HashTests) - (void)SHA384HashTests { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFSHA384Hash *sha384, *copy; OFFile *f = [OFFile fileWithPath: @"testfile.bin" | | | 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | @implementation TestsAppDelegate (SHA384HashTests) - (void)SHA384HashTests { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFSHA384Hash *sha384, *copy; OFFile *f = [OFFile fileWithPath: @"testfile.bin" mode: @"r"]; TEST(@"+[cryptoHash]", (sha384 = [OFSHA384Hash cryptoHash])) while (![f isAtEndOfStream]) { char buf[128]; size_t len = [f readIntoBuffer: buf length: 128]; |
︙ | ︙ |
Modified tests/OFSHA512HashTests.m from [b5613ecdbe] to [d40dd0e7b4].
︙ | ︙ | |||
37 38 39 40 41 42 43 | @implementation TestsAppDelegate (SHA512HashTests) - (void)SHA512HashTests { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFSHA512Hash *sha512, *copy; OFFile *f = [OFFile fileWithPath: @"testfile.bin" | | | 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | @implementation TestsAppDelegate (SHA512HashTests) - (void)SHA512HashTests { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFSHA512Hash *sha512, *copy; OFFile *f = [OFFile fileWithPath: @"testfile.bin" mode: @"r"]; TEST(@"+[cryptoHash]", (sha512 = [OFSHA512Hash cryptoHash])) while (![f isAtEndOfStream]) { char buf[128]; size_t len = [f readIntoBuffer: buf length: 128]; |
︙ | ︙ |
Modified utils/ofhash/OFHash.m from [7cde93b02a] to [8ba8298b95].
︙ | ︙ | |||
116 117 118 119 120 121 122 | pool = objc_autoreleasePoolPush(); if ([path isEqual: @"-"]) file = of_stdin; else { @try { file = [OFFile fileWithPath: path | | | 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | pool = objc_autoreleasePoolPush(); if ([path isEqual: @"-"]) file = of_stdin; else { @try { file = [OFFile fileWithPath: path mode: @"r"]; } @catch (OFOpenItemFailedException *e) { OFString *error = [OFString stringWithCString: strerror([e errNo]) encoding: [OFLocalization encoding]]; [of_stderr writeLine: OF_LOCALIZED( |
︙ | ︙ |
Modified utils/ofhttp/OFHTTP.m from [1f66bff7ec] to [492c8ebbc8].
︙ | ︙ | |||
881 882 883 884 885 886 887 | _errorCode = 1; goto next; } @try { OFString *mode = | | | 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 | _errorCode = 1; goto next; } @try { OFString *mode = ([response statusCode] == 206 ? @"a" : @"w"); _output = [[OFFile alloc] initWithPath: fileName mode: mode]; } @catch (OFOpenItemFailedException *e) { [of_stderr writeLine: OF_LOCALIZED(@"failed_to_open_output", @"%[prog]: Failed to open file %[filename]: " @"%[exception]", |
︙ | ︙ |
Modified utils/ofzip/GZIPArchive.m from [d96ec8b8b5] to [081b9cc60a].
︙ | ︙ | |||
100 101 102 103 104 105 106 | @"file", fileName)]; if (![app shouldExtractFile: fileName outFileName: fileName]) return; output = [OFFile fileWithPath: fileName | | | 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | @"file", fileName)]; if (![app shouldExtractFile: fileName outFileName: fileName]) return; output = [OFFile fileWithPath: fileName mode: @"w"]; setPermissions(fileName, app->_archivePath); while (![_stream isAtEndOfStream]) { ssize_t length = [app copyBlockFromStream: _stream toStream: output fileName: fileName]; |
︙ | ︙ |
Modified utils/ofzip/OFZIP.m from [95a3ff60d9] to [9f9989e04e].
︙ | ︙ | |||
311 312 313 314 315 316 317 | _archivePath = [path copy]; if (path == nil) return nil; @try { file = [OFFile fileWithPath: path | | | 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 | _archivePath = [path copy]; if (path == nil) return nil; @try { file = [OFFile fileWithPath: path mode: @"r"]; } @catch (OFOpenItemFailedException *e) { OFString *error = [OFString stringWithCString: strerror([e errNo]) encoding: [OFLocalization encoding]]; [of_stderr writeString: @"\r"]; [of_stderr writeLine: OF_LOCALIZED( @"failed_to_open_file", |
︙ | ︙ |
Modified utils/ofzip/TarArchive.m from [65e143b64c] to [7ed0f15d3e].
︙ | ︙ | |||
311 312 313 314 315 316 317 | createParents: true]; if (![app shouldExtractFile: fileName outFileName: outFileName]) goto outer_loop_end; output = [OFFile fileWithPath: outFileName | | | 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 | createParents: true]; if (![app shouldExtractFile: fileName outFileName: outFileName]) goto outer_loop_end; output = [OFFile fileWithPath: outFileName mode: @"w"]; setPermissions(outFileName, entry); while (![entry isAtEndOfStream]) { ssize_t length = [app copyBlockFromStream: entry toStream: output fileName: fileName]; |
︙ | ︙ |
Modified utils/ofzip/ZIPArchive.m from [8441a7f8cf] to [15729aa028].
︙ | ︙ | |||
264 265 266 267 268 269 270 | if (![app shouldExtractFile: fileName outFileName: outFileName]) goto outer_loop_end; stream = [_archive streamForReadingFile: fileName]; output = [OFFile fileWithPath: outFileName | | | 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 | if (![app shouldExtractFile: fileName outFileName: outFileName]) goto outer_loop_end; stream = [_archive streamForReadingFile: fileName]; output = [OFFile fileWithPath: outFileName mode: @"w"]; setPermissions(outFileName, entry); while (![stream isAtEndOfStream]) { ssize_t length = [app copyBlockFromStream: stream toStream: output fileName: fileName]; |
︙ | ︙ |