adium 3073:601a5c302322: This is a simpler way..

commits at adium.im commits at adium.im
Thu Dec 24 07:23:52 UTC 2009


details:	http://hg.adium.im/adium/rev/601a5c302322
revision:	3073:601a5c302322
author:		Stephen Holt <sholt at adium.im>
date:		Thu Dec 24 02:19:26 2009 -0500

This is a simpler way..

diffs (47 lines):

diff -r 013794d72087 -r 601a5c302322 Frameworks/AIUtilities Framework/Source/AIColorAdditions.m
--- a/Frameworks/AIUtilities Framework/Source/AIColorAdditions.m	Thu Dec 24 01:51:42 2009 -0500
+++ b/Frameworks/AIUtilities Framework/Source/AIColorAdditions.m	Thu Dec 24 02:19:26 2009 -0500
@@ -372,36 +372,36 @@
 
 - (NSColor *)representedColor
 {
-    NSUInteger	r = 255, g = 255, b = 255;
-    NSUInteger	a = 255;
+    CGFloat	r = 255, g = 255, b = 255;
+    CGFloat	a = 255;
 
 	const char *selfUTF8 = [self UTF8String];
 	
 	//format: r,g,b[,a]
 	//all components are decimal numbers 0..255.
 	if (!isdigit(*selfUTF8)) goto scanFailed;
-	r = strtoul(selfUTF8, (char **)&selfUTF8, /*base*/ 10);
+	r = (CGFloat)strtoul(selfUTF8, (char **)&selfUTF8, /*base*/ 10);
 
 	if(*selfUTF8 == ',') ++selfUTF8;
 	else                 goto scanFailed;
 
 	if (!isdigit(*selfUTF8)) goto scanFailed;
-	g = strtoul(selfUTF8, (char **)&selfUTF8, /*base*/ 10);
+	g = (CGFloat)strtoul(selfUTF8, (char **)&selfUTF8, /*base*/ 10);
 	if(*selfUTF8 == ',') ++selfUTF8;
 	else                 goto scanFailed;
 
 	if (!isdigit(*selfUTF8)) goto scanFailed;
-	b = strtoul(selfUTF8, (char **)&selfUTF8, /*base*/ 10);
+	b = (CGFloat)strtoul(selfUTF8, (char **)&selfUTF8, /*base*/ 10);
 	if (*selfUTF8 == ',') {
 		++selfUTF8;
-		a = strtoul(selfUTF8, (char **)&selfUTF8, /*base*/ 10);
+		a = (CGFloat)strtoul(selfUTF8, (char **)&selfUTF8, /*base*/ 10);
 
 		if (*selfUTF8) goto scanFailed;
 	} else if (*selfUTF8 != '\0') {
 		goto scanFailed;
 	}
 
-    return [NSColor colorWithCalibratedRed:(r/(CGFloat)255.0f) green:(g/(CGFloat)255.0f) blue:(b/(CGFloat)255.0f) alpha:(a/(CGFloat)255.0f)] ;
+    return [NSColor colorWithCalibratedRed:(r/255) green:(g/255) blue:(b/255) alpha:(a/255)] ;
 scanFailed:
 	return nil;
 }




More information about the commits mailing list