Skip to content

Commit 2dc60bd

Browse files
committed
Coding style (use 0.0f instead of just 0), turned on a bunch of warnings (and then fixed them).
1 parent 5b4f753 commit 2dc60bd

35 files changed

Lines changed: 224 additions & 330 deletions

NSBezierPathAdditions.m

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ + (NSBezierPath *)AE_bezierPathWithRoundRect:(NSRect)aRect
3535
cornerRadius:(float)radius
3636
{
3737
NSBezierPath *const path = [self bezierPath];
38-
[path appendBezierPathWithArcWithCenter:NSMakePoint(NSMaxX(aRect) - radius, NSMaxY(aRect) - radius) radius:radius startAngle:0 endAngle:90];
39-
[path appendBezierPathWithArcWithCenter:NSMakePoint(NSMinX(aRect) + radius, NSMaxY(aRect) - radius) radius:radius startAngle:90 endAngle:180];
40-
[path appendBezierPathWithArcWithCenter:NSMakePoint(NSMinX(aRect) + radius, NSMinY(aRect) + radius) radius:radius startAngle:180 endAngle:270];
41-
[path appendBezierPathWithArcWithCenter:NSMakePoint(NSMaxX(aRect) - radius, NSMinY(aRect) + radius) radius:radius startAngle:270 endAngle:0];
38+
[path appendBezierPathWithArcWithCenter:NSMakePoint(NSMaxX(aRect) - radius, NSMaxY(aRect) - radius) radius:radius startAngle:0.0f endAngle:90.0f];
39+
[path appendBezierPathWithArcWithCenter:NSMakePoint(NSMinX(aRect) + radius, NSMaxY(aRect) - radius) radius:radius startAngle:90.0f endAngle:180.0f];
40+
[path appendBezierPathWithArcWithCenter:NSMakePoint(NSMinX(aRect) + radius, NSMinY(aRect) + radius) radius:radius startAngle:180.0f endAngle:270.0f];
41+
[path appendBezierPathWithArcWithCenter:NSMakePoint(NSMaxX(aRect) - radius, NSMinY(aRect) + radius) radius:radius startAngle:270.0f endAngle:0.0f];
4242
[path closePath];
4343
return path;
4444
}
@@ -50,15 +50,15 @@ + (void)AE_drawIcon:(AEIconType)type
5050
switch(type) {
5151
case AEPlayIcon:
5252
{
53-
float const r = scale / 10;
54-
[p appendBezierPathWithArcWithCenter:NSMakePoint(NSMaxX(b) - r, NSMidY(b)) radius:r startAngle:60 endAngle:-60 clockwise:YES];
55-
[p appendBezierPathWithArcWithCenter:NSMakePoint(NSMinX(b) + NSWidth(b) * 0.1f + r, NSMinY(b) + NSHeight(b) * 0.05f + r * 1.0f) radius:r startAngle:-60 endAngle:180 clockwise:YES];
56-
[p appendBezierPathWithArcWithCenter:NSMakePoint(NSMinX(b) + NSWidth(b) * 0.1f + r, NSMinY(b) + NSHeight(b) * 0.95f - r * 1.0f) radius:r startAngle:180 endAngle:60 clockwise:YES];
53+
float const r = scale / 10.0f;
54+
[p appendBezierPathWithArcWithCenter:NSMakePoint(NSMaxX(b) - r, NSMidY(b)) radius:r startAngle:60.0f endAngle:-60.0f clockwise:YES];
55+
[p appendBezierPathWithArcWithCenter:NSMakePoint(NSMinX(b) + NSWidth(b) * 0.1f + r, NSMinY(b) + NSHeight(b) * 0.05f + r * 1.0f) radius:r startAngle:-60.0f endAngle:180.0f clockwise:YES];
56+
[p appendBezierPathWithArcWithCenter:NSMakePoint(NSMinX(b) + NSWidth(b) * 0.1f + r, NSMinY(b) + NSHeight(b) * 0.95f - r * 1.0f) radius:r startAngle:180.0f endAngle:60.0f clockwise:YES];
5757
[p fill];
5858
break;
5959
}
6060
case AEPauseIcon:
61-
[p setLineWidth:scale / 4];
61+
[p setLineWidth:scale / 4.0f];
6262
[p setLineCapStyle:NSRoundLineCapStyle];
6363
[p moveToPoint:NSMakePoint(NSMinX(b) + NSWidth(b) * 0.25f, NSMinY(b) + NSHeight(b) * 0.85f)];
6464
[p lineToPoint:NSMakePoint(NSMinX(b) + NSWidth(b) * 0.25f, NSMinY(b) + NSHeight(b) * 0.15f)];
@@ -75,12 +75,12 @@ + (void)AE_drawIcon:(AEIconType)type
7575
+ (void)AE_drawSpinnerInRect:(NSRect)r
7676
startAtPetal:(int)petal
7777
{
78-
[NSBezierPath setDefaultLineWidth:MIN(NSWidth(r), NSHeight(r)) / 11];
78+
[NSBezierPath setDefaultLineWidth:MIN(NSWidth(r), NSHeight(r)) / 11.0f];
7979
[NSBezierPath setDefaultLineCapStyle:NSRoundLineCapStyle];
8080
unsigned i = 0;
8181
for(; i < 12; i++) {
82-
[[[NSColor AE_bezelForegroundColor] colorWithAlphaComponent:petal < 0 ? 0.1f : ((petal + i) % 12) / -12.0f + 1] set];
83-
[NSBezierPath strokeLineFromPoint:NSMakePoint(NSMidX(r) + cosf(pi * 2.0f * i / 12.0f) * NSWidth(r) / 4.0f, NSMidY(r) + sinf(pi * 2.0f * i / 12.0f) * NSHeight(r) / 4.0f) toPoint:NSMakePoint(NSMidX(r) + cosf(pi * 2.0f * i / 12.0f) * NSWidth(r) / 2.0f, NSMidY(r) + sinf(pi * 2.0f * i / 12.0f) * NSHeight(r) / 2.0f)];
82+
[[[NSColor AE_bezelForegroundColor] colorWithAlphaComponent:petal < 0.0f ? 0.1f : ((petal + i) % 12) / -12.0f + 1.0f] set];
83+
[NSBezierPath strokeLineFromPoint:NSMakePoint(NSMidX(r) + cosf((float)pi * 2.0f * i / 12.0f) * NSWidth(r) / 4.0f, NSMidY(r) + sinf((float)pi * 2.0f * i / 12.0f) * NSHeight(r) / 4.0f) toPoint:NSMakePoint(NSMidX(r) + cosf((float)pi * 2.0f * i / 12.0f) * NSWidth(r) / 2.0f, NSMidY(r) + sinf((float)pi * 2.0f * i / 12.0f) * NSHeight(r) / 2.0f)];
8484
}
8585
[NSBezierPath setDefaultLineWidth:1];
8686
[NSBezierPath setDefaultLineCapStyle:NSMiterLineJoinStyle];

NSColorAdditions.m

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@
2424
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
2525
#import "NSColorAdditions.h"
2626

27-
#define PGCheckerboardSquareSize 8
28-
#define PGCheckerboardSize (PGCheckerboardSquareSize * 2)
27+
#define PGCheckerboardSquareSize 8.0f
28+
#define PGCheckerboardSize (PGCheckerboardSquareSize * 2.0f)
2929

3030
@implementation NSColor (AEAdditions)
3131

3232
#pragma mark +NSColor(AEAdditions)
3333

3434
+ (NSColor *)AE_bezelBackgroundColor
3535
{
36-
return [NSColor colorWithDeviceWhite:(48.0f / 255.0f) alpha:0.75f];
36+
return [NSColor colorWithDeviceWhite:48.0f / 255.0f alpha:0.75f];
3737
}
3838
+ (NSColor *)AE_bezelForegroundColor
3939
{
@@ -47,13 +47,13 @@ - (NSColor *)AE_checkerboardPatternColor
4747
NSImage *const checkerboard = [[[NSImage alloc] initWithSize:NSMakeSize(PGCheckerboardSize, PGCheckerboardSize)] autorelease];
4848
[checkerboard lockFocus];
4949
[self set];
50-
NSRectFill(NSMakeRect(0, 0, PGCheckerboardSize, PGCheckerboardSize));
51-
[[NSColor colorWithDeviceWhite:1 alpha:0.07] set];
50+
NSRectFill(NSMakeRect(0.0f, 0.0f, PGCheckerboardSize, PGCheckerboardSize));
51+
[[NSColor colorWithDeviceWhite:1.0f alpha:0.07f] set];
5252
NSRectFillUsingOperation(NSMakeRect(0, 0, PGCheckerboardSquareSize, PGCheckerboardSquareSize), NSCompositeSourceOver);
5353
NSRectFillUsingOperation(NSMakeRect(PGCheckerboardSquareSize, PGCheckerboardSquareSize, PGCheckerboardSquareSize, PGCheckerboardSquareSize), NSCompositeSourceOver);
54-
[[NSColor colorWithDeviceWhite:0 alpha:0.07] set];
55-
NSRectFillUsingOperation(NSMakeRect(0, PGCheckerboardSquareSize, PGCheckerboardSquareSize, PGCheckerboardSquareSize), NSCompositeSourceOver);
56-
NSRectFillUsingOperation(NSMakeRect(PGCheckerboardSquareSize, 0, PGCheckerboardSquareSize, PGCheckerboardSquareSize), NSCompositeSourceOver);
54+
[[NSColor colorWithDeviceWhite:0.0f alpha:0.07f] set];
55+
NSRectFillUsingOperation(NSMakeRect(0.0f, PGCheckerboardSquareSize, PGCheckerboardSquareSize, PGCheckerboardSquareSize), NSCompositeSourceOver);
56+
NSRectFillUsingOperation(NSMakeRect(PGCheckerboardSquareSize, 0.0f, PGCheckerboardSquareSize, PGCheckerboardSquareSize), NSCompositeSourceOver);
5757
[checkerboard unlockFocus];
5858
return [NSColor colorWithPatternImage:checkerboard];
5959
}

NSWindowAdditions.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ - (BOOL)AE_isVisible
3333
}
3434
- (float)AE_userSpaceScaleFactor
3535
{
36-
return [self respondsToSelector:@selector(userSpaceScaleFactor)] ? [self userSpaceScaleFactor] : 1.0;
36+
return [self respondsToSelector:@selector(userSpaceScaleFactor)] ? [self userSpaceScaleFactor] : 1.0f;
3737
}
3838
- (NSRect)AE_contentRect
3939
{

PGActivityPanelController.m

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232

3333
// Other
3434
#import "PGDelayedPerforming.h"
35+
#import "PGGeometry.h"
3536

3637
// Categories
3738
#import "NSObjectAdditions.h"
@@ -92,7 +93,7 @@ - (id)outlineView:(NSOutlineView *)outlineView
9293
static NSDictionary *attrs = nil;
9394
if(!attrs) {
9495
NSMutableParagraphStyle *const style = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] autorelease];
95-
[style setTighteningFactorForTruncation:0.3];
96+
[style setTighteningFactorForTruncation:0.3f];
9697
[style setLineBreakMode:NSLineBreakByTruncatingMiddle];
9798
attrs = [[NSDictionary alloc] initWithObjectsAndKeys:style, NSParagraphStyleAttributeName, nil];
9899
}
@@ -124,7 +125,7 @@ - (void)outlineViewSelectionDidChange:(NSNotification *)notification
124125

