ObjFW  Check-in [a22b485eaf]

Overview
Comment:OFZooArchive: Throw exception for mode `w` / `a`
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: a22b485eaf8674213c63f73d6a3769a1a438d8f634021230f76ae1e407b87ffe
User & Date: js on 2024-02-28 20:27:08
Other Links: manifest | tags
Context
2024-02-28
22:34
OFZooArchiveEntry: Support for long file names check-in: 88c236e709 user: js tags: trunk
20:27
OFZooArchive: Throw exception for mode `w` / `a` check-in: a22b485eaf user: js tags: trunk
20:13
ofarc: Add support for Zoo archives check-in: aaf991863a user: js tags: trunk
Changes

Modified src/OFZooArchive.m from [8c6fa7786c] to [648d8f6c0c].

28
29
30
31
32
33
34

35
36
37
38
39
40
41
#import "OFSeekableStream.h"
#import "OFStream.h"
#import "OFString.h"

#import "OFChecksumMismatchException.h"
#import "OFInvalidArgumentException.h"
#import "OFInvalidFormatException.h"

#import "OFNotOpenException.h"
#import "OFTruncatedDataException.h"
#import "OFUnsupportedVersionException.h"

enum {
	modeRead
};







>







28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#import "OFSeekableStream.h"
#import "OFStream.h"
#import "OFString.h"

#import "OFChecksumMismatchException.h"
#import "OFInvalidArgumentException.h"
#import "OFInvalidFormatException.h"
#import "OFNotImplementedException.h"
#import "OFNotOpenException.h"
#import "OFTruncatedDataException.h"
#import "OFUnsupportedVersionException.h"

enum {
	modeRead
};
83
84
85
86
87
88
89




90
91
92
93
94
95
96
- (instancetype)initWithStream: (OFStream *)stream mode: (OFString *)mode
{
	self = [super init];

	@try {
		if ([mode isEqual: @"r"])
			_mode = modeRead;




		else
			@throw [OFInvalidArgumentException exception];

		_stream = [stream retain];
		_encoding = OFStringEncodingUTF8;

		if (_mode == modeRead) {







>
>
>
>







84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
- (instancetype)initWithStream: (OFStream *)stream mode: (OFString *)mode
{
	self = [super init];

	@try {
		if ([mode isEqual: @"r"])
			_mode = modeRead;
		else if ([mode isEqual: @"w"] || [mode isEqual: @"a"])
			@throw [OFNotImplementedException
			    exceptionWithSelector: _cmd
					   object: nil];
		else
			@throw [OFInvalidArgumentException exception];

		_stream = [stream retain];
		_encoding = OFStringEncodingUTF8;

		if (_mode == modeRead) {