Skip to content
This repository was archived by the owner on Feb 2, 2023. It is now read-only.

Commit f5b3a28

Browse files
Hannah TroisiAdlai Holler
authored andcommitted
Fix Pinterest Xcode 7.3.1 Analyzer Warnings (#1988)
1 parent aeec0b1 commit f5b3a28

6 files changed

Lines changed: 16 additions & 13 deletions

File tree

AsyncDisplayKit/ASCellNode.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ typedef NS_ENUM(NSUInteger, ASCellNodeVisibilityEvent) {
120120
*/
121121
- (instancetype)initWithViewControllerBlock:(ASDisplayNodeViewControllerBlock)viewControllerBlock didLoadBlock:(nullable ASDisplayNodeDidLoadBlock)didLoadBlock;
122122

123-
- (void)cellNodeVisibilityEvent:(ASCellNodeVisibilityEvent)event inScrollView:(UIScrollView *)scrollView withCellFrame:(CGRect)cellFrame;
123+
- (void)cellNodeVisibilityEvent:(ASCellNodeVisibilityEvent)event inScrollView:(nullable UIScrollView *)scrollView withCellFrame:(CGRect)cellFrame;
124124

125125
@end
126126

AsyncDisplayKit/ASCollectionView.mm

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -721,9 +721,10 @@ - (void)scrollViewDidScroll:(UIScrollView *)scrollView
721721

722722
- (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset
723723
{
724+
CGPoint contentOffset = scrollView.contentOffset;
724725
_deceleratingVelocity = CGPointMake(
725-
scrollView.contentOffset.x - ((targetContentOffset != NULL) ? targetContentOffset->x : 0),
726-
scrollView.contentOffset.y - ((targetContentOffset != NULL) ? targetContentOffset->y : 0)
726+
contentOffset.x - ((targetContentOffset != NULL) ? targetContentOffset->x : 0),
727+
contentOffset.y - ((targetContentOffset != NULL) ? targetContentOffset->y : 0)
727728
);
728729

729730
if (targetContentOffset != NULL) {
@@ -732,7 +733,7 @@ - (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoi
732733
}
733734

734735
if (_asyncDelegateFlags.asyncDelegateScrollViewWillEndDraggingWithVelocityTargetContentOffset) {
735-
[_asyncDelegate scrollViewWillEndDragging:scrollView withVelocity:velocity targetContentOffset:targetContentOffset];
736+
[_asyncDelegate scrollViewWillEndDragging:scrollView withVelocity:velocity targetContentOffset:(targetContentOffset ? : &contentOffset)];
736737
}
737738
}
738739

AsyncDisplayKit/ASDisplayNode.mm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2071,7 +2071,8 @@ - (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
20712071
return _layoutSpecBlock(self, constrainedSize);
20722072
}
20732073

2074-
return nil;
2074+
ASDisplayNodeAssert(NO, @"-[ASDisplayNode layoutSpecThatFits:] should never fall through to return empty value");
2075+
return [[ASLayoutSpec alloc] init];
20752076
}
20762077

20772078
- (ASLayout *)calculatedLayout

AsyncDisplayKit/ASTableView.mm

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -704,18 +704,19 @@ - (void)scrollViewDidScroll:(UIScrollView *)scrollView
704704

705705
- (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset
706706
{
707+
CGPoint contentOffset = scrollView.contentOffset;
707708
_deceleratingVelocity = CGPointMake(
708-
scrollView.contentOffset.x - ((targetContentOffset != NULL) ? targetContentOffset->x : 0),
709-
scrollView.contentOffset.y - ((targetContentOffset != NULL) ? targetContentOffset->y : 0)
709+
contentOffset.x - ((targetContentOffset != NULL) ? targetContentOffset->x : 0),
710+
contentOffset.y - ((targetContentOffset != NULL) ? targetContentOffset->y : 0)
710711
);
711712

712713
if (targetContentOffset != NULL) {
713714
ASDisplayNodeAssert(_batchContext != nil, @"Batch context should exist");
714715
[self _beginBatchFetchingIfNeededWithScrollView:self forScrollDirection:[self scrollDirection] contentOffset:*targetContentOffset];
715716
}
716-
717+
717718
if (_asyncDelegateFlags.asyncDelegateScrollViewWillEndDraggingWithVelocityTargetContentOffset) {
718-
[_asyncDelegate scrollViewWillEndDragging:scrollView withVelocity:velocity targetContentOffset:targetContentOffset];
719+
[_asyncDelegate scrollViewWillEndDragging:scrollView withVelocity:velocity targetContentOffset:(targetContentOffset ? : &contentOffset)];
719720
}
720721
}
721722

AsyncDisplayKit/Details/ASCollectionViewFlowLayoutInspector.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,14 @@ NS_ASSUME_NONNULL_BEGIN
4848
*
4949
* @discussion A great time to update perform selector caches!
5050
*/
51-
- (void)didChangeCollectionViewDelegate:(id<ASCollectionDelegate>)delegate;
51+
- (void)didChangeCollectionViewDelegate:(nullable id<ASCollectionDelegate>)delegate;
5252

5353
/**
5454
* Allow the inspector to respond to dataSource changes.
5555
*
5656
* @discussion A great time to update perform selector caches!
5757
*/
58-
- (void)didChangeCollectionViewDataSource:(id<ASCollectionDataSource>)dataSource;
58+
- (void)didChangeCollectionViewDataSource:(nullable id<ASCollectionDataSource>)dataSource;
5959

6060
@end
6161

AsyncDisplayKit/Details/ASImageProtocols.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ NS_ASSUME_NONNULL_BEGIN
1717

1818
@protocol ASImageContainerProtocol <NSObject>
1919

20-
- (UIImage *)asdk_image;
21-
- (NSData *)asdk_animatedImageData;
20+
- (nullable UIImage *)asdk_image;
21+
- (nullable NSData *)asdk_animatedImageData;
2222

2323
@end
2424

0 commit comments

Comments
 (0)