Permalink
Browse files

Add a `#ifdef` to silence a `clang` static analyzer false positive wa…

…rning.

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.
  • Loading branch information...
1 parent 5663f2d commit 82157634ca0ca5b6a4a67a194dd11f15d9b72835 @johnezang johnezang committed Jul 12, 2012
Showing with 2 additions and 0 deletions.
  1. +2 −0 JSONKit.m
View
@@ -744,7 +744,9 @@ - (void)getObjects:(id *)objectsPtr range:(NSRange)range
NSParameterAssert((objects != NULL) && (count <= capacity));
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)]; }
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]; }
+#ifndef __clang_analyzer__
memcpy(objectsPtr, objects + range.location, range.length * sizeof(id));
+#endif
}
- (id)objectAtIndex:(NSUInteger)objectIndex

0 comments on commit 8215763

Please sign in to comment.