Skip to content

Commit a0a1074

Browse files
committed
Fixed compiler warnings: issue #52
1 parent 71c237e commit a0a1074

11 files changed

+50
-45
lines changed

Classes/HUD/M13ProgressHUD.m

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -554,19 +554,19 @@ - (void)layoutHUD
554554
if (onScreen) {
555555
//Set the frame of the background and its subviews
556556
[UIView animateWithDuration:_animationDuration animations:^{
557-
backgroundView.frame = CGRectIntegral(backgroundRect);
558-
_progressView.frame = CGRectIntegral(progressRect);
559-
backgroundView.transform = CGAffineTransformMakeRotation([self angleForDeviceOrientation]);
557+
self->backgroundView.frame = CGRectIntegral(backgroundRect);
558+
self.progressView.frame = CGRectIntegral(progressRect);
559+
self->backgroundView.transform = CGAffineTransformMakeRotation([self angleForDeviceOrientation]);
560560
//Fade the label
561-
statusLabel.alpha = 0.0;
561+
self->statusLabel.alpha = 0.0;
562562
} completion:^(BOOL finished) {
563563
if (finished) {
564564
//Set the label frame
565-
statusLabel.frame = CGRectIntegral(statusRect);
566-
statusLabel.text = optimalStatusString;
567-
[UIView animateWithDuration:_animationDuration animations:^{
565+
self->statusLabel.frame = CGRectIntegral(statusRect);
566+
self->statusLabel.text = self->optimalStatusString;
567+
[UIView animateWithDuration:self.animationDuration animations:^{
568568
//Show the label
569-
statusLabel.alpha = 1.0;
569+
self->statusLabel.alpha = 1.0;
570570
}];
571571
}
572572
}];
@@ -608,17 +608,17 @@ - (void)recalculateOptimalStatusStringStructure
608608
for (NSString *rect in sizesArray) {
609609
CGRect theRect = CGRectFromString(rect);
610610
//Sum the widths to calculate the mean width
611-
standardDeviation += exp2f(theRect.size.width - meanWidth);
611+
standardDeviation += exp2f((float)theRect.size.width - meanWidth);
612612
}
613613
standardDeviation = sqrtf(standardDeviation / wordsArray.count);
614614
//Correct the mean width if it is below the minimum size
615-
if (meanWidth < _minimumSize.width) {
616-
meanWidth = _minimumSize.width;
615+
if (meanWidth < self.minimumSize.width) {
616+
meanWidth = (float)self.minimumSize.width;
617617
}
618618

619619
//Now calculate where to put line breaks. Lines can exceed the minimum width, but cannot exceed the minimum width plus the standard deviation. Single words can excced these limits.
620620
NSMutableString *correctedString = [[NSMutableString alloc] initWithString:wordsArray[0]];
621-
float lineSize = CGRectFromString(sizesArray[0]).size.width;
621+
float lineSize = (float)CGRectFromString(sizesArray[0]).size.width;
622622
for (int i = 1; i < wordsArray.count; i++) {
623623
NSString *word = wordsArray[i];
624624
CGRect wordRect = CGRectFromString(sizesArray[i]);
@@ -683,7 +683,7 @@ - (void)drawMask
683683
CGColorSpaceRelease(colorSpace);
684684
//Draw the gradient
685685
CGPoint center = CGPointMake(self.bounds.size.width / 2.0, self.bounds.size.height / 2.0);
686-
float radius = MIN(self.bounds.size.width , self.bounds.size.height) ;
686+
float radius = (float)MIN(self.bounds.size.width , self.bounds.size.height) ;
687687
CGContextDrawRadialGradient (context, gradient, center, 0, center, radius, kCGGradientDrawsAfterEndLocation);
688688
CGGradientRelease(gradient);
689689
//Get the gradient image
@@ -711,8 +711,8 @@ - (void)redrawBlurs
711711
transition.duration = 0.3;
712712
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
713713
transition.type = kCATransitionFade;
714-
[maskView.layer addAnimation:transition forKey:nil];
715-
maskView.backgroundColor = [UIColor colorWithPatternImage:image];
714+
[self->maskView.layer addAnimation:transition forKey:nil];
715+
self->maskView.backgroundColor = [UIColor colorWithPatternImage:image];
716716
});
717717
});
718718
}
@@ -731,8 +731,8 @@ - (void)redrawBlurs
731731
transition.duration = 0.3;
732732
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
733733
transition.type = kCATransitionFade;
734-
[backgroundView.layer addAnimation:transition forKey:nil];
735-
backgroundView.backgroundColor = [UIColor colorWithPatternImage:image];
734+
[self->backgroundView.layer addAnimation:transition forKey:nil];
735+
self->backgroundView.backgroundColor = [UIColor colorWithPatternImage:image];
736736
});
737737
});
738738
}

