adium-1.4 2851:d243ab3ac0b3: Removing an unused local variable a...

commits at adium.im commits at adium.im
Mon Nov 30 23:40:07 UTC 2009


details:	http://hg.adium.im/adium-1.4/rev/d243ab3ac0b3
revision:	2851:d243ab3ac0b3
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-1.4 2852:9903ce85d818: Fixing another dead store flagged by the analyzer.

details:	http://hg.adium.im/adium-1.4/rev/9903ce85d818
revision:	2852:9903ce85d818
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-1.4 2853:60d5ec73ba78: 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-1.4/rev/60d5ec73ba78
revision:	2853:60d5ec73ba78
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-1.4 2854:aa9b93583f52: Only attempt to resize the image when we have one. Squelches an analyzer flag.

details:	http://hg.adium.im/adium-1.4/rev/aa9b93583f52
revision:	2854:aa9b93583f52
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 b9b3e819885f -r aa9b93583f52 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 b9b3e819885f -r aa9b93583f52 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 b9b3e819885f -r aa9b93583f52 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 b9b3e819885f -r aa9b93583f52 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