ObjFW  Diff

Differences From Artifact [5b4c2f9e03]:

To Artifact [f2af10f3e4]:

  • File src/OFZIPArchive.m — part of check-in [134a1121c7] at 2016-05-29 13:02:05 on branch trunk — Rename OFInflateStream back to OFDeflateStream

    The reason for renaming to OFInflateStream was to have one stream for
    decompression and one for compression in order to reduce memory usage if
    only one of the two is needed, as the ivar layout will be smaller then.
    However, it is more consistent with other stream classes to have one
    stream that can handle both. The increased memory footprint of having
    ivars for compression and decompression can be solved by having a
    pointer to those instead. This will not incur any performance penalty,
    as the pointer will be dereferenced instead of the ivars, meaning the
    overhead is only getting the pointer from the ivars once. (user: js, size: 13899) [annotate] [blame] [check-ins using]


24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#import "OFDataArray.h"
#import "OFArray.h"
#import "OFDictionary.h"
#import "OFSeekableStream.h"
#ifdef OF_HAVE_FILES
# import "OFFile.h"
#endif
#import "OFInflateStream.h"
#import "OFInflate64Stream.h"

#import "crc32.h"

#import "OFChecksumFailedException.h"
#import "OFInvalidArgumentException.h"
#import "OFInvalidFormatException.h"
#import "OFNotImplementedException.h"







|
|







24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#import "OFDataArray.h"
#import "OFArray.h"
#import "OFDictionary.h"
#import "OFSeekableStream.h"
#ifdef OF_HAVE_FILES
# import "OFFile.h"
#endif
#import "OFDeflateStream.h"
#import "OFDeflate64Stream.h"

#import "crc32.h"

#import "OFChecksumFailedException.h"
#import "OFInvalidArgumentException.h"
#import "OFInvalidFormatException.h"
#import "OFNotImplementedException.h"
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
		_stream = [stream retain];

		switch (localFileHeader->_compressionMethod) {
		case OF_ZIP_ARCHIVE_ENTRY_COMPRESSION_METHOD_NONE:
			_decompressedStream = [stream retain];
			break;
		case OF_ZIP_ARCHIVE_ENTRY_COMPRESSION_METHOD_DEFLATE:
			_decompressedStream = [[OFInflateStream alloc]
			    initWithStream: stream];
			break;
		case OF_ZIP_ARCHIVE_ENTRY_COMPRESSION_METHOD_DEFLATE64:
			_decompressedStream = [[OFInflate64Stream alloc]
			    initWithStream: stream];
			break;
		default:
			@throw [OFNotImplementedException
			    exceptionWithSelector: _cmd
					   object: self];
		}







|



|







467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
		_stream = [stream retain];

		switch (localFileHeader->_compressionMethod) {
		case OF_ZIP_ARCHIVE_ENTRY_COMPRESSION_METHOD_NONE:
			_decompressedStream = [stream retain];
			break;
		case OF_ZIP_ARCHIVE_ENTRY_COMPRESSION_METHOD_DEFLATE:
			_decompressedStream = [[OFDeflateStream alloc]
			    initWithStream: stream];
			break;
		case OF_ZIP_ARCHIVE_ENTRY_COMPRESSION_METHOD_DEFLATE64:
			_decompressedStream = [[OFDeflate64Stream alloc]
			    initWithStream: stream];
			break;
		default:
			@throw [OFNotImplementedException
			    exceptionWithSelector: _cmd
					   object: self];
		}