125126
- (void)windowWillShow
126127
{
127-
_updateTimer = [[self PG_performSelector:@selector(_update) withObject:nil fireDate:nil interval:1.0f / 12.0f options:PGRetainTarget] retain];
128+
_updateTimer = [[self PG_performSelector:@selector(_update) withObject:nil fireDate:nil interval:PGAnimationFramerate / 2.0f options:PGRetainTarget] retain];
128129
[self _update];
129130
}
130131
- (void)windowDidClose

PGAlertView.m

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
#import "NSObjectAdditions.h"
3838

3939
#define PGAlertViewSize 100.0f
40-
#define PGMarginSize 4.0
40+
#define PGMarginSize 4.0f
4141

4242
@interface PGAlertView (Private)
4343

@@ -74,7 +74,7 @@ - (void)pushGraphic:(PGAlertGraphic *)aGraphic
7474
[self _updateCurrentGraphic];
7575
}
7676
NSTimeInterval const fadeOutDelay = [_currentGraphic fadeOutDelay];
77-
if(fadeOutDelay >= 0.01) [self PG_performSelector:@selector(popGraphicIdenticalTo:) withObject:_currentGraphic fireDate:nil interval:-fadeOutDelay options:PGCompareArgumentPointer];
77+
if(fadeOutDelay >= 0.01f) [self PG_performSelector:@selector(popGraphicIdenticalTo:) withObject:_currentGraphic fireDate:nil interval:-fadeOutDelay options:PGCompareArgumentPointer];
7878
if(window && [[self window] respondsToSelector:@selector(displayOverWindow:)]) [(PGBezelPanel *)[self window] displayOverWindow:window];
7979
}
8080
- (void)popGraphic:(PGAlertGraphic *)aGraphic
@@ -138,7 +138,7 @@ - (void)_updateCurrentGraphic
138138
[_frameTimer invalidate];
139139
_frameCount = 0;
140140
NSTimeInterval const animationDelay = [_currentGraphic animationDelay];
141-
_frameTimer = animationDelay > 0 ? [self PG_performSelector:@selector(animateOneFrame:) withObject:self fireDate:nil interval:animationDelay options:PGRetainTarget] : nil;
141+
_frameTimer = animationDelay > 0.0f ? [self PG_performSelector:@selector(animateOneFrame:) withObject:self fireDate:nil interval:animationDelay options:PGRetainTarget] : nil;
142142
[self setNeedsDisplay:YES];
143143
}
144144

