ObjFW  Diff

Differences From Artifact [5a61b65e4b]:

To Artifact [90c0fe7151]:


19
20
21
22
23
24
25
26
27

28
29
30
31
32
33
34
35
19
20
21
22
23
24
25


26

27
28
29
30
31
32
33







-
-
+
-








#import "OFTarArchive.h"
#import "OFTarArchiveEntry.h"
#import "OFTarArchiveEntry+Private.h"
#import "OFDate.h"
#import "OFSeekableStream.h"
#import "OFStream.h"
#ifdef OF_HAVE_FILES
# import "OFFile.h"
#import "OFURLHandler.h"
#endif

#import "OFInvalidArgumentException.h"
#import "OFInvalidFormatException.h"
#import "OFNotOpenException.h"
#import "OFOutOfRangeException.h"
#import "OFTruncatedDataException.h"
#import "OFWriteFailedException.h"
64
65
66
67
68
69
70
71
72

73
74

75
76
77
78
79
80
81
82
83
62
63
64
65
66
67
68


69
70

71
72

73
74
75
76
77
78
79







-
-
+

-
+

-







@synthesize encoding = _encoding;

+ (instancetype)archiveWithStream: (OFStream *)stream mode: (OFString *)mode
{
	return [[[self alloc] initWithStream: stream mode: mode] autorelease];
}

#ifdef OF_HAVE_FILES
+ (instancetype)archiveWithPath: (OFString *)path mode: (OFString *)mode
+ (instancetype)archiveWithURL: (OFURL *)URL mode: (OFString *)mode
{
	return [[[self alloc] initWithPath: path mode: mode] autorelease];
	return [[[self alloc] initWithURL: URL mode: mode] autorelease];
}
#endif

- (instancetype)init
{
	OF_INVALID_INIT_METHOD
}

- (instancetype)initWithStream: (OFStream *)stream mode: (OFString *)mode
123
124
125
126
127
128
129
130
131

132

133

134

135
136
137



138
139
140
141







142
143
144


145
146
147
148
149
150
151
152
153
154
155
119
120
121
122
123
124
125


126
127
128

129
130
131



132
133
134




135
136
137
138
139
140
141



142
143
144
145
146

147
148
149
150
151
152
153







-
-
+

+
-
+

+
-
-
-
+
+
+
-
-
-
-
+
+
+
+
+
+
+
-
-
-
+
+



-







		[self release];
		@throw e;
	}

	return self;
}

#ifdef OF_HAVE_FILES
- (instancetype)initWithPath: (OFString *)path mode: (OFString *)mode
- (instancetype)initWithURL: (OFURL *)URL mode: (OFString *)mode
{
	void *pool = objc_autoreleasePoolPush();
	OFFile *file;
	OFStream *stream;

	@try {
	if ([mode isEqual: @"a"])
		file = [[OFFile alloc] initWithPath: path mode: @"r+"];
	else
		if ([mode isEqual: @"a"])
			stream = [OFURLHandler openItemAtURL: URL mode: @"r+"];
		else
		file = [[OFFile alloc] initWithPath: path mode: mode];

	@try {
		self = [self initWithStream: file mode: mode];
			stream = [OFURLHandler openItemAtURL: URL mode: mode];
	} @catch (id e) {
		[self release];
		@throw e;
	}

	self = [self initWithStream: stream mode: mode];
	} @finally {
		[file release];
	}

	objc_autoreleasePoolPop(pool);

	return self;
}
#endif

- (void)dealloc
{
	[self close];

	[super dealloc];
}