Skip to content

Commit

Permalink
cast implicit int to CGFloat conversions [3/3]
Browse files Browse the repository at this point in the history
Summary: Insert casts for implicit int -> CGFloat conversions. This warning category is generally benign and explicitly casting will preserve existing behavior.

Reviewed By: NSProgrammer

Differential Revision: D33303887

fbshipit-source-id: b21adbcf754e707adfe3f8eaa0fe9c3a65380cc5
  • Loading branch information
rmaz authored and facebook-github-bot committed Dec 24, 2021
1 parent a7104b0 commit e60f0f5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions React/CoreModules/RCTFPSGraph.m
Original file line number Diff line number Diff line change
Expand Up @@ -97,18 +97,18 @@ - (void)onTick:(NSTimeInterval)timestamp
self->_label.text = [NSString stringWithFormat:@"%lu", (unsigned long)self->_FPS];
});

CGFloat scale = 60.0 / _height;
CGFloat scale = 60.0 / (CGFloat)_height;
for (NSUInteger i = 0; i < _length - 1; i++) {
_frames[i] = _frames[i + 1];
}
_frames[_length - 1] = _FPS / scale;

CGMutablePathRef path = CGPathCreateMutable();
CGPathMoveToPoint(path, NULL, 0, _height);
CGPathMoveToPoint(path, NULL, 0, (CGFloat)_height);
for (NSUInteger i = 0; i < _length; i++) {
CGPathAddLineToPoint(path, NULL, i, _height - _frames[i]);
CGPathAddLineToPoint(path, NULL, (CGFloat)i, _height - _frames[i]);
}
CGPathAddLineToPoint(path, NULL, _length - 1, _height);
CGPathAddLineToPoint(path, NULL, (CGFloat)_length - 1, (CGFloat)_height);

_graph.path = path;
CGPathRelease(path);
Expand Down
6 changes: 3 additions & 3 deletions React/CoreModules/RCTRedBox.mm
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ - (instancetype)initWithFrame:(CGRect)frame
selector:@selector(showExtraDataViewController)
block:nil];

CGFloat buttonWidth = frame.size.width / (4 + [customButtonTitles count]);
CGFloat bottomButtonHeight = frame.size.height - buttonHeight - [self bottomSafeViewHeight];
CGFloat buttonWidth = frame.size.width / (CGFloat)(4 + [customButtonTitles count]);
CGFloat bottomButtonHeight = frame.size.height - buttonHeight - (CGFloat)[self bottomSafeViewHeight];
dismissButton.frame = CGRectMake(0, bottomButtonHeight, buttonWidth, buttonHeight);
reloadButton.frame = CGRectMake(buttonWidth, bottomButtonHeight, buttonWidth, buttonHeight);
copyButton.frame = CGRectMake(buttonWidth * 2, bottomButtonHeight, buttonWidth, buttonHeight);
Expand Down Expand Up @@ -168,7 +168,7 @@ - (instancetype)initWithFrame:(CGRect)frame
UIView *bottomSafeView = [UIView new];
bottomSafeView.backgroundColor = [UIColor colorWithRed:0.1 green:0.1 blue:0.1 alpha:1];
bottomSafeView.frame =
CGRectMake(0, frame.size.height - [self bottomSafeViewHeight], frame.size.width, [self bottomSafeViewHeight]);
CGRectMake(0, frame.size.height - (CGFloat)[self bottomSafeViewHeight], frame.size.width, (CGFloat)[self bottomSafeViewHeight]);

[rootView addSubview:bottomSafeView];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ - (void)scrollViewWillEndDragging:(UIScrollView *)scrollView
NSInteger snapIndex = velocityAlongAxis > 0.0 ? ceil(fractionalIndex)
: velocityAlongAxis < 0.0 ? floor(fractionalIndex)
: round(fractionalIndex);
CGFloat newTargetContentOffset = (snapIndex * snapToIntervalF) - alignmentOffset;
CGFloat newTargetContentOffset = ((CGFloat)snapIndex * snapToIntervalF) - alignmentOffset;

// Set new targetContentOffset
if (isHorizontal) {
Expand Down

0 comments on commit e60f0f5

Please sign in to comment.