ObjFW  Check-in [3f522ea4b6]

Overview
Comment:OFLHAArchive: Don't assume method is uncompressed
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | 1.0
Files: files | file ages | folders
SHA3-256: 3f522ea4b60348514143db6e47387759fe51cf9a485b9a632dd82a34552624e8
User & Date: js on 2024-02-23 22:55:56
Other Links: branch diff | manifest | tags
Context
2024-02-23
23:12
OFLHAArchive: Treat directory as uncompressed check-in: f27430148d user: js tags: 1.0
22:55
OFLHAArchive: Don't assume method is uncompressed check-in: 3f522ea4b6 user: js tags: 1.0
22:55
OFLHAArchive: Don't assume method is uncompressed check-in: bf45f06d9b user: js tags: trunk
2024-02-20
01:59
ofarc: Minor help fix check-in: 81cfa33fdf user: js tags: 1.0
Changes

Modified src/OFLHAArchive.m from [653818a552] to [55f03233bb].

33
34
35
36
37
38
39

40
41
42
43
44
45
46

#import "OFChecksumMismatchException.h"
#import "OFInvalidArgumentException.h"
#import "OFNotImplementedException.h"
#import "OFNotOpenException.h"
#import "OFOutOfRangeException.h"
#import "OFTruncatedDataException.h"

#import "OFWriteFailedException.h"

enum {
	modeRead,
	modeWrite,
	modeAppend
};







>







33
34
35
36
37
38
39
40
41
42
43
44
45
46
47

#import "OFChecksumMismatchException.h"
#import "OFInvalidArgumentException.h"
#import "OFNotImplementedException.h"
#import "OFNotOpenException.h"
#import "OFOutOfRangeException.h"
#import "OFTruncatedDataException.h"
#import "OFUnsupportedVersionException.h"
#import "OFWriteFailedException.h"

enum {
	modeRead,
	modeWrite,
	modeAppend
};
315
316
317
318
319
320
321


322

323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
				 distanceBits: 5
			       dictionaryBits: 16];
		else if ([compressionMethod isEqual: @"-lh7-"])
			_decompressedStream = [[OFLHADecompressingStream alloc]
			    of_initWithStream: stream
				 distanceBits: 5
			       dictionaryBits: 17];


		else

			_decompressedStream = [stream retain];

		_entry = [entry copy];
		_toRead = entry.uncompressedSize;
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}

- (void)dealloc
{
	if (_stream != nil || _decompressedStream != nil)
		[self close];

	[_entry release];

	if (_archive->_lastReturnedStream == self)
		_archive->_lastReturnedStream = nil;








>
>

>
|













|







316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
				 distanceBits: 5
			       dictionaryBits: 16];
		else if ([compressionMethod isEqual: @"-lh7-"])
			_decompressedStream = [[OFLHADecompressingStream alloc]
			    of_initWithStream: stream
				 distanceBits: 5
			       dictionaryBits: 17];
		else if ([compressionMethod isEqual: @"-lh0-"])
			_decompressedStream = [stream retain];
		else
			@throw [OFUnsupportedVersionException
			    exceptionWithVersion: compressionMethod];

		_entry = [entry copy];
		_toRead = entry.uncompressedSize;
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}

- (void)dealloc
{
	if (_stream != nil && _decompressedStream != nil)
		[self close];

	[_entry release];

	if (_archive->_lastReturnedStream == self)
		_archive->_lastReturnedStream = nil;