Permalink
Browse files

Make 64-bit safe.

  • Loading branch information...
uliwitness committed Mar 13, 2010
1 parent f397d2b commit adeeb149cb25c3c59d60d63198495a6cb09322bd
Showing with 8 additions and 5 deletions.
  1. +8 −5 NSArray+Color.m
View
@@ -45,7 +45,7 @@ @implementation NSArray (UKColor)
+(NSArray*) arrayWithColor: (NSColor*) col
{
- float fRed, fGreen, fBlue, fAlpha;
+ CGFloat fRed = 0, fGreen = 0, fBlue = 0, fAlpha = 1.0;
col = [col colorUsingColorSpaceName: NSCalibratedRGBColorSpace];
[col getRed: &fRed green: &fGreen blue: &fBlue alpha: &fAlpha];
@@ -66,11 +66,14 @@ +(NSArray*) arrayWithColor: (NSColor*) col
-(NSColor*) colorValue
{
- float fRed, fGreen, fBlue, fAlpha = 1.0;
+ float fRed = 0, fGreen = 0, fBlue = 0, fAlpha = 1.0;
- fRed = [[self objectAtIndex:0] floatValue];
- fGreen = [[self objectAtIndex:1] floatValue];
- fBlue = [[self objectAtIndex:2] floatValue];
+ if( [self count] >= 3 )
+ {
+ fRed = [[self objectAtIndex:0] floatValue];
+ fGreen = [[self objectAtIndex:1] floatValue];
+ fBlue = [[self objectAtIndex:2] floatValue];
+ }
if( [self count] > 3 ) // Have alpha info?
fAlpha = [[self objectAtIndex:3] floatValue];

0 comments on commit adeeb14

Please sign in to comment.