Skip to content

Commit b6a9f52

Browse files
committed
Fixed several warnings.
1 parent 0020ab2 commit b6a9f52

9 files changed

+42
-42
lines changed

Classes/Console/M13ProgressConsole.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ - (NSString *)percentageProgressString
276276
if (!_indeterminate) {
277277
NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
278278
formatter.numberStyle = NSNumberFormatterPercentStyle;
279-
return [NSString stringWithFormat:@"\n%@",[formatter stringFromNumber:[NSNumber numberWithFloat:_progress]]];
279+
return [NSString stringWithFormat:@"\n%@",[formatter stringFromNumber:[NSNumber numberWithFloat:(float)_progress]]];
280280
} else {
281281
return @"\n??%";
282282
}

Classes/NavigationController/UINavigationController+M13ProgressViewBar.m

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ - (void)updateProgressWithInterfaceOrientation:(UIInterfaceOrientation)interface
215215
//Layout
216216
if (![self getIndeterminate]) {
217217
//Calculate the width of the progress view;
218-
float progressWidth = width * [self getProgress];
218+
float progressWidth = (float)width * (float)[self getProgress];
219219
//Set the frame of the progress view
220220
progressView.frame = CGRectMake(0, height - 2.5, progressWidth, 2.5);
221221
} else {
@@ -361,7 +361,7 @@ - (CADisplayLink *)getDisplayLink
361361

362362
- (void)setAnimationFromValue:(CGFloat)animationFromValue
363363
{
364-
objc_setAssociatedObject(self, &animationFromKey, [NSNumber numberWithFloat:animationFromValue], OBJC_ASSOCIATION_RETAIN_NONATOMIC);
364+
objc_setAssociatedObject(self, &animationFromKey, [NSNumber numberWithFloat:(float)animationFromValue], OBJC_ASSOCIATION_RETAIN_NONATOMIC);
365365
}
366366

367367
- (CGFloat)getAnimationFromValue
@@ -372,7 +372,7 @@ - (CGFloat)getAnimationFromValue
372372

373373
- (void)setAnimationToValue:(CGFloat)animationToValue
374374
{
375-
objc_setAssociatedObject(self, &animationToKey, [NSNumber numberWithFloat:animationToValue], OBJC_ASSOCIATION_RETAIN_NONATOMIC);
375+
objc_setAssociatedObject(self, &animationToKey, [NSNumber numberWithFloat:(float)animationToValue], OBJC_ASSOCIATION_RETAIN_NONATOMIC);
376376
}
377377

378378
- (CGFloat)getAnimationToValue
@@ -383,7 +383,7 @@ - (CGFloat)getAnimationToValue
383383

384384
- (void)setAnimationStartTime:(NSTimeInterval)animationStartTime
385385
{
386-
objc_setAssociatedObject(self, &animationStartTimeKey, [NSNumber numberWithFloat:animationStartTime], OBJC_ASSOCIATION_RETAIN_NONATOMIC);
386+
objc_setAssociatedObject(self, &animationStartTimeKey, [NSNumber numberWithFloat:(float)animationStartTime], OBJC_ASSOCIATION_RETAIN_NONATOMIC);
387387
}
388388

389389
- (NSTimeInterval)getAnimationStartTime
@@ -399,7 +399,7 @@ - (void)setProgress:(CGFloat)progress
399399
} else if (progress < 0.0) {
400400
progress = 0.0;
401401
}
402-
objc_setAssociatedObject(self, &progressKey, [NSNumber numberWithFloat:progress], OBJC_ASSOCIATION_RETAIN_NONATOMIC);
402+
objc_setAssociatedObject(self, &progressKey, [NSNumber numberWithFloat:(float)progress], OBJC_ASSOCIATION_RETAIN_NONATOMIC);
403403
//Draw the update
404404
if ([NSThread isMainThread]) {
405405
[self updateProgress];

Classes/ProgressViews/M13ProgressViewBar.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ - (void)setIndeterminate:(BOOL)indeterminate
373373
//Remove all animations
374374
[_indeterminateLayer removeAnimationForKey:@"position"];
375375
//Reset progress text
376-
_percentageLabel.string = [_percentageFormatter stringFromNumber:[NSNumber numberWithFloat:self.progress]];
376+
_percentageLabel.string = [_percentageFormatter stringFromNumber:[NSNumber numberWithFloat:(float)self.progress]];
377377
}
378378
}
379379