@@ -259,22 +259,22 @@ - (void)drawInView:(PGAlertView *)anAlertView
259259
[[NSColor AE_bezelBackgroundColor] set];
260260
NSBezierPath *const path = [NSBezierPath bezierPath];
261261
[path moveToPoint:centers[i]];
262-
[path appendBezierPathWithArcWithCenter:centers[i] radius:50.0f * f startAngle:90 * i endAngle:90 * (i + 1)];
262+
[path appendBezierPathWithArcWithCenter:centers[i] radius:50.0f * f startAngle:90.0f * i endAngle:90.0f * (i + 1)];
263263
[path closePath];
264264
[path fill];
265265
}
266266

267267
NSShadow *const shadow = [[[NSShadow alloc] init] autorelease];
268-
[shadow setShadowBlurRadius:4];
269-
[shadow setShadowOffset:NSMakeSize(0, -1)];
268+
[shadow setShadowBlurRadius:4.0f];
269+
[shadow setShadowOffset:NSMakeSize(0.0f, -1.0f)];
270270
[shadow setShadowColor:[NSColor blackColor]];
271271
[shadow set];
272272
}
273273
- (void)flipHorizontally
274274
{
275275
NSAffineTransform *const flip = [[[NSAffineTransform alloc] init] autorelease];
276-
[flip translateXBy:PGAlertViewSize yBy:0];
277-
[flip scaleXBy:-1 yBy:1];
276+
[flip translateXBy:PGAlertViewSize yBy:0.0f];
277+
[flip scaleXBy:-1.0f yBy:1.0f];
278278
[flip concat];
279279
}
280280
- (NSTimeInterval)fadeOutDelay
@@ -286,7 +286,7 @@ - (NSTimeInterval)fadeOutDelay
286286

