Skip to content

Commit 76c1928

Browse files
committed
Fixed deprecated -getObjects:andKeys: method for JKDictionary class.
1 parent 5a906ed commit 76c1928

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

JSONKit.m

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,18 +1098,26 @@ - (id)objectForKey:(id)aKey
10981098
return((entryForKey != NULL) ? entryForKey->object : NULL);
10991099
}
11001100

1101+
#pragma clang diagnostic push
1102+
#pragma clang diagnostic ignored "-Wdeprecated-implementations"
11011103
- (void)getObjects:(id *)objects andKeys:(id *)keys
1104+
#pragma clang diagnostic pop
11021105
{
1103-
NSParameterAssert((entry != NULL) && (count <= capacity));
1104-
NSUInteger atEntry = 0UL; NSUInteger arrayIdx = 0UL;
1105-
for(atEntry = 0UL; atEntry < capacity; atEntry++) {
1106-
if(JK_EXPECT_T(entry[atEntry].key != NULL)) {
1107-
NSCParameterAssert((entry[atEntry].object != NULL) && (arrayIdx < count));
1108-
if(JK_EXPECT_T(keys != NULL)) { keys[arrayIdx] = entry[atEntry].key; }
1109-
if(JK_EXPECT_T(objects != NULL)) { objects[arrayIdx] = entry[atEntry].object; }
1110-
arrayIdx++;
1106+
return [self getObjects:objects andKeys:keys count:count];
1107+
}
1108+
1109+
- (void)getObjects:(id *)objects andKeys:(id *)keys count:(NSUInteger)arrayCount
1110+
{
1111+
NSParameterAssert((entry != NULL) && (count <= capacity) && (arrayCount <= count));
1112+
NSUInteger atEntry = 0UL; NSUInteger arrayIdx = 0UL;
1113+
for(atEntry = 0UL; atEntry < capacity && arrayIdx < arrayCount; atEntry++) {
1114+
if(JK_EXPECT_T(entry[atEntry].key != NULL)) {
1115+
NSCParameterAssert((entry[atEntry].object != NULL) && (arrayIdx < count));
1116+
if(JK_EXPECT_T(keys != NULL)) { keys[arrayIdx] = entry[atEntry].key; }
1117+
if(JK_EXPECT_T(objects != NULL)) { objects[arrayIdx] = entry[atEntry].object; }
1118+
arrayIdx++;
1119+
}
11111120
}
1112-
}
11131121
}
11141122

11151123
- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state objects:(id *)stackbuf count:(NSUInteger)len

0 commit comments

Comments
 (0)