Skip to content

Commit 8215763

Browse files
committed
Add a #ifdef to silence a clang static analyzer false positive warning.
The current (at the time of this writing) version of the `clang` static analyzer is complaing that the `objects` pointer is `NULL`. This is a false positive warning from the analyzer.
1 parent 5663f2d commit 8215763

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

JSONKit.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,9 @@ - (void)getObjects:(id *)objectsPtr range:(NSRange)range
744744
NSParameterAssert((objects != NULL) && (count <= capacity));
745745
if((objectsPtr == NULL) && (NSMaxRange(range) > 0UL)) { [NSException raise:NSRangeException format:@"*** -[%@ %@]: pointer to objects array is NULL but range length is %lu", NSStringFromClass([self class]), NSStringFromSelector(_cmd), (unsigned long)NSMaxRange(range)]; }
746746
if((range.location > count) || (NSMaxRange(range) > count)) { [NSException raise:NSRangeException format:@"*** -[%@ %@]: index (%lu) beyond bounds (%lu)", NSStringFromClass([self class]), NSStringFromSelector(_cmd), (unsigned long)NSMaxRange(range), (unsigned long)count]; }
747+
#ifndef __clang_analyzer__
747748
memcpy(objectsPtr, objects + range.location, range.length * sizeof(id));
749+
#endif
748750
}
749751

750752
- (id)objectAtIndex:(NSUInteger)objectIndex

0 commit comments

Comments
 (0)