Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed implicit conversions from float to double errors on 64bit #123

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Blur/UIImage+MRImageEffects.m
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/Components/MRActivityIndicatorView.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
10 changes: 5 additions & 5 deletions src/Components/MRCircularProgressView.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand All @@ -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];
Expand Down Expand Up @@ -189,7 +189,7 @@ - (void)updateProgress {
}

- (void)updatePath {
self.shapeLayer.strokeEnd = self.progress;
self.shapeLayer.strokeEnd = (double) self.progress;
}

- (void)updateLabel:(float)progress {
Expand All @@ -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;
}

Expand Down
8 changes: 4 additions & 4 deletions src/Components/MRIconView.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Components/MRNavigationBarProgressView.m
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}


Expand Down Expand Up @@ -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;
}
Expand Down
26 changes: 13 additions & 13 deletions src/Components/MRProgressOverlayView.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
};

Expand All @@ -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 {
Expand Down Expand Up @@ -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};
Expand Down Expand Up @@ -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};
Expand Down
4 changes: 2 additions & 2 deletions src/Utils/MRProgressHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down