Differences From Artifact [77e6be7acc]:
- File src/OFArray_subarray.m — part of check-in [86a2329f2b] at 2011-09-11 14:04:56 on branch trunk — Fix -[OFArray_subarray indexOfObject:]. (user: js, size: 2348) [annotate] [blame] [check-ins using]
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 | { return range.length; } - (id)objectAtIndex: (size_t)index { if (index >= range.length) | | | | 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 | return index; } - (OFArray*)objectsInRange: (of_range_t)range_ { if (range_.start + range_.length > range.length) | | | 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 |