adium 2998:0dee7f9417c8: Removing an unused local variable and i...

commits at adium.im commits at adium.im
Mon Nov 30 23:42:12 UTC 2009


details:	http://hg.adium.im/adium/rev/0dee7f9417c8
revision:	2998:0dee7f9417c8
author:		Peter Hosey <hg at boredzo.org>
date:		Mon Nov 30 15:03:01 2009 -0800

Removing an unused local variable and its two dead stores, fixing those analyzer flags.
Subject: adium 2999:04e978ab6aaf: Fixing another dead store flagged by the analyzer.

details:	http://hg.adium.im/adium/rev/04e978ab6aaf
revision:	2999:04e978ab6aaf
author:		Peter Hosey <hg at boredzo.org>
date:		Mon Nov 30 15:03:15 2009 -0800

Fixing another dead store flagged by the analyzer.
Subject: adium 3000:48c84b45ccac: Switch from CFNumber to NSNumber in this AIProgressDataUploader method, fixing a leak (flagged by the analyzer) in the process.

details:	http://hg.adium.im/adium/rev/48c84b45ccac
revision:	3000:48c84b45ccac
author:		Peter Hosey <hg at boredzo.org>
date:		Mon Nov 30 15:04:50 2009 -0800

Switch from CFNumber to NSNumber in this AIProgressDataUploader method, fixing a leak (flagged by the analyzer) in the process.
Subject: adium 3001:968b519f368b: Only attempt to resize the image when we have one. Squelches an analyzer flag.

details:	http://hg.adium.im/adium/rev/968b519f368b
revision:	3001:968b519f368b
author:		Peter Hosey <hg at boredzo.org>
date:		Mon Nov 30 15:28:02 2009 -0800

Only attempt to resize the image when we have one. Squelches an analyzer flag.

diffs (77 lines):

diff -r d5667a09769a -r 968b519f368b Frameworks/AIUtilities Framework/Source/AIAttributedStringAdditions.m
--- a/Frameworks/AIUtilities Framework/Source/AIAttributedStringAdditions.m	Mon Nov 30 09:27:27 2009 -0800
+++ b/Frameworks/AIUtilities Framework/Source/AIAttributedStringAdditions.m	Mon Nov 30 15:28:02 2009 -0800
@@ -158,13 +158,12 @@
 {
     int             index = 0;
     int             stringLength = [self length];
-    float           backgroundBrightness=0.0f, backgroundSum=0.0f;
+    float           backgroundBrightness=0.0f;
     NSColor         *backColor=nil;
     //--get the brightness of our background--
     if (backgroundColor) {
         backColor = [backgroundColor colorUsingColorSpaceName:NSCalibratedRGBColorSpace];
         backgroundBrightness = [backColor brightnessComponent];
-        backgroundSum = [backColor redComponent] + [backColor greenComponent] + [backColor blueComponent];
     }
     
     //we need to scan each colored "chunk" of the message - and check to make sure it is a "visible" color
@@ -202,7 +201,6 @@
         if (!backgroundColor) {
             backColor = fontBackColor;
             backgroundBrightness = [backColor brightnessComponent];
-            backgroundSum = [backColor redComponent] + [backColor greenComponent] + [backColor blueComponent];
         } else {
             deltaBrightness = (brightness - [fontBackColor brightnessComponent]);
             backgroundIsDark = [backgroundColor colorIsDark];
diff -r d5667a09769a -r 968b519f368b Frameworks/AIUtilities Framework/Source/AIColorAdditions.m
--- a/Frameworks/AIUtilities Framework/Source/AIColorAdditions.m	Mon Nov 30 09:27:27 2009 -0800
+++ b/Frameworks/AIUtilities Framework/Source/AIColorAdditions.m	Mon Nov 30 15:28:02 2009 -0800
@@ -598,7 +598,7 @@
 		//we still have one more component to go: this is alpha.
 		//without this component, alpha defaults to 1.0 (see initialiser above).
 		firstChar = *(hexString++);
-		secondChar = (isLong ? *(hexString++) : 0x0);
+		secondChar = (isLong ? *hexString : 0x0);
 		alpha = hexCharsToFloat(firstChar, secondChar);
 	}
 
diff -r d5667a09769a -r 968b519f368b Frameworks/AIUtilities Framework/Source/AIProgressDataUploader.m
--- a/Frameworks/AIUtilities Framework/Source/AIProgressDataUploader.m	Mon Nov 30 09:27:27 2009 -0800
+++ b/Frameworks/AIUtilities Framework/Source/AIProgressDataUploader.m	Mon Nov 30 15:28:02 2009 -0800
@@ -221,11 +221,8 @@
 		return;
 	}
 	
-	NSInteger bytesWritten;
-	CFNumberRef bytesWrittenProperty = (CFNumberRef)CFReadStreamCopyProperty(stream, kCFStreamPropertyHTTPRequestBytesWrittenCount);
-	CFNumberGetValue(bytesWrittenProperty, 
-					 kCFNumberNSIntegerType,
-					 &bytesWritten);
+	NSNumber *bytesWrittenPropertyNum = [NSMakeCollectable(CFReadStreamCopyProperty(stream, kCFStreamPropertyHTTPRequestBytesWrittenCount)) autorelease];
+	NSInteger bytesWritten = [bytesWrittenPropertyNum integerValue];
 
 	if (bytesWritten > bytesSent) {		
 		bytesSent = bytesWritten;
diff -r d5667a09769a -r 968b519f368b Frameworks/Adium Framework/Source/AIAddressBookUserIconSource.m
--- a/Frameworks/Adium Framework/Source/AIAddressBookUserIconSource.m	Mon Nov 30 09:27:27 2009 -0800
+++ b/Frameworks/Adium Framework/Source/AIAddressBookUserIconSource.m	Mon Nov 30 15:28:02 2009 -0800
@@ -136,11 +136,13 @@
 		
 		//Apply the image to the appropriate listObject
 		image = (inData ? [[[NSImage alloc] initWithData:inData] autorelease] : nil);
-		
-		//Address book can feed us giant images, which we really don't want to keep around
-		NSSize size = [image size];
-		if (size.width > 96 || size.height > 96)
-			image = [image imageByScalingToSize:NSMakeSize(96, 96)];
+
+		if (image) {
+			//Address book can feed us giant images, which we really don't want to keep around
+			NSSize size = [image size];
+			if (size.width > 96 || size.height > 96)
+				image = [image imageByScalingToSize:NSMakeSize(96, 96)];
+		}
 		
 		//Get the object from our tracking dictionary
 		setOrObject = [trackingDict objectForKey:tagNumber];




More information about the commits mailing list