adium 3409:b4d44fcc32fb: Fix a few warnings, I'm trusting clang ...

commits at adium.im commits at adium.im
Mon Oct 25 23:14:28 UTC 2010


details:	http://hg.adium.im/adium/rev/b4d44fcc32fb
revision:	3409:b4d44fcc32fb
author:		Frank Dowsett <wixardy at adium.im>
date:		Mon Oct 25 19:08:54 2010 -0400

Fix a few warnings, I'm trusting clang here.

diffs (204 lines):

diff -r 2fdac8ac99c3 -r b4d44fcc32fb Frameworks/AIUtilities Framework/Source/AILinkTrackingController.m
--- a/Frameworks/AIUtilities Framework/Source/AILinkTrackingController.m	Mon Oct 25 13:22:24 2010 +0200
+++ b/Frameworks/AIUtilities Framework/Source/AILinkTrackingController.m	Mon Oct 25 19:08:54 2010 -0400
@@ -117,7 +117,7 @@
     glyphIndex = [layoutManager glyphIndexForPoint:mouseLoc inTextContainer:textContainer fractionOfDistanceThroughGlyph:nil];
     charIndex = [layoutManager characterIndexForGlyphAtIndex:glyphIndex];
 	
-    if (charIndex >= 0 && charIndex < [textStorage length]) {
+    if (charIndex != NSNotFound && charIndex < [textStorage length]) {
         NSString	*linkString;
         NSURL		*linkURL;
         NSRange		linkRange;
diff -r 2fdac8ac99c3 -r b4d44fcc32fb Frameworks/AIUtilities Framework/Source/AISystemNetworkDefaults.m
--- a/Frameworks/AIUtilities Framework/Source/AISystemNetworkDefaults.m	Mon Oct 25 13:22:24 2010 +0200
+++ b/Frameworks/AIUtilities Framework/Source/AISystemNetworkDefaults.m	Mon Oct 25 19:08:54 2010 -0400
@@ -106,7 +106,7 @@
 
 					if (error) {
 						NSDictionary *userInfo = [error userInfo];
-						NSLog(@"Could not get username and password for proxy: %@ returned %i (%@)",
+						NSLog(@"Could not get username and password for proxy: %@ returned %ld (%@)",
 							  [userInfo objectForKey:AIKEYCHAIN_ERROR_USERINFO_SECURITYFUNCTIONNAME],
 							  [error code],
 							  [userInfo objectForKey:AIKEYCHAIN_ERROR_USERINFO_ERRORDESCRIPTION]);
@@ -138,7 +138,7 @@
 						if (error) {
 							CFStringRef description = CFErrorCopyDescription(error);
 							
-							NSLog(@"Tried to get PAC, but got error: %@ %d %@",
+							NSLog(@"Tried to get PAC, but got error: %@ %ld %@",
 								  CFErrorGetDomain(error),
 								  CFErrorGetCode(error),
 								  description);
diff -r 2fdac8ac99c3 -r b4d44fcc32fb Frameworks/AIUtilities Framework/Source/AITableViewAdditions.m
--- a/Frameworks/AIUtilities Framework/Source/AITableViewAdditions.m	Mon Oct 25 13:22:24 2010 +0200
+++ b/Frameworks/AIUtilities Framework/Source/AITableViewAdditions.m	Mon Oct 25 19:08:54 2010 -0400
@@ -51,7 +51,7 @@
 - (void)selectItemsInArray:(NSArray *)selectedItems usingSourceArray:(NSArray *)sourceArray
 {
 	if ([sourceArray count] != [self numberOfRows]) {
-		NSLog(@"SourceArray is %i; rows is %i",[sourceArray count],[self numberOfRows]);
+		NSLog(@"SourceArray is %lu; rows is %ld",[sourceArray count],[self numberOfRows]);
 	}
 
 	NSMutableIndexSet *indexes = [NSMutableIndexSet indexSet];
diff -r 2fdac8ac99c3 -r b4d44fcc32fb Frameworks/AIUtilities Framework/Source/NSCalendarDate+ISO8601Parsing.m
--- a/Frameworks/AIUtilities Framework/Source/NSCalendarDate+ISO8601Parsing.m	Mon Oct 25 13:22:24 2010 +0200
+++ b/Frameworks/AIUtilities Framework/Source/NSCalendarDate+ISO8601Parsing.m	Mon Oct 25 19:08:54 2010 -0400
@@ -447,7 +447,7 @@
 							if(*ch == '-') {
 								++ch;
 								month_or_week = read_segment_2digits(ch, &ch);
-								NSLog(@"(%@) month is %u", str, month_or_week);
+								NSLog(@"(%@) month is %lu", str, month_or_week);
 							}
 
 							day = 1U;
diff -r 2fdac8ac99c3 -r b4d44fcc32fb Frameworks/Adium Framework/Source/AIStatusGroup.m
--- a/Frameworks/Adium Framework/Source/AIStatusGroup.m	Mon Oct 25 13:22:24 2010 +0200
+++ b/Frameworks/Adium Framework/Source/AIStatusGroup.m	Mon Oct 25 19:08:54 2010 -0400
@@ -265,7 +265,7 @@
  */
 - (void)addStatusItem:(AIStatusItem *)inStatusItem atIndex:(NSUInteger)idx
 {
-	if (idx >= 0 && idx < [containedStatusItems count]) {
+	if (idx != NSNotFound && idx < [containedStatusItems count]) {
 		[containedStatusItems insertObject:inStatusItem atIndex:idx];
 	} else {
 		[containedStatusItems addObject:inStatusItem];		
@@ -347,7 +347,7 @@
 	if (oldStatusState != newStatusState) {
 		NSUInteger idx = [containedStatusItems indexOfObject:oldStatusState];
 		
-		if (idx >= 0 && idx < [containedStatusItems count]) {
+		if (idx != NSNotFound && idx < [containedStatusItems count]) {
 			[containedStatusItems replaceObjectAtIndex:idx withObject:newStatusState];
 		}
 
diff -r 2fdac8ac99c3 -r b4d44fcc32fb Plugins/Bonjour/libezv/Simple HTTP Server/AsyncSocket.m
--- a/Plugins/Bonjour/libezv/Simple HTTP Server/AsyncSocket.m	Mon Oct 25 13:22:24 2010 +0200
+++ b/Plugins/Bonjour/libezv/Simple HTTP Server/AsyncSocket.m	Mon Oct 25 19:08:54 2010 -0400
@@ -2021,7 +2021,7 @@
 			[self doAcceptWithSocket: *((CFSocketNativeHandle *)pData)];
 			break;
 		default:
-			NSLog (@"AsyncSocket %p received unexpected CFSocketCallBackType %d.", self, type);
+			NSLog (@"AsyncSocket %p received unexpected CFSocketCallBackType %lu.", self, type);
 			break;
 	}
 }
@@ -2045,7 +2045,7 @@
 			[self closeWithError: [self errorFromCFStreamError:err]];
 			break;
 		default:
-			NSLog (@"AsyncSocket %p received unexpected CFReadStream callback, CFStreamEventType %d.", self, type);
+			NSLog (@"AsyncSocket %p received unexpected CFReadStream callback, CFStreamEventType %lu.", self, type);
 	}
 }
 
@@ -2068,7 +2068,7 @@
 			[self closeWithError: [self errorFromCFStreamError:err]];
 			break;
 		default:
-			NSLog (@"AsyncSocket %p received unexpected CFWriteStream callback, CFStreamEventType %d.", self, type);
+			NSLog (@"AsyncSocket %p received unexpected CFWriteStream callback, CFStreamEventType %lu.", self, type);
 	}
 }
 
diff -r 2fdac8ac99c3 -r b4d44fcc32fb Plugins/Link Management/SHLinkEditorWindowController.m
--- a/Plugins/Link Management/SHLinkEditorWindowController.m	Mon Oct 25 13:22:24 2010 +0200
+++ b/Plugins/Link Management/SHLinkEditorWindowController.m	Mon Oct 25 19:08:54 2010 -0400
@@ -95,7 +95,7 @@
 		id   	 	linkURL = nil;
 		
 		//Get the selected link (We have to be careful when the selection is at the very end of our text view)
-		if (selectedRange.location >= 0 && NSMaxRange(selectedRange) < [[textView textStorage] length]) {
+		if (selectedRange.location != NSNotFound && NSMaxRange(selectedRange) < [[textView textStorage] length]) {
 			linkURL = [[textView textStorage] attribute:NSLinkAttributeName
 												atIndex:selectedRange.location
 										 effectiveRange:&rangeOfLinkAttribute];
diff -r 2fdac8ac99c3 -r b4d44fcc32fb Plugins/Twitter Plugin/MGTwitterEngine/MGTwitterEngine.m
--- a/Plugins/Twitter Plugin/MGTwitterEngine/MGTwitterEngine.m	Mon Oct 25 13:22:24 2010 +0200
+++ b/Plugins/Twitter Plugin/MGTwitterEngine/MGTwitterEngine.m	Mon Oct 25 19:08:54 2010 -0400
@@ -665,7 +665,7 @@
     if (NO) {
         // Display headers for debugging.
         NSHTTPURLResponse *noResp = (NSHTTPURLResponse *)response;
-        NSLog(@"(%d) [%@]:\r%@", 
+        NSLog(@"(%ld) [%@]:\r%@", 
               [noResp statusCode], 
               [NSHTTPURLResponse localizedStringForStatusCode:[noResp statusCode]], 
               [noResp allHeaderFields]);
@@ -702,7 +702,7 @@
         if (NO) {
             // Dump data as string for debugging.
             NSString *dataString = [NSString stringWithUTF8String:[receivedData bytes]];
-            NSLog(@"Succeeded! Received %d bytes of data:\r\r%@", [receivedData length], dataString);
+            NSLog(@"Succeeded! Received %lu bytes of data:\r\r%@", [receivedData length], dataString);
         }
         
         if (NO) {
diff -r 2fdac8ac99c3 -r b4d44fcc32fb Source/AIObjectDebug.m
--- a/Source/AIObjectDebug.m	Mon Oct 25 13:22:24 2010 +0200
+++ b/Source/AIObjectDebug.m	Mon Oct 25 19:08:54 2010 -0400
@@ -48,7 +48,7 @@
 		*((int*)0xdeadbeef) = 42;
 		return;
 	} else {
-		NSLog(@"%@ of class %@ does not respond to selector %s", self, [self class], aSelector);
+		NSLog(@"%@ of class %@ does not respond to selector %@", self, [self class], NSStringFromSelector(aSelector));
 	}
 	__crashreporter_info__ = (char *)[[NSString stringWithFormat:@"Dear crash reporter team: We only put stuff here in debug builds of Adium. Don't Panic, it won't ship in a release unless there's public API for it.\n\n %@ of class %@ does not respond to selector %s", self, [self class], aSelector] cStringUsingEncoding:NSASCIIStringEncoding];
 	*((int*)0xdeadbeef) = 42;
diff -r 2fdac8ac99c3 -r b4d44fcc32fb Source/AISCLViewPlugin.m
--- a/Source/AISCLViewPlugin.m	Mon Oct 25 13:22:24 2010 +0200
+++ b/Source/AISCLViewPlugin.m	Mon Oct 25 19:08:54 2010 -0400
@@ -330,9 +330,9 @@
  */
 - (void)nextDetachedContactList
 {
-	if (detachedCycle >= [contactLists count] || detachedCycle < 0)
+	if (detachedCycle >= [contactLists count] || detachedCycle == NSNotFound)
 		detachedCycle = 0;
-	if (detachedCycle >= 0 && detachedCycle < [contactLists count])
+	if (detachedCycle != NSNotFound && detachedCycle < [contactLists count])
 		[[contactLists objectAtIndex:detachedCycle++] showWindowInFrontIfAllowed:YES];
 }
 
@@ -340,9 +340,9 @@
  * @brief Attempts to bring the previous detached contact list to the front 
  */
 - (void)previousDetachedContactList {
-	if (detachedCycle<0 || detachedCycle>=[contactLists count])
+	if (detachedCycle == NSNotFound || detachedCycle >= [contactLists count])
 		detachedCycle = [contactLists count]-1;
-	if (detachedCycle>=0 && detachedCycle<[contactLists count])
+	if (detachedCycle != NSNotFound && detachedCycle < [contactLists count])
 		[[contactLists objectAtIndex:detachedCycle--] showWindowInFrontIfAllowed:YES];
 }
 
diff -r 2fdac8ac99c3 -r b4d44fcc32fb Source/AdiumSound.m
--- a/Source/AdiumSound.m	Mon Oct 25 13:22:24 2010 +0200
+++ b/Source/AdiumSound.m	Mon Oct 25 19:08:54 2010 -0400
@@ -376,7 +376,7 @@
 	dataSize = sizeof(deviceUID);
 	err = AudioDeviceGetProperty(systemOutputDevice, /*channel*/ 0, /*isInput*/ false, kAudioDevicePropertyDeviceUID, &dataSize, &deviceUID);
 	if (err != noErr) {
-		NSLog(@"%s: Could not get the device UID for device %p: AudioDeviceGetProperty returned error %i", __PRETTY_FUNCTION__, systemOutputDevice, err);
+		NSLog(@"%s: Could not get the device UID for device %u: AudioDeviceGetProperty returned error %i", __PRETTY_FUNCTION__, systemOutputDevice, err);
 		return NULL;
 	}
 	[(NSString *)deviceUID autorelease];
diff -r 2fdac8ac99c3 -r b4d44fcc32fb Source/GBApplescriptFiltersPlugin.m
--- a/Source/GBApplescriptFiltersPlugin.m	Mon Oct 25 13:22:24 2010 +0200
+++ b/Source/GBApplescriptFiltersPlugin.m	Mon Oct 25 19:08:54 2010 -0400
@@ -646,7 +646,7 @@
 		remainingRange.location = ((i > 0) ? i-1 : 0);
 		remainingRange.length = (inStringComponentsCount - remainingRange.location);
 
-		if (remainingRange.location >= 0) {
+		if (remainingRange.location != NSNotFound) {
 			NSString	*lastArgument;
 
 			//Remove that last, incomplete argument if it was added




More information about the commits mailing list