Skip to content

Commit

Permalink
Fix compiler double to float warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
adolfo committed Jul 27, 2015
1 parent 3165ead commit fc910c8
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions SwipeView/SwipeView.m
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ - (void)setDecelerationRate:(float)decelerationRate

- (void)setAutoscroll:(CGFloat)autoscroll
{
if (fabsf(_autoscroll - autoscroll) > 0.0001f)
if (fabs(_autoscroll - autoscroll) > 0.0001f)
{
_autoscroll = autoscroll;
if (autoscroll) [self startAnimation];
Expand Down Expand Up @@ -391,11 +391,11 @@ - (void)updateScrollOffset
_scrollOffset = [self clampedOffset:_scrollOffset];
}
}
if (_vertical && fabsf(_scrollView.contentOffset.x) > 0.0001f)
if (_vertical && fabs(_scrollView.contentOffset.x) > 0.0001f)
{
[self setContentOffsetWithoutEvent:CGPointMake(0.0f, _scrollView.contentOffset.y)];
}
else if (!_vertical && fabsf(_scrollView.contentOffset.y) > 0.0001f)
else if (!_vertical && fabs(_scrollView.contentOffset.y) > 0.0001f)
{
[self setContentOffsetWithoutEvent:CGPointMake(_scrollView.contentOffset.x, 0.0f)];
}
Expand Down Expand Up @@ -613,7 +613,7 @@ - (void)didScroll
[self layOutItemViews];
[_delegate swipeViewDidScroll:self];

if (!_defersItemViewLoading || fabsf([self minScrollDistanceFromOffset:_lastUpdateOffset toOffset:_scrollOffset]) >= 1.0f)
if (!_defersItemViewLoading || fabs([self minScrollDistanceFromOffset:_lastUpdateOffset toOffset:_scrollOffset]) >= 1.0f)
{
//update item index
_currentItemIndex = [self clampedIndex:roundf(_scrollOffset)];
Expand Down Expand Up @@ -773,7 +773,7 @@ - (CGFloat)minScrollDistanceFromOffset:(CGFloat)fromOffset toOffset:(CGFloat)toO
{
wrappedDistance = -wrappedDistance;
}
return (fabsf(directDistance) <= fabsf(wrappedDistance))? directDistance: wrappedDistance;
return (fabs(directDistance) <= fabs(wrappedDistance))? directDistance: wrappedDistance;
}
return directDistance;
}
Expand All @@ -794,7 +794,7 @@ - (void)setCurrentPage:(NSInteger)currentPage

- (void)setScrollOffset:(CGFloat)scrollOffset
{
if (fabsf(_scrollOffset - scrollOffset) > 0.0001f)
if (fabs(_scrollOffset - scrollOffset) > 0.0001f)
{
_scrollOffset = scrollOffset;
_lastUpdateOffset = _scrollOffset - 1.0f; //force refresh
Expand Down Expand Up @@ -1185,7 +1185,7 @@ - (void)scrollViewDidEndDecelerating:(__unused UIScrollView *)scrollView
{
//prevent rounding errors from accumulating
CGFloat integerOffset = roundf(_scrollOffset);
if (fabsf(_scrollOffset - integerOffset) < 0.01f)
if (fabs(_scrollOffset - integerOffset) < 0.01f)
{
_scrollOffset = integerOffset;
}
Expand Down

0 comments on commit fc910c8

Please sign in to comment.