Skip to content

Commit

Permalink
Merge pull request nicklockwood#178 from adolfo/fix-fabsf-errors
Browse files Browse the repository at this point in the history
Fix compiler double to float warnings
nicklockwood committed Jul 27, 2015

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents 3165ead + fc910c8 commit b3d7b66
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
@@ -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];
@@ -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)];
}
@@ -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)];
@@ -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;
}
@@ -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
@@ -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;
}

0 comments on commit b3d7b66

Please sign in to comment.