ObjFW  Diff

Differences From Artifact [77e6be7acc]:

To Artifact [0cdeecac33]:

  • File src/OFArray_subarray.m — part of check-in [e1e7ffa903] at 2011-09-22 23:25:42 on branch trunk — Exceptions are now autoreleased.

    This is safe as an "exception loop" can't happen, since if allocating
    an exception fails, it throws an OFAllocFailedException which is
    preallocated and can always be thrown.

    So, the worst case would be that an autorelease of an exception fails,
    triggering an OFOutOfMemoryException for which there is no memory,
    resulting in an OFAllocFailedException to be thrown. (user: js, size: 2366) [annotate] [blame] [check-ins using]


56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
{
	return range.length;
}

- (id)objectAtIndex: (size_t)index
{
	if (index >= range.length)
		@throw [OFOutOfRangeException newWithClass: isa];

	return [array objectAtIndex: index + range.start];
}

- (void)getObjects: (id*)buffer
	   inRange: (of_range_t)range_
{
	if (range_.start + range_.length > range.length)
		@throw [OFOutOfRangeException newWithClass: isa];

	range_.start += range.start;

	return [array getObjects: buffer
			 inRange: range_];
}








|








|







56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
{
	return range.length;
}

- (id)objectAtIndex: (size_t)index
{
	if (index >= range.length)
		@throw [OFOutOfRangeException exceptionWithClass: isa];

	return [array objectAtIndex: index + range.start];
}

- (void)getObjects: (id*)buffer
	   inRange: (of_range_t)range_
{
	if (range_.start + range_.length > range.length)
		@throw [OFOutOfRangeException exceptionWithClass: isa];

	range_.start += range.start;

	return [array getObjects: buffer
			 inRange: range_];
}

106
107
108
109
110
111
112
113
114
115
116
117
118
119

	return index;
}

- (OFArray*)objectsInRange: (of_range_t)range_
{
	if (range_.start + range_.length > range.length)
		@throw [OFOutOfRangeException newWithClass: isa];

	range_.start += range.start;

	return [array objectsInRange: range_];
}
@end







|






106
107
108
109
110
111
112
113
114
115
116
117
118
119

	return index;
}

- (OFArray*)objectsInRange: (of_range_t)range_
{
	if (range_.start + range_.length > range.length)
		@throw [OFOutOfRangeException exceptionWithClass: isa];

	range_.start += range.start;

	return [array objectsInRange: range_];
}
@end