563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
|
[new makeImmutable];
return new;
}
- (int)countByEnumeratingWithState: (of_fast_enumeration_state_t*)state
objects: (id*)objects
count: (int)count_
{
/* FIXME: Use -[getObjects:inRange:] on the passed objects */
size_t count = [self count];
if (count > INT_MAX)
@throw [OFOutOfRangeException exceptionWithClass: [self class]];
if (state->state >= count)
return 0;
state->state = count;
state->itemsPtr = [self objects];
state->mutationsPtr = (unsigned long*)self;
return (int)count;
}
- (OFEnumerator*)objectEnumerator
{
return [[[OFArrayEnumerator alloc] initWithArray: self
mutationsPtr: NULL] autorelease];
}
|
|
<
|
|
>
|
|
>
>
|
|
|
|
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
|
[new makeImmutable];
return new;
}
- (int)countByEnumeratingWithState: (of_fast_enumeration_state_t*)state
objects: (id*)objects
count: (int)count
{
of_range_t range = of_range(state->state, count);
if (range.length > SIZE_MAX - range.location)
@throw [OFOutOfRangeException exceptionWithClass: [self class]];
if (range.location + range.length > [self count])
range.length = [self count] - range.location;
[self getObjects: objects
inRange: range];
state->state = range.location + range.length;
state->itemsPtr = objects;
state->mutationsPtr = (unsigned long*)self;
return (int)range.length;
}
- (OFEnumerator*)objectEnumerator
{
return [[[OFArrayEnumerator alloc] initWithArray: self
mutationsPtr: NULL] autorelease];
}
|