287287
- (NSTimeInterval)animationDelay
288288
{
289-
return 0;
289+
return 0.0f;
290290
}
291291
- (unsigned)frameMax
292292
{
@@ -321,15 +321,15 @@ - (void)drawInView:(PGAlertView *)anAlertView
321321
[[NSColor AE_bezelForegroundColor] set];
322322

323323
NSBezierPath *const arrow = [NSBezierPath bezierPath];
324-
[arrow appendBezierPathWithArcWithCenter:NSMakePoint(180.0f * f, 150.0f * f) radius:large startAngle:315 endAngle:45];
325-
[arrow appendBezierPathWithArcWithCenter:NSMakePoint(140.0f * f, 200.0f * f) radius:small startAngle:45 endAngle:90];
326-
[arrow appendBezierPathWithArcWithCenter:NSMakePoint(125.0f * f, 200.0f * f) radius:small startAngle:90 endAngle:180];
327-
[arrow appendBezierPathWithArcWithCenter:NSMakePoint(115.0f * f, 180.0f * f) radius:small startAngle:0 endAngle:270 clockwise:YES];
328-
[arrow appendBezierPathWithArcWithCenter:NSMakePoint( 75.0f * f, 170.0f * f) radius:small startAngle:90 endAngle:180];
329-
[arrow appendBezierPathWithArcWithCenter:NSMakePoint( 75.0f * f, 130.0f * f) radius:small startAngle:180 endAngle:270];
330-
[arrow appendBezierPathWithArcWithCenter:NSMakePoint(115.0f * f, 120.0f * f) radius:small startAngle:90 endAngle:0 clockwise:YES];
331-
[arrow appendBezierPathWithArcWithCenter:NSMakePoint(125.0f * f, 100.0f * f) radius:small startAngle:180 endAngle:270];
332-
[arrow appendBezierPathWithArcWithCenter:NSMakePoint(140.0f * f, 100.0f * f) radius:small startAngle:270 endAngle:315];
324+
[arrow appendBezierPathWithArcWithCenter:NSMakePoint(180.0f * f, 150.0f * f) radius:large startAngle:315.0f endAngle:45.0f];
325+
[arrow appendBezierPathWithArcWithCenter:NSMakePoint(140.0f * f, 200.0f * f) radius:small startAngle:45.0f endAngle:90.0f];
326+
[arrow appendBezierPathWithArcWithCenter:NSMakePoint(125.0f * f, 200.0f * f) radius:small startAngle:90.0f endAngle:180.0f];
327+
[arrow appendBezierPathWithArcWithCenter:NSMakePoint(115.0f * f, 180.0f * f) radius:small startAngle:0.0f endAngle:270.0f clockwise:YES];
328+
[arrow appendBezierPathWithArcWithCenter:NSMakePoint( 75.0f * f, 170.0f * f) radius:small startAngle:90.0f endAngle:180.0f];
329+
[arrow appendBezierPathWithArcWithCenter:NSMakePoint( 75.0f * f, 130.0f * f) radius:small startAngle:180.0f endAngle:270.0f];
330+
[arrow appendBezierPathWithArcWithCenter:NSMakePoint(115.0f * f, 120.0f * f) radius:small startAngle:90.0f endAngle:0.0f clockwise:YES];
331+
[arrow appendBezierPathWithArcWithCenter:NSMakePoint(125.0f * f, 100.0f * f) radius:small startAngle:180.0f endAngle:270.0f];
332+
[arrow appendBezierPathWithArcWithCenter:NSMakePoint(140.0f * f, 100.0f * f) radius:small startAngle:270.0f endAngle:315.0f];
333333
[arrow fill];
334334

335335
NSBezierPath *const wall = [NSBezierPath bezierPath];
@@ -420,7 +420,7 @@ - (float)progress
420420
}
421421
- (void)setProgress:(float)progress
422422
{
423-
_progress = MIN(MAX(progress, 0), 1);
423+
_progress = MIN(MAX(progress, 0.0f), 1.0f);
424424
}
425425

