ObjFW  Diff

Differences From Artifact [61bec25775]:

To Artifact [434089e7ff]:


17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#import "NSArray_OFArray.h"
#import "OFArray.h"
#import "OFBridging.h"

#import "OFOutOfRangeException.h"

@implementation NSArray_OFArray
- initWithOFArray: (OFArray*)array_
{
	if ((self = [super init]) != nil) {
		@try {
			array = [array_ retain];
		} @catch (id e) {
			return nil;
		}
	}

	return self;
}

- (id)objectAtIndex: (NSUInteger)index
{
	id object = [array objectAtIndex: index];

	if ([object conformsToProtocol: @protocol(OFBridging)])
		return [object NSObject];

	return object;
}

- (NSUInteger)count
{
	size_t count = [array count];

	if (count > NSUIntegerMax)
		@throw [OFOutOfRangeException exceptionWithClass: [self class]];

	return (NSUInteger)count;
}
@end







|



|










|









|







17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#import "NSArray_OFArray.h"
#import "OFArray.h"
#import "OFBridging.h"

#import "OFOutOfRangeException.h"

@implementation NSArray_OFArray
- initWithOFArray: (OFArray*)array
{
	if ((self = [super init]) != nil) {
		@try {
			_array = [array retain];
		} @catch (id e) {
			return nil;
		}
	}

	return self;
}

- (id)objectAtIndex: (NSUInteger)index
{
	id object = [_array objectAtIndex: index];

	if ([object conformsToProtocol: @protocol(OFBridging)])
		return [object NSObject];

	return object;
}

- (NSUInteger)count
{
	size_t count = [_array count];

	if (count > NSUIntegerMax)
		@throw [OFOutOfRangeException exceptionWithClass: [self class]];

	return (NSUInteger)count;
}
@end