[Adium-commits] adium 2045:363bd358be29: Copy some code from Sparkle so we can h...

adium-commits at adiumx.com adium-commits at adiumx.com
Wed Apr 29 17:34:14 UTC 2009


details:	http://hg.adiumx.com/adium/rev/363bd358be29
revision:	2045:363bd358be29
author:		David Smith <catfish.man at gmail.com>
date:		Wed Apr 29 10:34:00 2009 -0700

Copy some code from Sparkle so we can have Intel64/Intel32/PPC64/PPC32 instead of just Intel/PPC and 32/64. Don't feel like upstreaming this with Sparkle 1.5 in near-lockdown right now

diffstat:

 Source/AIAdium.m |  31 ++++++++++++++++++++++++++++++-
 1 files changed, 30 insertions(+), 1 deletions(-)

diffs (41 lines):

diff -r 78d8e5fe8cb6 -r 363bd358be29 Source/AIAdium.m
--- a/Source/AIAdium.m	Wed Apr 29 09:28:12 2009 -0700
+++ b/Source/AIAdium.m	Wed Apr 29 10:34:00 2009 -0700
@@ -1112,7 +1112,36 @@
 			@"IMServices", @"key", 
 			accountInfoString, @"value",
 			nil];
-			[profileInfo addObject:entry];
+		[profileInfo addObject:entry];
+		
+		/** Temporary: get a combined type/bitness value, like PPC64 **/
+		// CPU type (decoder info for values found here is in mach/machine.h)
+		int sysctlvalue = 0;
+		unsigned long length = sizeof(sysctlvalue);
+		int error = sysctlbyname("hw.cputype", &sysctlvalue, &length, NULL, 0);
+		int cpuType = -1;
+		if (error == 0) {
+			cpuType = sysctlvalue;
+		}
+		BOOL is64bit = NO;
+		error = sysctlbyname("hw.cpu64bit_capable", &sysctlvalue, &length, NULL, 0);
+		if(error != 0)
+			error = sysctlbyname("hw.optional.x86_64", &sysctlvalue, &length, NULL, 0); //x86 specific
+		if(error != 0)
+			error = sysctlbyname("hw.optional.64bitops", &sysctlvalue, &length, NULL, 0); //PPC specific
+		
+		if (error == 0) {
+			is64bit = sysctlvalue == 1;
+			NSString *visibleCPUType;
+			switch(cpuType) {
+				case 7:		visibleCPUType=@"Intel";	break;
+				case 18:	visibleCPUType=@"PowerPC";	break;
+				default:	visibleCPUType=@"Unknown";	break;
+			}
+			visibleCPUType = [visibleCPUType stringByAppendingFormat:@"%@", is64bit ? @"64" : @"32"];
+			[profileInfo addObject:[NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"detailedcputype",@"Detailed CPU Type", visibleCPUType, visibleCPUType,nil] forKeys:[NSArray arrayWithObjects:@"key", @"displayKey", @"value", @"displayValue", nil]]];
+		}
+		
 	}
 
 




More information about the commits mailing list