426426
#pragma mark NSObject Protocol
@@ -460,7 +460,7 @@ - (NSTimeInterval)fadeOutDelay
460460

461461
- (NSTimeInterval)animationDelay
462462
{
463-
return 1.0 / 12.0;
463+
return 1.0f / 12.0f;
464464
}
465465
- (unsigned)frameMax
466466
{

PGArchiveAdapter.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ - (NSStringEncoding)archive:(XADArchive *)archive
230230
guess:(NSStringEncoding)guess
231231
confidence:(float)confidence
232232
{
233-
if(confidence < 0.8 && !_encodingError) {
233+
if(confidence < 0.8f && !_encodingError) {
234234
_encodingError = YES;
235235
[[self node] setError:[NSError errorWithDomain:PGNodeErrorDomain code:PGEncodingError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSData dataWithBytes:bytes length:strlen(bytes)], PGUnencodedStringDataKey, [NSNumber numberWithUnsignedInt:guess], PGDefaultEncodingKey, nil]]];
236236
[[self node] loadFinished];

PGAttachments.m

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ - (void)drawWithFrame:(NSRect)aRect
8787
{
8888
NSImage *const image = [NSImage imageNamed:[self imageNameHighlighted:highlighted]];
8989
[image setFlipped:YES];
90-
[image drawInRect:aRect fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:(enabled ? 1.0 : 0.5)];
90+
[image drawInRect:aRect fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:enabled ? 1.0f : 0.5f];
9191
}
9292
- (NSString *)imageNameHighlighted:(BOOL)flag
9393
{
@@ -110,11 +110,11 @@ - (void)drawWithFrame:(NSRect)aRect
110110
}
111111
- (NSSize)cellSize
112112
{
113-
return NSMakeSize(16, 16);
113+
return NSMakeSize(16.0f, 16.0f);
114114
}
115115
- (NSPoint)cellBaselineOffset
116116
{
117-
return NSMakePoint(0, -3);
117+
return NSMakePoint(0.0f, -3.0f);
118118
}
119119

120120
@end
@@ -151,16 +151,16 @@ - (void)drawWithFrame:(NSRect)aRect
151151
[NSGraphicsContext saveGraphicsState];
152152
[[NSGraphicsContext currentContext] setImageInterpolation:NSImageInterpolationHigh];
153153
[[self image] setFlipped:YES];
154-
[[self image] drawInRect:aRect fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0];
154+
[[self image] drawInRect:aRect fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0f];
155155
[NSGraphicsContext restoreGraphicsState];
156156
}
157157
- (NSSize)cellSize
158158
{
159-
return NSMakeSize(16, 16);
159+
return NSMakeSize(16.0f, 16.0f);
160160
}
161161
- (NSPoint)cellBaselineOffset
162162
{
163-
return NSMakePoint(0, -3);
163+
return NSMakePoint(0.0f, -3.0f);
164164
}
165165

166166
#pragma mark NSCell

0 commit comments

Comments
 (0)