Differences From Artifact [8c3891b987]:
- File
src/OFZIPArchive.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: 13822) [annotate] [blame] [check-ins using]
To Artifact [c549fb1fd1]:
- File src/OFZIPArchive.m — part of check-in [22a6ad346c] at 2017-08-02 20:04:10 on branch trunk — OFZIPArchive: Prepare for adding write support (user: js, size: 14303) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
133 134 135 136 137 138 139 140 | } } @implementation OFZIPArchive @synthesize archiveComment = _archiveComment; + (instancetype)archiveWithSeekableStream: (OFSeekableStream *)stream { | > | > > | > > > > > | | > > > | | > | 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | } } @implementation OFZIPArchive @synthesize archiveComment = _archiveComment; + (instancetype)archiveWithSeekableStream: (OFSeekableStream *)stream mode: (OFString *)mode { return [[[self alloc] initWithSeekableStream: stream mode: mode] autorelease]; } #ifdef OF_HAVE_FILES + (instancetype)archiveWithPath: (OFString *)path mode: (OFString *)mode { return [[[self alloc] initWithPath: path mode: mode] autorelease]; } #endif - init { OF_INVALID_INIT_METHOD } - initWithSeekableStream: (OFSeekableStream *)stream mode: (OFString *)mode { self = [super init]; @try { _stream = [stream retain]; if ([mode isEqual: @"r"]) { _mode = OF_ZIP_ARCHIVE_MODE_READ; [self of_readZIPInfo]; [self of_readEntries]; } else @throw [OFInvalidArgumentException exception]; } @catch (id e) { [self release]; @throw e; } return self; } #ifdef OF_HAVE_FILES - initWithPath: (OFString *)path mode: (OFString *)mode { OFFile *file = [[OFFile alloc] initWithPath: path mode: mode]; @try { self = [self initWithSeekableStream: file mode: mode]; } @finally { [file release]; } return self; } #endif |
︙ | ︙ | |||
325 326 327 328 329 330 331 | - (OFStream *)streamForReadingFile: (OFString *)path { void *pool = objc_autoreleasePoolPush(); OFZIPArchiveEntry *entry = [_pathToEntryMap objectForKey: path]; OFZIPArchive_LocalFileHeader *localFileHeader; int64_t offset64; | > > > | > | 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 | - (OFStream *)streamForReadingFile: (OFString *)path { void *pool = objc_autoreleasePoolPush(); OFZIPArchiveEntry *entry = [_pathToEntryMap objectForKey: path]; OFZIPArchive_LocalFileHeader *localFileHeader; int64_t offset64; if (_mode != OF_ZIP_ARCHIVE_MODE_READ && _mode != OF_ZIP_ARCHIVE_MODE_APPEND) @throw [OFInvalidArgumentException exception]; if ((entry = [_pathToEntryMap objectForKey: path]) == nil) @throw [OFOpenItemFailedException exceptionWithPath: path mode: @"r" errNo: ENOENT]; [_lastReturnedStream close]; [_lastReturnedStream release]; _lastReturnedStream = nil; |
︙ | ︙ |