From 8deb334744cad7df9d1c56d0c2016886162598e1 Mon Sep 17 00:00:00 2001 From: Daniel Shin Date: Tue, 14 Jun 2016 11:29:54 +0900 Subject: [PATCH] Fixed implicit conversions from float to double errors on 64bit --- src/Blur/UIImage+MRImageEffects.m | 4 +-- src/Components/MRActivityIndicatorView.m | 4 +-- src/Components/MRCircularProgressView.m | 10 ++++---- src/Components/MRIconView.m | 8 +++--- src/Components/MRNavigationBarProgressView.m | 4 +-- src/Components/MRProgressOverlayView.m | 26 ++++++++++---------- src/Utils/MRProgressHelper.h | 4 +-- 7 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/Blur/UIImage+MRImageEffects.m b/src/Blur/UIImage+MRImageEffects.m index 0486892..9f200b7 100644 --- a/src/Blur/UIImage+MRImageEffects.m +++ b/src/Blur/UIImage+MRImageEffects.m @@ -127,8 +127,8 @@ - (UIImage *)mr_applyBlurWithRadius:(CGFloat)blurRadius tintColor:(UIColor *)tin const CGRect rect = {CGPointZero, image.size}; const CGFloat scale = UIScreen.mainScreen.scale; - const BOOL hasBlur = blurRadius > __FLT_EPSILON__; - const BOOL hasSaturationChange = fabs(saturationDeltaFactor - 1.) > __FLT_EPSILON__; + const BOOL hasBlur = blurRadius > (double) __FLT_EPSILON__; + const BOOL hasSaturationChange = fabs(saturationDeltaFactor - 1.) > (double) __FLT_EPSILON__; if (hasBlur || hasSaturationChange) { UIGraphicsBeginImageContextWithOptions(rect.size, NO, scale); diff --git a/src/Components/MRActivityIndicatorView.m b/src/Components/MRActivityIndicatorView.m index 8e972df..b041b5e 100644 --- a/src/Components/MRActivityIndicatorView.m +++ b/src/Components/MRActivityIndicatorView.m @@ -121,8 +121,8 @@ - (UIBezierPath *)layoutPath { double endAngle = startAngle + TWO_M_PI * 0.9; CGFloat width = self.bounds.size.width; - return [UIBezierPath bezierPathWithArcCenter:CGPointMake(width/2.0f, width/2.0f) - radius:width/2.2f + return [UIBezierPath bezierPathWithArcCenter:CGPointMake(width/2.0, width/2.0) + radius:width/2.2 startAngle:startAngle endAngle:endAngle clockwise:YES]; diff --git a/src/Components/MRCircularProgressView.m b/src/Components/MRCircularProgressView.m index 293d676..b3d043f 100644 --- a/src/Components/MRCircularProgressView.m +++ b/src/Components/MRCircularProgressView.m @@ -124,7 +124,7 @@ - (void)layoutSubviews { valueLabelRect.size.width -= 2*offset; self.valueLabel.frame = valueLabelRect; - self.layer.cornerRadius = self.frame.size.width / 2.0f; + self.layer.cornerRadius = self.frame.size.width / 2.0; self.shapeLayer.path = [self layoutPath].CGPath; self.stopButton.frame = [self.stopButton frameThatFits:self.bounds]; @@ -138,8 +138,8 @@ - (UIBezierPath *)layoutPath { CGFloat width = self.frame.size.width; CGFloat borderWidth = self.borderWidth; CGFloat lineWidth = self.lineWidth; - return [UIBezierPath bezierPathWithArcCenter:CGPointMake(width/2.0f, width/2.0f) - radius:(width - lineWidth - borderWidth)/2.0f + return [UIBezierPath bezierPathWithArcCenter:CGPointMake(width/2.0, width/2.0) + radius:(width - lineWidth - borderWidth)/2.0 startAngle:startAngle endAngle:endAngle clockwise:YES]; @@ -189,7 +189,7 @@ - (void)updateProgress { } - (void)updatePath { - self.shapeLayer.strokeEnd = self.progress; + self.shapeLayer.strokeEnd = (double) self.progress; } - (void)updateLabel:(float)progress { @@ -199,7 +199,7 @@ - (void)updateLabel:(float)progress { - (void)setProgress:(float)progress animated:(BOOL)animated { if (animated) { - if (ABS(self.progress - progress) < CGFLOAT_MIN) { + if ((double) ABS(self.progress - progress) < CGFLOAT_MIN) { return; } diff --git a/src/Components/MRIconView.m b/src/Components/MRIconView.m index 061d039..3027161 100644 --- a/src/Components/MRIconView.m +++ b/src/Components/MRIconView.m @@ -67,7 +67,7 @@ - (void)tintColorDidChange { - (void)setFrame:(CGRect)frame { super.frame = frame; - self.layer.cornerRadius = frame.size.width / 2.0f; + self.layer.cornerRadius = frame.size.width / 2.0; } #pragma mark - Properties @@ -104,9 +104,9 @@ - (UIBezierPath *)path { UIBezierPath *path = [UIBezierPath new]; CGRect bounds = self.bounds; - [path moveToPoint:CGPointMake(bounds.size.width * 0.2f, bounds.size.height * 0.55f)]; - [path addLineToPoint:CGPointMake(bounds.size.width * 0.325f, bounds.size.height * 0.7f)]; - [path addLineToPoint:CGPointMake(bounds.size.width * 0.75f, bounds.size.height * 0.3f)]; + [path moveToPoint:CGPointMake(bounds.size.width * 0.2, bounds.size.height * 0.55)]; + [path addLineToPoint:CGPointMake(bounds.size.width * 0.325, bounds.size.height * 0.7)]; + [path addLineToPoint:CGPointMake(bounds.size.width * 0.75, bounds.size.height * 0.3)]; return path; } diff --git a/src/Components/MRNavigationBarProgressView.m b/src/Components/MRNavigationBarProgressView.m index e67abd4..5791a97 100644 --- a/src/Components/MRNavigationBarProgressView.m +++ b/src/Components/MRNavigationBarProgressView.m @@ -187,7 +187,7 @@ - (void)layoutSubviews { } - (void)layoutProgressView { - self.progressView.frame = CGRectMake(0, 0, self.frame.size.width * self.progress, self.frame.size.height); + self.progressView.frame = CGRectMake(0, 0, self.frame.size.width * (double) self.progress, self.frame.size.height); } @@ -224,7 +224,7 @@ - (void)progressDidChange { - (void)setProgress:(float)progress animated:(BOOL)animated { if (animated) { - if (progress > 0 && progress < 1.0 && self.progressView.alpha <= CGFLOAT_MIN) { + if (progress > 0 && progress < 1.0f && self.progressView.alpha <= CGFLOAT_MIN) { // progressView was hidden. Make it visible first. self.progressView.alpha = 1; } diff --git a/src/Components/MRProgressOverlayView.m b/src/Components/MRProgressOverlayView.m index d0ee270..e5a6502 100644 --- a/src/Components/MRProgressOverlayView.m +++ b/src/Components/MRProgressOverlayView.m @@ -191,7 +191,7 @@ - (void)commonInit { dialogView.layer.cornerRadius = cornerRadius; dialogView.layer.shadowRadius = cornerRadius + 5; dialogView.layer.shadowOpacity = 0.1f; - dialogView.layer.shadowOffset = CGSizeMake(-(cornerRadius+5)/2.0f, -(cornerRadius+5)/2.0f); + dialogView.layer.shadowOffset = CGSizeMake(-(cornerRadius+5)/2.0, -(cornerRadius+5)/2.0); // Create titleLabel UILabel *titleLabel = [UILabel new]; @@ -560,19 +560,19 @@ - (void)show:(BOOL)animated { [self manualLayoutSubviews]; if (animated) { - [self setSubviewTransform:CGAffineTransformMakeScale(1.3f, 1.3f) alpha:0.5f]; + [self setSubviewTransform:CGAffineTransformMakeScale(1.3, 1.3) alpha:0.5]; self.backgroundColor = UIColor.clearColor; } self.hidden = NO; void(^animBlock)() = ^{ - [self setSubviewTransform:CGAffineTransformIdentity alpha:1.0f]; - self.backgroundColor = [UIColor colorWithWhite:0 alpha:0.4f]; + [self setSubviewTransform:CGAffineTransformIdentity alpha:1.0]; + self.backgroundColor = [UIColor colorWithWhite:0 alpha:0.4]; }; if (animated) { - [UIView animateWithDuration:0.2f delay:0.0 options:UIViewAnimationOptionCurveEaseInOut + [UIView animateWithDuration:0.2 delay:0.0 options:UIViewAnimationOptionCurveEaseInOut animations:animBlock completion:nil]; } else { @@ -601,10 +601,10 @@ - (void)hide:(BOOL)animated { } - (void)hide:(BOOL)animated completion:(void(^)())completionBlock { - [self setSubviewTransform:CGAffineTransformIdentity alpha:1.0f]; + [self setSubviewTransform:CGAffineTransformIdentity alpha:1.0]; void(^animBlock)() = ^{ - [self setSubviewTransform:CGAffineTransformMakeScale(0.6f, 0.6f) alpha:0.0f]; + [self setSubviewTransform:CGAffineTransformMakeScale(0.6, 0.6) alpha:0.0]; self.backgroundColor = UIColor.clearColor; }; @@ -620,7 +620,7 @@ - (void)hide:(BOOL)animated completion:(void(^)())completionBlock { }; if (animated) { - [UIView animateWithDuration:0.2f delay:0.0 options:UIViewAnimationOptionCurveEaseInOut + [UIView animateWithDuration:0.2 delay:0.0 options:UIViewAnimationOptionCurveEaseInOut animations:animBlock completion:animCompletionBlock]; } else { @@ -653,8 +653,8 @@ - (void)manualLayoutSubviews { insets = scrollView.contentInset; } - self.center = CGPointMake((bounds.size.width - insets.left - insets.right) / 2.0f, - (bounds.size.height - insets.top - insets.bottom) / 2.0f); + self.center = CGPointMake((bounds.size.width - insets.left - insets.right) / 2.0, + (bounds.size.height - insets.top - insets.bottom) / 2.0); if (MRSystemVersionGreaterThanOrEqualTo8()) { self.bounds = (CGRect){CGPointZero, bounds.size}; @@ -718,15 +718,15 @@ - (void)manualLayoutSubviews { titleLabelOrigin = CGPointMake(titleLabelMinX, y); } else { dialogWidth = dialogMinWidth; - titleLabelOrigin = CGPointMake(titleLabelMinX + (titleLabelMinWidth - titleLabelSize.width) / 2.0f, y); + titleLabelOrigin = CGPointMake(titleLabelMinX + (titleLabelMinWidth - titleLabelSize.width) / 2.0, y); } CGPoint modeViewOrigin = CGPointMake(titleLabelOrigin.x - offset, - y + (titleLabelSize.height - modeViewSize.height) / 2.0f); + y + (titleLabelSize.height - modeViewSize.height) / 2.0); CGRect modeViewFrame = {modeViewOrigin, modeViewSize}; self.modeView.frame = modeViewFrame; } else { - titleLabelOrigin = CGPointMake(titleLabelMinX + (titleLabelMaxWidth - titleLabelSize.width) / 2.0f, y); + titleLabelOrigin = CGPointMake(titleLabelMinX + (titleLabelMaxWidth - titleLabelSize.width) / 2.0, y); } CGRect titleLabelFrame = {titleLabelOrigin, titleLabelSize}; diff --git a/src/Utils/MRProgressHelper.h b/src/Utils/MRProgressHelper.h index 0213170..3229aa7 100644 --- a/src/Utils/MRProgressHelper.h +++ b/src/Utils/MRProgressHelper.h @@ -31,8 +31,8 @@ static inline BOOL MRSystemVersionGreaterThanOrEqualTo8() { static inline CGRect MRCenterCGSizeInCGRect(CGSize innerRectSize, CGRect outerRect) { CGRect innerRect; innerRect.size = innerRectSize; - innerRect.origin.x = outerRect.origin.x + (outerRect.size.width - innerRectSize.width) / 2.0f; - innerRect.origin.y = outerRect.origin.y + (outerRect.size.height - innerRectSize.height) / 2.0f; + innerRect.origin.x = outerRect.origin.x + (outerRect.size.width - innerRectSize.width) / 2.0; + innerRect.origin.y = outerRect.origin.y + (outerRect.size.height - innerRectSize.height) / 2.0; return innerRect; }