From 650216dae346395711549d3e3c47501f0ce15b46 Mon Sep 17 00:00:00 2001 From: Jesse Collis Date: Sun, 9 Dec 2012 10:13:57 +1100 Subject: [PATCH 1/4] Fixes -Wnewline-eof error --- SVPullToRefresh/UIScrollView+SVInfiniteScrolling.h | 2 +- SVPullToRefresh/UIScrollView+SVInfiniteScrolling.m | 2 +- SVPullToRefresh/UIScrollView+SVPullToRefresh.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/SVPullToRefresh/UIScrollView+SVInfiniteScrolling.h b/SVPullToRefresh/UIScrollView+SVInfiniteScrolling.h index 569f5cf8..7ce16501 100644 --- a/SVPullToRefresh/UIScrollView+SVInfiniteScrolling.h +++ b/SVPullToRefresh/UIScrollView+SVInfiniteScrolling.h @@ -42,4 +42,4 @@ typedef NSUInteger SVInfiniteScrollingState; - (void)startAnimating; - (void)stopAnimating; -@end \ No newline at end of file +@end diff --git a/SVPullToRefresh/UIScrollView+SVInfiniteScrolling.m b/SVPullToRefresh/UIScrollView+SVInfiniteScrolling.m index 4a6a669e..6af8a9b2 100644 --- a/SVPullToRefresh/UIScrollView+SVInfiniteScrolling.m +++ b/SVPullToRefresh/UIScrollView+SVInfiniteScrolling.m @@ -297,4 +297,4 @@ - (void)setState:(SVInfiniteScrollingState)newState { self.infiniteScrollingHandler(); } -@end \ No newline at end of file +@end diff --git a/SVPullToRefresh/UIScrollView+SVPullToRefresh.h b/SVPullToRefresh/UIScrollView+SVPullToRefresh.h index 4b8fedd3..b7958109 100644 --- a/SVPullToRefresh/UIScrollView+SVPullToRefresh.h +++ b/SVPullToRefresh/UIScrollView+SVPullToRefresh.h @@ -58,4 +58,4 @@ typedef NSUInteger SVPullToRefreshState; // deprecated; use [self.scrollView triggerPullToRefresh] instead - (void)triggerRefresh DEPRECATED_ATTRIBUTE; -@end \ No newline at end of file +@end From 0adf99801af9f420ff9dc40924118388ea1cea2e Mon Sep 17 00:00:00 2001 From: Jesse Collis Date: Sun, 9 Dec 2012 10:24:39 +1100 Subject: [PATCH 2/4] Fixes -Wconversion errors --- SVPullToRefresh/UIScrollView+SVInfiniteScrolling.m | 4 ++-- SVPullToRefresh/UIScrollView+SVPullToRefresh.m | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/SVPullToRefresh/UIScrollView+SVInfiniteScrolling.m b/SVPullToRefresh/UIScrollView+SVInfiniteScrolling.m index 6af8a9b2..9889e3ed 100644 --- a/SVPullToRefresh/UIScrollView+SVInfiniteScrolling.m +++ b/SVPullToRefresh/UIScrollView+SVInfiniteScrolling.m @@ -271,12 +271,12 @@ - (void)setState:(SVInfiniteScrollingState)newState { if(hasCustomView) { [self addSubview:customView]; CGRect viewBounds = [customView bounds]; - CGPoint origin = CGPointMake(round((self.bounds.size.width-viewBounds.size.width)/2), round((self.bounds.size.height-viewBounds.size.height)/2)); + CGPoint origin = CGPointMake(roundf((self.bounds.size.width-viewBounds.size.width)/2), roundf((self.bounds.size.height-viewBounds.size.height)/2)); [customView setFrame:CGRectMake(origin.x, origin.y, viewBounds.size.width, viewBounds.size.height)]; } else { CGRect viewBounds = [self.activityIndicatorView bounds]; - CGPoint origin = CGPointMake(round((self.bounds.size.width-viewBounds.size.width)/2), round((self.bounds.size.height-viewBounds.size.height)/2)); + CGPoint origin = CGPointMake(roundf((self.bounds.size.width-viewBounds.size.width)/2), roundf((self.bounds.size.height-viewBounds.size.height)/2)); [self.activityIndicatorView setFrame:CGRectMake(origin.x, origin.y, viewBounds.size.width, viewBounds.size.height)]; switch (newState) { diff --git a/SVPullToRefresh/UIScrollView+SVPullToRefresh.m b/SVPullToRefresh/UIScrollView+SVPullToRefresh.m index bc6dbbc7..cdcaf6d9 100644 --- a/SVPullToRefresh/UIScrollView+SVPullToRefresh.m +++ b/SVPullToRefresh/UIScrollView+SVPullToRefresh.m @@ -175,7 +175,7 @@ - (void)layoutSubviews { float position = 0.50; CGRect titleFrame = self.titleLabel.frame; - titleFrame.origin.x = ceil(remainingWidth*position+44); + titleFrame.origin.x = ceilf(remainingWidth*position+44); self.titleLabel.frame = titleFrame; CGRect dateFrame = self.subtitleLabel.frame; @@ -183,7 +183,7 @@ - (void)layoutSubviews { self.subtitleLabel.frame = dateFrame; CGRect arrowFrame = self.arrow.frame; - arrowFrame.origin.x = ceil(remainingWidth*position); + arrowFrame.origin.x = ceilf(remainingWidth*position); self.arrow.frame = arrowFrame; self.activityIndicatorView.center = self.arrow.center; @@ -203,7 +203,7 @@ - (void)layoutSubviews { if(hasCustomView) { [self addSubview:customView]; CGRect viewBounds = [customView bounds]; - CGPoint origin = CGPointMake(round((self.bounds.size.width-viewBounds.size.width)/2), round((self.bounds.size.height-viewBounds.size.height)/2)); + CGPoint origin = CGPointMake(roundf((self.bounds.size.width-viewBounds.size.width)/2), roundf((self.bounds.size.height-viewBounds.size.height)/2)); [customView setFrame:CGRectMake(origin.x, origin.y, viewBounds.size.width, viewBounds.size.height)]; } else { @@ -221,7 +221,7 @@ - (void)layoutSubviews { break; case SVPullToRefreshStateTriggered: - [self rotateArrow:M_PI hide:NO]; + [self rotateArrow:(float)M_PI hide:NO]; break; case SVPullToRefreshStateLoading: @@ -513,7 +513,7 @@ - (void)drawRect:(CGRect)rect { // Gradient Declaration CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); - CGFloat alphaGradientLocations[] = {0, 0.8}; + CGFloat alphaGradientLocations[] = {0, 0.8f}; CGGradientRef alphaGradient = nil; if([[[UIDevice currentDevice] systemVersion]floatValue] >= 5){ From b840cc5ad4800387ebf0327db4d11d63d69dd486 Mon Sep 17 00:00:00 2001 From: Jesse Collis Date: Sun, 9 Dec 2012 10:26:02 +1100 Subject: [PATCH 3/4] Fixes -Wfloat-equal error --- SVPullToRefresh/UIScrollView+SVPullToRefresh.m | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/SVPullToRefresh/UIScrollView+SVPullToRefresh.m b/SVPullToRefresh/UIScrollView+SVPullToRefresh.m index cdcaf6d9..69b756ab 100644 --- a/SVPullToRefresh/UIScrollView+SVPullToRefresh.m +++ b/SVPullToRefresh/UIScrollView+SVPullToRefresh.m @@ -10,6 +10,8 @@ #import #import "UIScrollView+SVPullToRefresh.h" +//fequalzro() from http://stackoverflow.com/a/1614761/184130 +#define fequalzero(a) (fabs(a) < FLT_EPSILON) static CGFloat const SVPullToRefreshViewHeight = 60; @@ -424,7 +426,7 @@ - (void)triggerRefresh { } - (void)startAnimating{ - if(self.scrollView.contentOffset.y == 0) { + if(fequalzero(self.scrollView.contentOffset.y)) { [self.scrollView setContentOffset:CGPointMake(self.scrollView.contentOffset.x, -self.frame.size.height) animated:YES]; self.wasTriggeredByUser = NO; } From 67cda76ce20c64e21a5e4c67df927a2368066500 Mon Sep 17 00:00:00 2001 From: Jesse Collis Date: Sun, 9 Dec 2012 10:31:34 +1100 Subject: [PATCH 4/4] Fixes -Wsign-conversion --- SVPullToRefresh/UIScrollView+SVPullToRefresh.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SVPullToRefresh/UIScrollView+SVPullToRefresh.m b/SVPullToRefresh/UIScrollView+SVPullToRefresh.m index 69b756ab..88470a3c 100644 --- a/SVPullToRefresh/UIScrollView+SVPullToRefresh.m +++ b/SVPullToRefresh/UIScrollView+SVPullToRefresh.m @@ -526,7 +526,7 @@ - (void)drawRect:(CGRect)rect { alphaGradient = CGGradientCreateWithColors(colorSpace, (__bridge CFArrayRef)alphaGradientColors, alphaGradientLocations); }else{ const CGFloat * components = CGColorGetComponents([self.arrowColor CGColor]); - int numComponents = CGColorGetNumberOfComponents([self.arrowColor CGColor]); + int numComponents = (int)CGColorGetNumberOfComponents([self.arrowColor CGColor]); CGFloat colors[8]; switch(numComponents){ case 2:{