Overview
Comment: | OFGZIPStream: Prepare for adding write support |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
ccf8ecbb832bfb0e433c25956d88ee84 |
User & Date: | js on 2017-08-05 17:24:16 |
Other Links: | manifest | tags |
Context
2017-08-05
| ||
17:48 | ofzip: Support for writing files check-in: 41949ecc65 user: js tags: trunk | |
17:24 | OFGZIPStream: Prepare for adding write support check-in: ccf8ecbb83 user: js tags: trunk | |
17:13 | OFGZIPStream: Add missing documentation check-in: e1b882d70b user: js tags: trunk | |
Changes
Modified src/OFGZIPStream.h from [28a3137a76] to [2fcc2d5b92].
︙ | ︙ | |||
80 81 82 83 84 85 86 87 88 | uint32_t _CRC32, _uncompressedSize; } /*! * @brief Creates a new OFGZIPStream with the specified underlying stream. * * @param stream The underlying stream for the OFGZIPStream * @return A new, autoreleased OFGZIPStream */ | > > | > > > | > | 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | uint32_t _CRC32, _uncompressedSize; } /*! * @brief Creates a new OFGZIPStream with the specified underlying stream. * * @param stream The underlying stream for the OFGZIPStream * @param mode The mode for the OFGZIPStream. Valid modes are "r" for reading * and "w" for writing. * @return A new, autoreleased OFGZIPStream */ + (instancetype)streamWithStream: (OFStream *)stream mode: (OFString *)mode; - init OF_UNAVAILABLE; /*! * @brief Initializes an already allocated OFGZIPStream with the specified * underlying stream. * * @param stream The underlying stream for the OFGZIPStream * @param mode The mode for the OFGZIPStream. Valid modes are "r" for reading * and "w" for writing. * @return An initialized OFGZIPStream */ - initWithStream: (OFStream *)stream mode: (OFString *)mode OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END |
Modified src/OFGZIPStream.m from [428c033f1c] to [99b0bbcaa7].
︙ | ︙ | |||
20 21 22 23 24 25 26 27 28 29 30 31 32 | #import "OFInflateStream.h" #import "OFDate.h" #import "crc32.h" #import "OFChecksumFailedException.h" #import "OFInvalidFormatException.h" #import "OFNotOpenException.h" #import "OFTruncatedDataException.h" @implementation OFGZIPStream + (instancetype)streamWithStream: (OFStream *)stream { | > > | > > > > > > > | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | #import "OFInflateStream.h" #import "OFDate.h" #import "crc32.h" #import "OFChecksumFailedException.h" #import "OFInvalidFormatException.h" #import "OFNotImplementedException.h" #import "OFNotOpenException.h" #import "OFTruncatedDataException.h" @implementation OFGZIPStream + (instancetype)streamWithStream: (OFStream *)stream mode: (OFString *)mode { return [[[self alloc] initWithStream: stream mode: mode] autorelease]; } - init { OF_INVALID_INIT_METHOD } - initWithStream: (OFStream *)stream mode: (OFString *)mode { self = [super init]; @try { if (![mode isEqual: @"r"]) @throw [OFNotImplementedException exceptionWithSelector: _cmd object: self]; _stream = [stream retain]; _CRC32 = ~0; } @catch (id e) { [self release]; @throw e; } |
︙ | ︙ |
Modified src/OFZIPArchive.m from [77923608cb] to [1114c696d8].
︙ | ︙ | |||
166 167 168 169 170 171 172 | _stream = [stream retain]; if ([mode isEqual: @"r"]) { _mode = OF_ZIP_ARCHIVE_MODE_READ; [self of_readZIPInfo]; [self of_readEntries]; | > > > > | | 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 | _stream = [stream retain]; if ([mode isEqual: @"r"]) { _mode = OF_ZIP_ARCHIVE_MODE_READ; [self of_readZIPInfo]; [self of_readEntries]; } else if ([mode isEqual: @"w"] || [mode isEqual: @"a"]) @throw [OFNotImplementedException exceptionWithSelector: _cmd object: self]; else @throw [OFInvalidArgumentException exception]; } @catch (id e) { [self release]; @throw e; } return self; |
︙ | ︙ |
Modified utils/ofzip/GZIPArchive.m from [081b9cc60a] to [85573597fb].
︙ | ︙ | |||
51 52 53 54 55 56 57 | } - initWithStream: (OF_KINDOF(OFStream *))stream { self = [super init]; @try { | | > | 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | } - initWithStream: (OF_KINDOF(OFStream *))stream { self = [super init]; @try { _stream = [[OFGZIPStream alloc] initWithStream: stream mode: @"r"]; } @catch (id e) { [self release]; @throw e; } return self; } |
︙ | ︙ |
Modified utils/ofzip/OFZIP.m from [9f9989e04e] to [772087febb].
︙ | ︙ | |||
345 346 347 348 349 350 351 | @try { if ([type isEqual: @"gz"]) archive = [GZIPArchive archiveWithStream: file]; else if ([type isEqual: @"tar"]) archive = [TarArchive archiveWithStream: file]; else if ([type isEqual: @"tgz"]) archive = [TarArchive archiveWithStream: | | > | 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 | @try { if ([type isEqual: @"gz"]) archive = [GZIPArchive archiveWithStream: file]; else if ([type isEqual: @"tar"]) archive = [TarArchive archiveWithStream: file]; else if ([type isEqual: @"tgz"]) archive = [TarArchive archiveWithStream: [OFGZIPStream streamWithStream: file mode: @"r"]]; else if ([type isEqual: @"zip"]) archive = [ZIPArchive archiveWithStream: file]; else { [of_stderr writeLine: OF_LOCALIZED( @"unknown_archive_type", @"Unknown archive type: %[type]", @"type", type)]; |
︙ | ︙ |