ObjFW  Diff

Differences From Artifact [9ab2d4adfc]:

To Artifact [5f63cf2e4a]:


13
14
15
16
17
18
19
20
21
22
23




24
25
26
27
28
29
30

31
32
33
34
35
36
37
13
14
15
16
17
18
19




20
21
22
23
24
25
26
27
28
29

30
31
32
33
34
35
36
37







-
-
-
-
+
+
+
+






-
+







 * file.
 */

#include "config.h"

#include <stdarg.h>

#import "OFAdjacentArray.h"
#import "OFAdjacentSubarray.h"
#import "OFData.h"
#import "OFMutableAdjacentArray.h"
#import "OFConcreteArray.h"
#import "OFConcreteMutableArray.h"
#import "OFConcreteSubarray.h"
#import "OFData.h"
#import "OFString.h"

#import "OFEnumerationMutationException.h"
#import "OFInvalidArgumentException.h"
#import "OFOutOfRangeException.h"

@implementation OFAdjacentArray
@implementation OFConcreteArray
- (instancetype)init
{
	self = [super init];

	@try {
		_array = [[OFMutableData alloc] initWithItemSize: sizeof(id)];
	} @catch (id e) {
229
230
231
232
233
234
235
236

237
238
239
240
241
242
243
244
245
246
247
248
249
250


251
252
253
254
255
256
257
229
230
231
232
233
234
235

236
237
238
239
240
241
242
243
244
245
246
247
248


249
250
251
252
253
254
255
256
257







-
+












-
-
+
+







		@throw [OFOutOfRangeException exception];

	if ([self isKindOfClass: [OFMutableArray class]])
		return [OFArray
		    arrayWithObjects: (id *)_array.items + range.location
			       count: range.length];

	return [[[OFAdjacentSubarray alloc] initWithArray: self
	return [[[OFConcreteSubarray alloc] initWithArray: self
						    range: range] autorelease];
}

- (bool)isEqual: (id)object
{
	OFArray *otherArray;
	id const *objects, *otherObjects;
	size_t count;

	if (object == self)
		return true;

	if (![object isKindOfClass: [OFAdjacentArray class]] &&
	    ![object isKindOfClass: [OFMutableAdjacentArray class]])
	if (![object isKindOfClass: [OFConcreteArray class]] &&
	    ![object isKindOfClass: [OFConcreteMutableArray class]])
		return [super isEqual: object];

	otherArray = object;

	count = _array.count;

	if (count != otherArray.count)