Fixed the 64-to-32 warnings, by changing signed and unsigned ints to CFIndexes (and, in one case, a size_t).
authorPeter Hosey <hg@boredzo.org>
Sat Oct 10 12:18:18 2009 -0700 (2009-10-10)
changeset 4505a1733bc0be40
parent 4504 d969316df385
child 4506 4ea69f1de365
Fixed the 64-to-32 warnings, by changing signed and unsigned ints to CFIndexes (and, in one case, a size_t).
Extras/HardwareGrowler/AppController.h
Extras/HardwareGrowler/AppController.m
Extras/HardwareGrowler/NetworkNotifier.m
Extras/HardwareGrowler/PowerNotifier.c
     1.1 --- a/Extras/HardwareGrowler/AppController.h	Sat Oct 10 12:17:32 2009 -0700
     1.2 +++ b/Extras/HardwareGrowler/AppController.h	Sat Oct 10 12:18:18 2009 -0700
     1.3 @@ -22,7 +22,7 @@
     1.4  void AppController_syncStarted(void);
     1.5  void AppController_syncFinished(void);
     1.6  void AppController_powerSwitched(HGPowerSource powerSource, CFBooleanRef isCharging,
     1.7 -								 int batteryTime, int batteryPercentage);
     1.8 +								 CFIndex batteryTime, CFIndex batteryPercentage);
     1.9  
    1.10  #ifdef __OBJC__
    1.11  
     2.1 --- a/Extras/HardwareGrowler/AppController.m	Sat Oct 10 12:17:32 2009 -0700
     2.2 +++ b/Extras/HardwareGrowler/AppController.m	Sat Oct 10 12:18:18 2009 -0700
     2.3 @@ -532,7 +532,7 @@
     2.4  
     2.5  #pragma mark Power
     2.6  void AppController_powerSwitched(HGPowerSource powerSource, CFBooleanRef isCharging,
     2.7 -								 int batteryTime, int batteryPercentage)
     2.8 +								 CFIndex batteryTime, CFIndex batteryPercentage)
     2.9  {
    2.10  	NSString		*title = nil;
    2.11  	NSMutableString *description = [NSMutableString string];
     3.1 --- a/Extras/HardwareGrowler/NetworkNotifier.m	Sat Oct 10 12:17:32 2009 -0700
     3.2 +++ b/Extras/HardwareGrowler/NetworkNotifier.m	Sat Oct 10 12:18:18 2009 -0700
     3.3 @@ -44,7 +44,7 @@
     3.4  	// There's no pretty way to get media stuff; I've stripped it down to the essentials
     3.5  	// for what I'm doing.
     3.6  
     3.7 -	unsigned length = strlen(interface);
     3.8 +	size_t length = strlen(interface);
     3.9  	if (length >= IFNAMSIZ)
    3.10  		NSLog(@"Interface name too long");
    3.11  
     4.1 --- a/Extras/HardwareGrowler/PowerNotifier.c	Sat Oct 10 12:17:32 2009 -0700
     4.2 +++ b/Extras/HardwareGrowler/PowerNotifier.c	Sat Oct 10 12:18:18 2009 -0700
     4.3 @@ -18,7 +18,7 @@
     4.4  static CFRunLoopSourceRef powerNotifierRunLoopSource = NULL;
     4.5  static HGPowerSource lastPowerSource;
     4.6  static CFBooleanRef lastChargingState;
     4.7 -static int lastBatteryTime = -1;
     4.8 +static CFIndex lastBatteryTime = -1;
     4.9  
    4.10  static bool stringsAreEqual(CFStringRef a, CFStringRef b)
    4.11  {
    4.12 @@ -33,15 +33,15 @@
    4.13  	CFTypeRef	powerBlob = IOPSCopyPowerSourcesInfo();
    4.14  	CFArrayRef	powerSourcesList = IOPSCopyPowerSourcesList(powerBlob);
    4.15  
    4.16 -	unsigned	count = CFArrayGetCount(powerSourcesList);
    4.17 -	for (unsigned i = 0U; i < count; ++i) {
    4.18 +	CFIndex	count = CFArrayGetCount(powerSourcesList);
    4.19 +	for (CFIndex i = 0; i < count; ++i) {
    4.20  		CFTypeRef		powerSource;
    4.21  		CFDictionaryRef description;
    4.22  
    4.23  		HGPowerSource	hgPowerSource;
    4.24  		CFBooleanRef	charging = kCFBooleanFalse;
    4.25 -		int				batteryTime = -1;
    4.26 -		int				percentageCapacity = -1;
    4.27 +		CFIndex			batteryTime = -1;
    4.28 +		CFIndex			percentageCapacity = -1;
    4.29  
    4.30  		powerSource = CFArrayGetValueAtIndex(powerSourcesList, i);
    4.31  		description = IOPSGetPowerSourceDescription(powerBlob, powerSource);
    4.32 @@ -67,18 +67,18 @@
    4.33  				charging = kCFBooleanTrue;
    4.34  
    4.35  				CFNumberRef timeToChargeNum = CFDictionaryGetValue(description, CFSTR(kIOPSTimeToFullChargeKey));
    4.36 -				int timeToCharge;
    4.37 +				CFIndex timeToCharge;
    4.38  
    4.39 -				if (CFNumberGetValue(timeToChargeNum, kCFNumberIntType, &timeToCharge))
    4.40 +				if (CFNumberGetValue(timeToChargeNum, kCFNumberCFIndexType, &timeToCharge))
    4.41  					batteryTime = timeToCharge;
    4.42  			} else {
    4.43  				//Not charging
    4.44  				charging = kCFBooleanFalse;
    4.45  
    4.46  				CFNumberRef timeToEmptyNum = CFDictionaryGetValue(description, CFSTR(kIOPSTimeToEmptyKey));
    4.47 -				int timeToEmpty;
    4.48 +				CFIndex timeToEmpty;
    4.49  
    4.50 -				if (CFNumberGetValue(timeToEmptyNum, kCFNumberIntType, &timeToEmpty))
    4.51 +				if (CFNumberGetValue(timeToEmptyNum, kCFNumberCFIndexType, &timeToEmpty))
    4.52  					batteryTime = timeToEmpty;
    4.53  			}
    4.54  
    4.55 @@ -86,10 +86,10 @@
    4.56  			CFNumberRef currentCapacityNum = CFDictionaryGetValue(description, CFSTR(kIOPSCurrentCapacityKey));
    4.57  			CFNumberRef maxCapacityNum = CFDictionaryGetValue(description, CFSTR(kIOPSMaxCapacityKey));
    4.58  
    4.59 -			int currentCapacity, maxCapacity;
    4.60 +			CFIndex currentCapacity, maxCapacity;
    4.61  
    4.62 -			if (CFNumberGetValue(currentCapacityNum, kCFNumberIntType, &currentCapacity) &&
    4.63 -					CFNumberGetValue(maxCapacityNum, kCFNumberIntType, &maxCapacity))
    4.64 +			if (CFNumberGetValue(currentCapacityNum, kCFNumberCFIndexType, &currentCapacity) &&
    4.65 +					CFNumberGetValue(maxCapacityNum, kCFNumberCFIndexType, &maxCapacity))
    4.66  				percentageCapacity = roundf((currentCapacity / (float)maxCapacity) * 100.0f);
    4.67  
    4.68  		} else {