Overview
Comment: | Remove OFTarArchiveMode from header
It's private anyway. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
e520af4113b6ec3e65ce64757e3f0023 |
User & Date: | js on 2022-11-23 21:50:54 |
Other Links: | manifest | tags |
Context
2022-11-23
| ||
23:33 | OFURI: Accept IRIs check-in: 03cb622525 user: js tags: trunk | |
21:50 | Remove OFTarArchiveMode from header check-in: e520af4113 user: js tags: trunk | |
21:47 | OFLHAArchive: Fix iterating without reading check-in: 4f76840749 user: js tags: trunk | |
Changes
Modified src/OFTarArchive.h from [7f3061b033] to [7277c325d2].
︙ | ︙ | |||
28 29 30 31 32 33 34 | * * @brief A class for accessing and manipulating tar archives. */ OF_SUBCLASSING_RESTRICTED @interface OFTarArchive: OFObject { OFStream *_stream; | < < < < | | 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | * * @brief A class for accessing and manipulating tar archives. */ OF_SUBCLASSING_RESTRICTED @interface OFTarArchive: OFObject { OFStream *_stream; uint_least8_t _mode; OFStringEncoding _encoding; OFTarArchiveEntry *_Nullable _currentEntry; #ifdef OF_TAR_ARCHIVE_M @public #endif OFStream *_Nullable _lastReturnedStream; } |
︙ | ︙ |
Modified src/OFTarArchive.m from [73f1de6b8e] to [734cc4a931].
︙ | ︙ | |||
31 32 33 34 35 36 37 38 39 40 41 42 43 44 | #import "OFInvalidArgumentException.h" #import "OFInvalidFormatException.h" #import "OFNotOpenException.h" #import "OFOutOfRangeException.h" #import "OFTruncatedDataException.h" #import "OFWriteFailedException.h" OF_DIRECT_MEMBERS @interface OFTarArchiveFileReadStream: OFStream <OFReadyForReadingObserving> { OFTarArchive *_archive; OFTarArchiveEntry *_entry; OFStream *_stream; | > > > > > > | 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | #import "OFInvalidArgumentException.h" #import "OFInvalidFormatException.h" #import "OFNotOpenException.h" #import "OFOutOfRangeException.h" #import "OFTruncatedDataException.h" #import "OFWriteFailedException.h" enum { modeRead, modeWrite, modeAppend }; OF_DIRECT_MEMBERS @interface OFTarArchiveFileReadStream: OFStream <OFReadyForReadingObserving> { OFTarArchive *_archive; OFTarArchiveEntry *_entry; OFStream *_stream; |
︙ | ︙ | |||
93 94 95 96 97 98 99 | { self = [super init]; @try { _stream = [stream retain]; if ([mode isEqual: @"r"]) | | | | | | 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | { self = [super init]; @try { _stream = [stream retain]; if ([mode isEqual: @"r"]) _mode = modeRead; else if ([mode isEqual: @"w"]) _mode = modeWrite; else if ([mode isEqual: @"a"]) _mode = modeAppend; else @throw [OFInvalidArgumentException exception]; if (_mode == modeAppend) { uint32_t buffer[1024 / sizeof(uint32_t)]; bool empty = true; if (![_stream isKindOfClass: [OFSeekableStream class]]) @throw [OFInvalidArgumentException exception]; [(OFSeekableStream *)_stream seekToOffset: -1024 |
︙ | ︙ | |||
168 169 170 171 172 173 174 | } - (OFTarArchiveEntry *)nextEntry { uint32_t buffer[512 / sizeof(uint32_t)]; bool empty = true; | | | 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | } - (OFTarArchiveEntry *)nextEntry { uint32_t buffer[512 / sizeof(uint32_t)]; bool empty = true; if (_mode != modeRead) @throw [OFInvalidArgumentException exception]; if (_currentEntry != nil && _lastReturnedStream == nil) { /* * No read stream was created since the last call to * -[nextEntry]. Create it so that we can properly skip the * data. |
︙ | ︙ | |||
223 224 225 226 227 228 229 | encoding: _encoding]; return _currentEntry; } - (OFStream *)streamForReadingCurrentEntry { | | | | 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 | encoding: _encoding]; return _currentEntry; } - (OFStream *)streamForReadingCurrentEntry { if (_mode != modeRead) @throw [OFInvalidArgumentException exception]; if (_currentEntry == nil) @throw [OFInvalidArgumentException exception]; _lastReturnedStream = [[[OFTarArchiveFileReadStream alloc] of_initWithArchive: self stream: _stream entry: _currentEntry] autorelease]; [_currentEntry release]; _currentEntry = nil; return _lastReturnedStream; } - (OFStream *)streamForWritingEntry: (OFTarArchiveEntry *)entry { if (_mode != modeWrite && _mode != modeAppend) @throw [OFInvalidArgumentException exception]; @try { [_lastReturnedStream close]; } @catch (OFNotOpenException *e) { /* Might have already been closed by the user - that's fine. */ } |
︙ | ︙ | |||
273 274 275 276 277 278 279 | @try { [_lastReturnedStream close]; } @catch (OFNotOpenException *e) { /* Might have already been closed by the user - that's fine. */ } _lastReturnedStream = nil; | | | 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 | @try { [_lastReturnedStream close]; } @catch (OFNotOpenException *e) { /* Might have already been closed by the user - that's fine. */ } _lastReturnedStream = nil; if (_mode == modeWrite || _mode == modeAppend) { char buffer[1024]; memset(buffer, '\0', 1024); [_stream writeBuffer: buffer length: 1024]; } [_stream release]; _stream = nil; |
︙ | ︙ |