Overview
Context
Changes
Modified src/OFAdjacentArray.m
from [e52e34f95b]
to [6b135eb930].
︙ | | | ︙ | |
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
|
OF_HASH_ADD_HASH(hash, [objects[i] hash]);
OF_HASH_FINALIZE(hash);
return hash;
}
- (int)countByEnumeratingWithState: (of_fast_enumeration_state_t *)state
objects: (id *)objects
count: (int)count_
{
size_t count = _array.count;
if (count > INT_MAX)
/*
|
|
|
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
|
OF_HASH_ADD_HASH(hash, [objects[i] hash]);
OF_HASH_FINALIZE(hash);
return hash;
}
- (int)countByEnumeratingWithState: (OFFastEnumerationState *)state
objects: (id *)objects
count: (int)count_
{
size_t count = _array.count;
if (count > INT_MAX)
/*
|
︙ | | | ︙ | |
Modified src/OFArray.m
from [5dd577c100]
to [6fa2c5536f].
︙ | | | ︙ | |
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
|
{
OFMutableArray *new = [[self mutableCopy] autorelease];
[new reverse];
[new makeImmutable];
return new;
}
- (int)countByEnumeratingWithState: (of_fast_enumeration_state_t *)state
objects: (id *)objects
count: (int)count
{
OFRange range = OFMakeRange(state->state, count);
if (range.length > SIZE_MAX - range.location)
@throw [OFOutOfRangeException exception];
|
|
|
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
|
{
OFMutableArray *new = [[self mutableCopy] autorelease];
[new reverse];
[new makeImmutable];
return new;
}
- (int)countByEnumeratingWithState: (OFFastEnumerationState *)state
objects: (id *)objects
count: (int)count
{
OFRange range = OFMakeRange(state->state, count);
if (range.length > SIZE_MAX - range.location)
@throw [OFOutOfRangeException exception];
|
︙ | | | ︙ | |
Modified src/OFDictionary.m
from [95a692d8fc]
to [4dbb63643c].
︙ | | | ︙ | |
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
|
- (OFEnumerator *)objectEnumerator
{
return [[[OFDictionaryObjectEnumerator alloc]
initWithDictionary: self] autorelease];
}
- (int)countByEnumeratingWithState: (of_fast_enumeration_state_t *)state
objects: (id *)objects
count: (int)count
{
OFEnumerator *enumerator;
int i;
memcpy(&enumerator, state->extra, sizeof(enumerator));
|
|
|
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
|
- (OFEnumerator *)objectEnumerator
{
return [[[OFDictionaryObjectEnumerator alloc]
initWithDictionary: self] autorelease];
}
- (int)countByEnumeratingWithState: (OFFastEnumerationState *)state
objects: (id *)objects
count: (int)count
{
OFEnumerator *enumerator;
int i;
memcpy(&enumerator, state->extra, sizeof(enumerator));
|
︙ | | | ︙ | |
Modified src/OFEnumerator.h
from [a48f5dd585]
to [aa2de24ec1].
︙ | | | ︙ | |
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
/*
* This needs to be exactly like this because it's hard-coded in the compiler.
*
* We need this bad check to see if we already imported Cocoa, which defines
* this as well.
*/
/**
* @struct of_fast_enumeration_state_t OFEnumerator.h ObjFW/OFEnumerator.h
*
* @brief State information for fast enumerations.
*/
#define of_fast_enumeration_state_t NSFastEnumerationState
#ifndef NSINTEGER_DEFINED
typedef struct {
/** Arbitrary state information for the enumeration */
unsigned long state;
/** Pointer to a C array of objects to return */
id __unsafe_unretained _Nullable *_Nullable itemsPtr;
/** Arbitrary state information to detect mutations */
unsigned long *_Nullable mutationsPtr;
/** Additional arbitrary state information */
unsigned long extra[5];
} of_fast_enumeration_state_t;
#endif
/**
* @protocol OFFastEnumeration OFEnumerator.h ObjFW/OFEnumerator.h
*
* @brief A protocol for fast enumeration.
*
|
|
|
|
|
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
/*
* This needs to be exactly like this because it's hard-coded in the compiler.
*
* We need this bad check to see if we already imported Cocoa, which defines
* this as well.
*/
/**
* @struct OFFastEnumerationState OFEnumerator.h ObjFW/OFEnumerator.h
*
* @brief State information for fast enumerations.
*/
#define OFFastEnumerationState NSFastEnumerationState
#ifndef NSINTEGER_DEFINED
typedef struct {
/** Arbitrary state information for the enumeration */
unsigned long state;
/** Pointer to a C array of objects to return */
id __unsafe_unretained _Nullable *_Nullable itemsPtr;
/** Arbitrary state information to detect mutations */
unsigned long *_Nullable mutationsPtr;
/** Additional arbitrary state information */
unsigned long extra[5];
} OFFastEnumerationState;
#endif
/**
* @protocol OFFastEnumeration OFEnumerator.h ObjFW/OFEnumerator.h
*
* @brief A protocol for fast enumeration.
*
|
︙ | | | ︙ | |
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
*
* @param state Context information for the enumeration
* @param objects A pointer to an array where to put the objects
* @param count The number of objects that can be stored at objects
* @return The number of objects returned in objects or 0 when the enumeration
* finished.
*/
- (int)countByEnumeratingWithState: (of_fast_enumeration_state_t *)state
objects: (id __unsafe_unretained _Nonnull *_Nonnull)
objects
count: (int)count;
@end
/**
* @class OFEnumerator OFEnumerator.h ObjFW/OFEnumerator.h
|
|
|
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
*
* @param state Context information for the enumeration
* @param objects A pointer to an array where to put the objects
* @param count The number of objects that can be stored at objects
* @return The number of objects returned in objects or 0 when the enumeration
* finished.
*/
- (int)countByEnumeratingWithState: (OFFastEnumerationState *)state
objects: (id __unsafe_unretained _Nonnull *_Nonnull)
objects
count: (int)count;
@end
/**
* @class OFEnumerator OFEnumerator.h ObjFW/OFEnumerator.h
|
︙ | | | ︙ | |
Modified src/OFEnumerator.m
from [c36212a268]
to [e234a4699e].
︙ | | | ︙ | |
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
[ret makeImmutable];
objc_autoreleasePoolPop(pool);
return ret;
}
- (int)countByEnumeratingWithState: (of_fast_enumeration_state_t *)state
objects: (id *)objects
count: (int)count
{
int i;
state->itemsPtr = objects;
state->mutationsPtr = (unsigned long *)self;
|
|
|
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
[ret makeImmutable];
objc_autoreleasePoolPop(pool);
return ret;
}
- (int)countByEnumeratingWithState: (OFFastEnumerationState *)state
objects: (id *)objects
count: (int)count
{
int i;
state->itemsPtr = objects;
state->mutationsPtr = (unsigned long *)self;
|
︙ | | | ︙ | |
Modified src/OFList.m
from [734046ca66]
to [eaa8494459].
︙ | | | ︙ | |
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
|
objc_autoreleasePoolPop(pool);
}
return element;
}
- (int)countByEnumeratingWithState: (of_fast_enumeration_state_t *)state
objects: (id *)objects
count: (int)count
{
of_list_object_t *listObject;
memcpy(&listObject, state->extra, sizeof(listObject));
|
|
|
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
|
objc_autoreleasePoolPop(pool);
}
return element;
}
- (int)countByEnumeratingWithState: (OFFastEnumerationState *)state
objects: (id *)objects
count: (int)count
{
of_list_object_t *listObject;
memcpy(&listObject, state->extra, sizeof(listObject));
|
︙ | | | ︙ | |
Modified src/OFMapTable.m
from [8788cb21e4]
to [f62fe0ab1f].
︙ | | | ︙ | |
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
|
return [[[OFMapTableObjectEnumerator alloc]
of_initWithMapTable: self
buckets: _buckets
capacity: _capacity
mutationsPointer: &_mutations] autorelease];
}
- (int)countByEnumeratingWithState: (of_fast_enumeration_state_t *)state
objects: (id *)objects
count: (int)count
{
unsigned long j = state->state;
int i;
for (i = 0; i < count; i++) {
|
|
|
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
|
return [[[OFMapTableObjectEnumerator alloc]
of_initWithMapTable: self
buckets: _buckets
capacity: _capacity
mutationsPointer: &_mutations] autorelease];
}
- (int)countByEnumeratingWithState: (OFFastEnumerationState *)state
objects: (id *)objects
count: (int)count
{
unsigned long j = state->state;
int i;
for (i = 0; i < count; i++) {
|
︙ | | | ︙ | |
Modified src/OFMapTableDictionary.m
from [992c305595]
to [8abac033d7].
︙ | | | ︙ | |
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
|
- (OFEnumerator *)objectEnumerator
{
return [[[OFMapTableEnumeratorWrapper alloc]
initWithEnumerator: [_mapTable objectEnumerator]
object: self] autorelease];
}
- (int)countByEnumeratingWithState: (of_fast_enumeration_state_t *)state
objects: (id *)objects
count: (int)count
{
return [_mapTable countByEnumeratingWithState: state
objects: objects
count: count];
}
|
|
|
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
|
- (OFEnumerator *)objectEnumerator
{
return [[[OFMapTableEnumeratorWrapper alloc]
initWithEnumerator: [_mapTable objectEnumerator]
object: self] autorelease];
}
- (int)countByEnumeratingWithState: (OFFastEnumerationState *)state
objects: (id *)objects
count: (int)count
{
return [_mapTable countByEnumeratingWithState: state
objects: objects
count: count];
}
|
︙ | | | ︙ | |
Modified src/OFMapTableSet.m
from [c0e93f6d5b]
to [906bf79f74].
︙ | | | ︙ | |
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
|
- (OFEnumerator *)objectEnumerator
{
return [[[OFMapTableEnumeratorWrapper alloc]
initWithEnumerator: [_mapTable keyEnumerator]
object: self] autorelease];
}
- (int)countByEnumeratingWithState: (of_fast_enumeration_state_t *)state
objects: (id *)objects
count: (int)count
{
return [_mapTable countByEnumeratingWithState: state
objects: objects
count: count];
}
|
|
|
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
|
- (OFEnumerator *)objectEnumerator
{
return [[[OFMapTableEnumeratorWrapper alloc]
initWithEnumerator: [_mapTable keyEnumerator]
object: self] autorelease];
}
- (int)countByEnumeratingWithState: (OFFastEnumerationState *)state
objects: (id *)objects
count: (int)count
{
return [_mapTable countByEnumeratingWithState: state
objects: objects
count: count];
}
|
︙ | | | ︙ | |
Modified src/OFMutableAdjacentArray.m
from [5cfb1b342c]
to [93f56cbca2].
︙ | | | ︙ | |
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
|
for (i = 0, j = count - 1; i < j; i++, j--) {
id tmp = objects[i];
objects[i] = objects[j];
objects[j] = tmp;
}
}
- (int)countByEnumeratingWithState: (of_fast_enumeration_state_t *)state
objects: (id *)objects
count: (int)count_
{
size_t count = _array.count;
if (count > INT_MAX) {
/*
|
|
|
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
|
for (i = 0, j = count - 1; i < j; i++, j--) {
id tmp = objects[i];
objects[i] = objects[j];
objects[j] = tmp;
}
}
- (int)countByEnumeratingWithState: (OFFastEnumerationState *)state
objects: (id *)objects
count: (int)count_
{
size_t count = _array.count;
if (count > INT_MAX) {
/*
|
︙ | | | ︙ | |
Modified src/OFSet.m
from [f23395a631]
to [a8859ecef5].
︙ | | | ︙ | |
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
|
}
- (OFEnumerator *)objectEnumerator
{
OF_UNRECOGNIZED_SELECTOR
}
- (int)countByEnumeratingWithState: (of_fast_enumeration_state_t *)state
objects: (id *)objects
count: (int)count
{
OFEnumerator *enumerator;
int i;
memcpy(&enumerator, state->extra, sizeof(enumerator));
|
|
|
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
|
}
- (OFEnumerator *)objectEnumerator
{
OF_UNRECOGNIZED_SELECTOR
}
- (int)countByEnumeratingWithState: (OFFastEnumerationState *)state
objects: (id *)objects
count: (int)count
{
OFEnumerator *enumerator;
int i;
memcpy(&enumerator, state->extra, sizeof(enumerator));
|
︙ | | | ︙ | |
Modified tests/OFDictionaryTests.m
from [daa54d882b]
to [fdcd71652e].
︙ | | | ︙ | |
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
|
[_dictionary removeObjectForKey: key];
if (existed)
_mutations++;
}
- (int)countByEnumeratingWithState: (of_fast_enumeration_state_t *)state
objects: (id *)objects
count: (int)count
{
int ret = [super countByEnumeratingWithState: state
objects: objects
count: count];
|
|
|
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
|
[_dictionary removeObjectForKey: key];
if (existed)
_mutations++;
}
- (int)countByEnumeratingWithState: (OFFastEnumerationState *)state
objects: (id *)objects
count: (int)count
{
int ret = [super countByEnumeratingWithState: state
objects: objects
count: count];
|
︙ | | | ︙ | |
Modified tests/OFSetTests.m
from [297b7fe674]
to [04cbdfa860].
︙ | | | ︙ | |
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
|
[_set removeObject: object];
if (existed)
_mutations++;
}
- (int)countByEnumeratingWithState: (of_fast_enumeration_state_t *)state
objects: (id *)objects
count: (int)count
{
int ret = [_set countByEnumeratingWithState: state
objects: objects
count: count];
|
|
|
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
|
[_set removeObject: object];
if (existed)
_mutations++;
}
- (int)countByEnumeratingWithState: (OFFastEnumerationState *)state
objects: (id *)objects
count: (int)count
{
int ret = [_set countByEnumeratingWithState: state
objects: objects
count: count];
|
︙ | | | ︙ | |