ObjFW  Check-in [bf45f06d9b]

Overview
Comment:OFLHAArchive: Don't assume method is uncompressed
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: bf45f06d9b25abae2cf541e90fdc560c8e7c516ead89a992bdc1a27dbea6250e
User & Date: js on 2024-02-23 22:55:40
Other Links: manifest | tags
Context
2024-02-23
23:11
OFLHAArchive: Treat directory as uncompressed check-in: 91089d4e47 user: js tags: trunk
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-21
21:36
Document ObjFWTest check-in: 3c55b7ac50 user: js tags: trunk
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;