Classes/HUD/UIImage+ImageEffects.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ - (UIImage *)applyBlurWithRadius:(CGFloat)blurRadius tintColor:(UIColor *)tintCo
200200
// ... if d is odd, use three box-blurs of size 'd', centered on the output pixel.
201201
//
202202
CGFloat inputRadius = blurRadius * [[UIScreen mainScreen] scale];
203-
unsigned int radius = floor(inputRadius * 3. * sqrt(2 * M_PI) / 4 + 0.5);
203+
unsigned int radius = (int)floor(inputRadius * 3. * sqrt(2 * M_PI) / 4 + 0.5);
204204
if (radius % 2 != 1) {
205205
radius += 1; // force radius to be odd so that the three box-blur methodology works.
206206
}
@@ -221,7 +221,7 @@ - (UIImage *)applyBlurWithRadius:(CGFloat)blurRadius tintColor:(UIColor *)tintCo
221221
NSUInteger matrixSize = sizeof(floatingPointSaturationMatrix)/sizeof(floatingPointSaturationMatrix[0]);
222222
int16_t saturationMatrix[matrixSize];
223223
for (NSUInteger i = 0; i < matrixSize; ++i) {
224-
saturationMatrix[i] = (int16_t)roundf(floatingPointSaturationMatrix[i] * divisor);
224+
saturationMatrix[i] = (int16_t)roundf((float)floatingPointSaturationMatrix[i] * divisor);
225225
}
226226
if (hasBlur) {
227227
vImageMatrixMultiply_ARGB8888(&effectOutBuffer, &effectInBuffer, saturationMatrix, divisor, NULL, NULL, kvImageNoFlags);

Classes/ProgressViews/M13ProgressViewBar.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,18 +229,18 @@ - (void)setProgress:(CGFloat)progress animated:(BOOL)animated
229229
- (void)animateProgress:(CADisplayLink *)displayLink
230230
{
231231
dispatch_async(dispatch_get_main_queue(), ^{
232-
CGFloat dt = (displayLink.timestamp - _animationStartTime) / self.animationDuration;
232+
CGFloat dt = (displayLink.timestamp - self.animationStartTime) / self.animationDuration;
233233
if (dt >= 1.0) {
234234
//Order is important! Otherwise concurrency will cause errors, because setProgress: will detect an animation in progress and try to stop it by itself. Once over one, set to actual progress amount. Animation is over.
235235
[self.displayLink invalidate];
236236
self.displayLink = nil;
237-
[super setProgress:_animationToValue animated:NO];
237+
[super setProgress:self.animationToValue animated:NO];
238238
[self setNeedsDisplay];
239239
return;
240240
}
241241

242242
//Set progress
243-
[super setProgress:_animationFromValue + dt * (_animationToValue - _animationFromValue) animated:YES];
243+
[super setProgress:self.animationFromValue + dt * (self.animationToValue - self.animationFromValue) animated:YES];
244244
[self setNeedsDisplay];
245245

246246
});
@@ -250,7 +250,7 @@ - (void)performAction:(M13ProgressViewAction)action animated:(BOOL)animated
250250
{
251251
if (action == M13ProgressViewActionNone && _currentAction != M13ProgressViewActionNone) {
252252
_currentAction = action;
253-
_percentageLabel.string = [_percentageFormatter stringFromNumber:[NSNumber numberWithFloat:self.progress]];
253+
_percentageLabel.string = [self.percentageFormatter stringFromNumber:[NSNumber numberWithFloat:(float)self.progress]];
254254
[self setNeedsDisplay];
255255
[CATransaction begin];
256256
CABasicAnimation *barAnimation = [self barColorAnimation];

Classes/ProgressViews/M13ProgressViewFilteredImage.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,18 +125,18 @@ - (void)setProgress:(CGFloat)progress animated:(BOOL)animated
125125
- (void)animateProgress:(CADisplayLink *)displayLink
126126
{
127127
dispatch_async(dispatch_get_main_queue(), ^{
128-
CGFloat dt = (displayLink.timestamp - _animationStartTime) / self.animationDuration;
128+
CGFloat dt = (displayLink.timestamp - self.animationStartTime) / self.animationDuration;
129129
if (dt >= 1.0) {
130130
//Order is important! Otherwise concurrency will cause errors, because setProgress: will detect an animation in progress and try to stop it by itself. Once over one, set to actual progress amount. Animation is over.
131131
[self.displayLink invalidate];
132132
self.displayLink = nil;
133-
[super setProgress:_animationToValue animated:NO];
133+
[super setProgress:self.animationToValue animated:NO];
134134
[self setNeedsDisplay];
135135
return;
136136
}
137137

138138
//Set progress
139-
[super setProgress:_animationFromValue + dt * (_animationToValue - _animationFromValue) animated:YES];
139+
[super setProgress:self.animationFromValue + dt * (self.animationToValue - self.animationFromValue) animated:YES];
140140
[self setNeedsDisplay];
141141

142142
});
@@ -186,7 +186,7 @@ - (void)drawRect:(CGRect)rect
186186
//Calculate the current value
187187
CGFloat value = startValue + ((endValue - startValue) * self.progress);
188188
//Set the value
189-
[filter setValue:[NSNumber numberWithFloat:value] forKey:parameterKey];
189+
[filter setValue:[NSNumber numberWithFloat:(float)value] forKey:parameterKey];
190190
}
191191
//Set the input image
192192
[filter setValue:image forKey:kCIInputImageKey];

Classes/ProgressViews/M13ProgressViewLetterpress.m

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -193,18 +193,18 @@ - (void)setProgress:(CGFloat)progress animated:(BOOL)animated
193193
- (void)animateProgress:(CADisplayLink *)displayLink
194194
{
195195
dispatch_async(dispatch_get_main_queue(), ^{
196-
CGFloat dt = (displayLink.timestamp - _animationStartTime) / self.animationDuration;
196+
CGFloat dt = (displayLink.timestamp - self.animationStartTime) / self.animationDuration;
197197
if (dt >= 1.0) {
198198
//Order is important! Otherwise concurrency will cause errors, because setProgress: will detect an animation in progress and try to stop it by itself. Once over one, set to actual progress amount. Animation is over.
199199
[self.displayLink invalidate];
200200
self.displayLink = nil;
201-
[super setProgress:_animationToValue animated:NO];
201+
[super setProgress:self.animationToValue animated:NO];
202202
[self setNeedsDisplay];
203203
return;
204204
}
205205

206206
//Set progress
207-
[super setProgress:_animationFromValue + dt * (_animationToValue - _animationFromValue) animated:YES];
207+
[super setProgress:self.animationFromValue + dt * (self.animationToValue - self.animationFromValue) animated:YES];
208208
[self setNeedsDisplay];
209209

210210
});
@@ -256,10 +256,10 @@ - (void)drawRect:(CGRect)rect
256256
//Setup
257257
CGRect pointRect = CGRectZero;
258258
int index = -1;
259-
int indexToFillTo = _progressView.numberOfGridPoints.x * _progressView.numberOfGridPoints.y * _progressView.progress;
259+
int indexToFillTo = (int)(_progressView.numberOfGridPoints.x * _progressView.numberOfGridPoints.y * _progressView.progress);
260260

261261
//Draw
262-
for (int y = _progressView.numberOfGridPoints.y - 1; y >= 0; y--) {
262+
for (int y = (int)_progressView.numberOfGridPoints.y - 1; y >= 0; y--) {
263263
for (int x = 0; x < _progressView.numberOfGridPoints.x; x++) {
264264

265265
index += 1;

Classes/ProgressViews/M13ProgressViewMetro.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -261,18 +261,18 @@ - (void)setProgress:(CGFloat)progress animated:(BOOL)animated
261261
- (void)animateProgress:(CADisplayLink *)displayLink
262262
{
263263
dispatch_async(dispatch_get_main_queue(), ^{
264-
CGFloat dt = (displayLink.timestamp - _animationStartTime) / self.animationDuration;
264+
CGFloat dt = (displayLink.timestamp - self.animationStartTime) / self.animationDuration;
265265
if (dt >= 1.0) {
266266
//Order is important! Otherwise concurrency will cause errors, because setProgress: will detect an animation in progress and try to stop it by itself. Once over one, set to actual progress amount. Animation is over.
267267
[self.displayLink invalidate];
268268
self.displayLink = nil;
269-
[super setProgress:_animationToValue animated:NO];
269+
[super setProgress:self.animationToValue animated:NO];
270270
[self showProgress];
271271
return;
272272
}
273273

274274
//Set progress
275-
[super setProgress:_animationFromValue + dt * (_animationToValue - _animationFromValue) animated:YES];
275+
[super setProgress:self.animationFromValue + dt * (self.animationToValue - self.animationFromValue) animated:YES];
276276
[self showProgress];
277277

278278
});
@@ -281,7 +281,7 @@ - (void)animateProgress:(CADisplayLink *)displayLink
281281
- (void)showProgress
282282
{
283283
static int pastIndexToHighlightTo = 0;
284-
int indexToHighlightTo = ceilf(_numberOfDots * self.progress);
284+
int indexToHighlightTo = (int)ceilf(_numberOfDots * (float)self.progress);
285285
//Only perform the animation if necessary.
286286
if (pastIndexToHighlightTo != indexToHighlightTo) {
287287
for (int i = 0; i < _numberOfDots; i++) {

Classes/ProgressViews/M13ProgressViewMetroDotPolygon.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ - (NSArray *)verticies
3333
} else {
3434
NSMutableArray *pointsArray = [NSMutableArray array];
3535
for (int i = 0; i < _numberOfSides; i++) {
36-
CGPoint point = CGPointMake(_radius * cosf((2.0 * M_PI * (float)i) / (float)_numberOfSides), _radius * sinf((2.0 * M_PI * (float)i) / (float)_numberOfSides));
36+
CGPoint point = CGPointMake(_radius * cosf((2.0f * (float)M_PI * (float)i) / (float)_numberOfSides), (float)_radius * sinf((2.0f * (float)M_PI * (float)i) / (float)_numberOfSides));
3737
NSValue *value = [NSValue valueWithCGPoint:point];
3838
[pointsArray addObject:value];
3939
}

Classes/ProgressViews/M13ProgressViewRadiative.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,18 +168,18 @@ - (void)setProgress:(CGFloat)progress animated:(BOOL)animated
168168
- (void)animateProgress:(CADisplayLink *)displayLink
169169
{
170170
dispatch_async(dispatch_get_main_queue(), ^{
171-
CGFloat dt = (displayLink.timestamp - _animationStartTime) / self.animationDuration;
171+
CGFloat dt = (displayLink.timestamp - self.animationStartTime) / self.animationDuration;
172172
if (dt >= 1.0) {
173173
//Order is important! Otherwise concurrency will cause errors, because setProgress: will detect an animation in progress and try to stop it by itself. Once over one, set to actual progress amount. Animation is over.
174174
[self.displayLink invalidate];
175175
self.displayLink = nil;
176-
[super setProgress:_animationToValue animated:NO];
176+
[super setProgress:self.animationToValue animated:NO];
177177
[self setNeedsDisplay];
178178
return;
179179
}
180180

181181
//Set progress
182-
[super setProgress:_animationFromValue + dt * (_animationToValue - _animationFromValue) animated:YES];
182+
[super setProgress:self.animationFromValue + dt * (self.animationToValue - self.animationFromValue) animated:YES];
183183
[self setNeedsDisplay];
184184

185185
});
@@ -244,7 +244,7 @@ - (void)drawRect:(CGRect)rect
244244

245245
UIBezierPath *path;
246246
int i = 0;
247-
int indexOfLastFilledPath = ceilf(self.progress * (float)_numberOfRipples);
247+
int indexOfLastFilledPath = (int)ceilf((float)self.progress * (float)_numberOfRipples);
248248
while ((path = [enumerator nextObject])) {
249249
//Set the path's color
250250
if (!self.indeterminate) {

Classes/ProgressViews/M13ProgressViewSegmentedRing.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ - (void)setup
8989
self.backgroundColor = [UIColor clearColor];
9090

9191
//Set defaut sizes
92-
_progressRingWidth = fmaxf(self.bounds.size.width * .25, 1.0);
92+
_progressRingWidth = fmaxf((float)self.bounds.size.width * .25f, 1.0);
9393
_progressRingWidthOverriden = NO;
9494
_segmentSeparationAngleOverriden = NO;
9595
self.animationDuration = .3;

Classes/ProgressViews/M13ProgressViewStripedBar.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,18 +235,18 @@ - (void)setProgress:(CGFloat)progress animated:(BOOL)animated
235235
- (void)animateProgress:(CADisplayLink *)displayLink
236236
{
237237
dispatch_async(dispatch_get_main_queue(), ^{
238-
CGFloat dt = (displayLink.timestamp - _animationStartTime) / self.animationDuration;
238+
CGFloat dt = (displayLink.timestamp - self.animationStartTime) / self.animationDuration;
239239
if (dt >= 1.0) {
240240
//Order is important! Otherwise concurrency will cause errors, because setProgress: will detect an animation in progress and try to stop it by itself. Once over one, set to actual progress amount. Animation is over.
241241
[self.displayLink invalidate];
242242
self.displayLink = nil;
243-
[super setProgress:_animationToValue animated:NO];
243+
[super setProgress:self.animationToValue animated:NO];
244244
[self setNeedsDisplay];
245245
return;
246246
}
247247

248248
//Set progress
249-
[super setProgress:_animationFromValue + dt * (_animationToValue - _animationFromValue) animated:YES];
249+
[super setProgress:self.animationFromValue + dt * (self.animationToValue - self.animationFromValue) animated:YES];
250250
[self setNeedsDisplay];
251251

252252
});

0 commit comments

Comments
 (0)