@@ -600,7 +600,7 @@ - (void)drawRect:(CGRect)rect
600600
_percentageLabel.string = @"";
601601
} else if (_currentAction == M13ProgressViewActionNone) {
602602
if (!self.indeterminate) {
603-
_percentageLabel.string = [_percentageFormatter stringFromNumber:[NSNumber numberWithFloat:self.progress]];
603+
_percentageLabel.string = [_percentageFormatter stringFromNumber:[NSNumber numberWithFloat:(float)self.progress]];
604604
} else {
605605
_percentageLabel.string = @"";
606606
}

Classes/ProgressViews/M13ProgressViewBorderedBar.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,18 +202,18 @@ - (void)setProgress:(CGFloat)progress animated:(BOOL)animated
202202
- (void)animateProgress:(CADisplayLink *)displayLink
203203
{
204204
dispatch_async(dispatch_get_main_queue(), ^{
205-
CGFloat dt = (displayLink.timestamp - _animationStartTime) / self.animationDuration;
205+
CGFloat dt = (displayLink.timestamp - self.animationStartTime) / self.animationDuration;
206206
if (dt >= 1.0) {
207207
//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.
208208
[self.displayLink invalidate];
209209
self.displayLink = nil;
210-
[super setProgress:_animationToValue animated:NO];
210+
[super setProgress:self.animationToValue animated:NO];
211211
[self setNeedsDisplay];
212212
return;
213213
}
214214

215215
//Set progress
216-
[super setProgress:_animationFromValue + dt * (_animationToValue - _animationFromValue) animated:YES];
216+
[super setProgress:self.animationFromValue + dt * (self.animationToValue - self.animationFromValue) animated:YES];
217217
[self setNeedsDisplay];
218218

219219
});

Classes/ProgressViews/M13ProgressViewImage.m

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -134,18 +134,18 @@ - (void)setProgress:(CGFloat)progress animated:(BOOL)animated
134134
- (void)animateProgress:(CADisplayLink *)displayLink
135135
{
136136
dispatch_async(dispatch_get_main_queue(), ^{
137-
CGFloat dt = (displayLink.timestamp - _animationStartTime) / self.animationDuration;
137+
CGFloat dt = (displayLink.timestamp - self.animationStartTime) / self.animationDuration;
138138
if (dt >= 1.0) {
139139
//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.
140140
[self.displayLink invalidate];
141141
self.displayLink = nil;
142-
[super setProgress:_animationToValue animated:NO];
142+
[super setProgress:self.animationToValue animated:NO];
143143
[self setNeedsDisplay];
144144
return;
145145
}
146146

147147
//Set progress
148-
[super setProgress:_animationFromValue + dt * (_animationToValue - _animationFromValue) animated:YES];
148+
[super setProgress:self.animationFromValue + dt * (self.animationToValue - self.animationFromValue) animated:YES];
149149
[self setNeedsDisplay];
150150

151151
});
@@ -194,8 +194,8 @@ - (UIImage *)createImageForCurrentProgress
194194
//Create image rectangle with current image width/height
195195
CGRect imageRect = CGRectMake(0, 0, _progressImage.size.width * _progressImage.scale, _progressImage.size.height * _progressImage.scale);
196196

197-
int width = imageRect.size.width;
198-
int height = imageRect.size.height;
197+
int width = (int)imageRect.size.width;
198+
int height = (int)imageRect.size.height;
199199

200200
//The pixels will be painted to this array
201201
uint32_t *pixels = (uint32_t *) malloc(width * height * sizeof(uint32_t));
@@ -218,23 +218,23 @@ - (UIImage *)createImageForCurrentProgress
218218
int yTo = height;
219219

220220
if (_progressDirection == M13ProgressViewImageProgressDirectionBottomToTop) {
221-
yTo = height * (1 - self.progress);
221+
yTo = height * (int)(1 - self.progress);
222222
} else if (_progressDirection == M13ProgressViewImageProgressDirectionTopToBottom) {
223-
yFrom = height * self.progress;
223+
yFrom = height * (int)self.progress;
224224
} else if (_progressDirection == M13ProgressViewImageProgressDirectionLeftToRight) {
225-
xFrom = width * self.progress;
225+
xFrom = width * (int)self.progress;
226226
} else if (_progressDirection == M13ProgressViewImageProgressDirectionRightToLeft) {
227-
xTo = width * (1 - self.progress);
227+
xTo = width * (int)(1 - self.progress);
228228
}
229229

230230
for (int x = xFrom; x < xTo; x++) {
231231
for (int y = yFrom; y < yTo; y++) {
232232
//Get the pixel
233-
uint8_t *rgbaPixel = (uint8_t *) &pixels[y * width + x];
233+
uint32_t *rgbaPixel = (uint32_t *) &pixels[y * width + x];
234234
//Convert
235235
if (_drawGreyscaleBackground) {
236236
//Convert to grayscale using luma coding: http://en.wikipedia.org/wiki/Grayscale#Converting_color_to_grayscale
237-
uint32_t gray = 0.3 * rgbaPixel[RED] + 0.59 * rgbaPixel[GREEN] + 0.11 * rgbaPixel[BLUE];
237+
uint32_t gray = (uint32_t)(0.3 * rgbaPixel[RED] + 0.59 * rgbaPixel[GREEN] + 0.11 * rgbaPixel[BLUE]);
238238
// set the pixels to gray
239239
rgbaPixel[RED] = gray;
240240
rgbaPixel[GREEN] = gray;

Classes/ProgressViews/M13ProgressViewPie.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ - (void)setup
8585

8686
//Set defaut sizes
8787
_backgroundRingWidthOverriden = NO;
88-
_backgroundRingWidth = fmaxf(self.bounds.size.width * .025, 1.0);
88+
_backgroundRingWidth = fmaxf((float)self.bounds.size.width * .025f, 1.0);
8989

9090
self.animationDuration = .3;
9191

Classes/ProgressViews/M13ProgressViewRing.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,18 +209,18 @@ - (void)setProgress:(CGFloat)progress animated:(BOOL)animated
209209
- (void)animateProgress:(CADisplayLink *)displayLink
210210
{
211211
dispatch_async(dispatch_get_main_queue(), ^{
212-
CGFloat dt = (displayLink.timestamp - _animationStartTime) / self.animationDuration;
212+
CGFloat dt = (displayLink.timestamp - self.animationStartTime) / self.animationDuration;
213213
if (dt >= 1.0) {
214214
//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.
215215
[self.displayLink invalidate];
216216
self.displayLink = nil;
217-
[super setProgress:_animationToValue animated:NO];
217+
[super setProgress:self.animationToValue animated:NO];
218218
[self setNeedsDisplay];
219219
return;
220220
}
221221

222222
//Set progress
223-
[super setProgress:_animationFromValue + dt * (_animationToValue - _animationFromValue) animated:YES];
223+
[super setProgress:self.animationFromValue + dt * (self.animationToValue - self.animationFromValue) animated:YES];
224224
[self setNeedsDisplay];
225225

226226
});
@@ -306,7 +306,7 @@ - (void)setIndeterminate:(BOOL)indeterminate
306306
[_percentageLabel.layer addAnimation:[self showAnimation] forKey:kM13ProgressViewRingShowKey];
307307
[CATransaction setCompletionBlock:^{
308308
//Remove the rotation animation and reset the background
309-
[_backgroundLayer removeAnimationForKey:@"rotationAnimation"];
309+
[self.backgroundLayer removeAnimationForKey:@"rotationAnimation"];
310310
[self drawBackground];
311311
}];
312312
[CATransaction commit];

Classes/ProgressViews/M13ProgressViewSegmentedBar.m

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -204,18 +204,18 @@ - (void)setProgress:(CGFloat)progress animated:(BOOL)animated
204204
- (void)animateProgress:(CADisplayLink *)displayLink
205205
{
206206
dispatch_async(dispatch_get_main_queue(), ^{
207-
CGFloat dt = (displayLink.timestamp - _animationStartTime) / self.animationDuration;
207+
CGFloat dt = (displayLink.timestamp - self.animationStartTime) / self.animationDuration;
208208
if (dt >= 1.0) {
209209
//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.
210210
[self.displayLink invalidate];
211211
self.displayLink = nil;
212-
[super setProgress:_animationToValue animated:NO];
212+
[super setProgress:self.animationToValue animated:NO];
213213
[self setNeedsDisplay];
214214
return;
215215
}
216216

217217
//Set progress
218-
[super setProgress:_animationFromValue + dt * (_animationToValue - _animationFromValue) animated:YES];
218+
[super setProgress:self.animationFromValue + dt * (self.animationToValue - self.animationFromValue) animated:YES];
219219
[self setNeedsDisplay];
220220

221221
});
@@ -359,7 +359,7 @@ - (void)resetColorsForSegments
359359

360360
- (NSInteger)numberOfFullSegments
361361
{
362-
return (NSInteger)floorf(self.progress * _numberOfSegments);
362+
return (NSInteger)floorf((float)self.progress * (float)_numberOfSegments);
363363
}
364364

365365
- (UIColor *)colorForSegment:(NSUInteger)index
@@ -393,7 +393,7 @@ - (void)drawProgress
393393
if (_segmentShape == M13ProgressViewSegmentedBarSegmentShapeRoundedRect) {
394394
cornerRadius = _cornerRadius;
395395
} else if (_segmentShape == M13ProgressViewSegmentedBarSegmentShapeCircle) {
396-
cornerRadius = floorf(self.bounds.size.height < segmentWidth ? self.bounds.size.height / 2.0 : segmentWidth / 2.0);
396+
cornerRadius = floorf(self.bounds.size.height < segmentWidth ? (float)self.bounds.size.height / 2.0f : (float)segmentWidth / 2.0f);
397397
}
398398

399399
//Iterate through all the segments that are full.
@@ -470,7 +470,7 @@ - (void)drawIndeterminate
470470
if (_segmentShape == M13ProgressViewSegmentedBarSegmentShapeRoundedRect) {
471471
cornerRadius = _cornerRadius;
472472
} else if (_segmentShape == M13ProgressViewSegmentedBarSegmentShapeCircle) {
473-
cornerRadius = floorf(self.bounds.size.height < segmentWidth ? self.bounds.size.height / 2.0 : segmentWidth / 2.0);
473+
cornerRadius = floorf(self.bounds.size.height < segmentWidth ? (float)self.bounds.size.height / 2.0f : (float)segmentWidth / 2.0f);
474474
}
475475
//What index will the segments be colored from.
476476
NSInteger numberOfSegmentsToBeColored = _numberOfSegments / 4;

Classes/ProgressViews/M13ProgressViewSegmentedRing.m

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -233,18 +233,18 @@ - (void)setProgress:(CGFloat)progress animated:(BOOL)animated
233233
- (void)animateProgress:(CADisplayLink *)displayLink
234234
{
235235
dispatch_async(dispatch_get_main_queue(), ^{
236-
CGFloat dt = (displayLink.timestamp - _animationStartTime) / self.animationDuration;
236+
CGFloat dt = (displayLink.timestamp - self.animationStartTime) / self.animationDuration;
237237
if (dt >= 1.0) {
238238
//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.
239239
[self.displayLink invalidate];
240240
self.displayLink = nil;
241-
[super setProgress:_animationToValue animated:NO];
241+
[super setProgress:self.animationToValue animated:NO];
242242
[self setNeedsDisplay];
243243
return;
244244
}
245245

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

250250
});
@@ -274,9 +274,9 @@ - (void)performAction:(M13ProgressViewAction)action animated:(BOOL)animated
274274
[CATransaction begin];
275275
[_iconLayer addAnimation:[self hideAnimation] forKey:kM13ProgressViewSegmentedRingHideKey];
276276
[CATransaction setCompletionBlock:^{
277-
_currentAction = action;
277+
self.currentAction = action;
278278
[self drawIcon];
279-
[_iconLayer addAnimation:[self showAnimation] forKey:kM13ProgressViewSegmentedRingShowKey];
279+
[self.iconLayer addAnimation:[self showAnimation] forKey:kM13ProgressViewSegmentedRingShowKey];
280280
}];
281281
[CATransaction commit];
282282
}
@@ -294,9 +294,9 @@ - (void)performAction:(M13ProgressViewAction)action animated:(BOOL)animated
294294
[CATransaction begin];
295295
[_iconLayer addAnimation:[self hideAnimation] forKey:kM13ProgressViewSegmentedRingHideKey];
296296
[CATransaction setCompletionBlock:^{
297-
_currentAction = action;
297+
self.currentAction = action;
298298
[self drawIcon];
299-
[_iconLayer addAnimation:[self showAnimation] forKey:kM13ProgressViewSegmentedRingShowKey];
299+
[self.iconLayer addAnimation:[self showAnimation] forKey:kM13ProgressViewSegmentedRingShowKey];
300300
}];
301301
[CATransaction commit];
302302
}
@@ -333,8 +333,8 @@ - (void)setIndeterminate:(BOOL)indeterminate
333333
[_percentageLabel.layer addAnimation:[self showAnimation] forKey:kM13ProgressViewSegmentedRingShowKey];
334334
[CATransaction setCompletionBlock:^{
335335
//Remove the rotation animation and reset the background
336-
[_backgroundLayer removeAnimationForKey:@"rotationAnimation"];
337-
[_progressLayer removeAnimationForKey:@"rotationAnimation"];
336+
[self.backgroundLayer removeAnimationForKey:@"rotationAnimation"];
337+
[self.progressLayer removeAnimationForKey:@"rotationAnimation"];
338338
[self drawBackground];
339339
[self drawProgress];
340340
}];

0 commit comments

Comments
 (0)