Skip to content
Browse files

Add support for 64-bit preference pane

  • Loading branch information...
1 parent 4547277 commit 613f74aa7cd800d8c6e0ba13181b91bbdaa855b5 Jesse Armand committed Sep 18, 2009
Showing with 32 additions and 19 deletions.
  1. +4 −4 Speed.h
  2. +3 −3 Speed.m
  3. +10 −5 SpeedLimit.xcodeproj/project.pbxproj
  4. +7 −7 SpeedLimitPref.m
  5. +8 −0 SpeedLimit_Prefix.pch
View
8 Speed.h
@@ -10,15 +10,15 @@
@interface Speed : NSObject {
- int speed;
+ NSInteger speed;
NSString *name;
}
@property (readwrite, retain) NSString *name;
-@property (readwrite, assign) int speed;
+@property (readwrite, assign) NSInteger speed;
--(id)initWithName:(NSString *)name speed:(int)speed;
+-(id)initWithName:(NSString *)name speed:(NSInteger)speed;
-+(Speed *)speedWithName:(NSString *)aName speed:(int)aSpeed;
++(Speed *)speedWithName:(NSString *)aName speed:(NSInteger)aSpeed;
@end
View
6 Speed.m
@@ -13,7 +13,7 @@ @implementation Speed
@synthesize name;
@synthesize speed;
--(id)initWithName:(NSString *)aName speed:(int)aSpeed {
+-(id)initWithName:(NSString *)aName speed:(NSInteger)aSpeed {
if (self = [super init]) {
self.name = aName;
self.speed = aSpeed;
@@ -27,10 +27,10 @@ -(void)dealloc {
}
-(NSString *)description {
- return [NSString stringWithFormat:@"%dk (%@)", self.speed, self.name];
+ return [NSString stringWithFormat:@"%ldk (%@)", self.speed, self.name];
}
-+(Speed *)speedWithName:(NSString *)aName speed:(int)aSpeed {
++(Speed *)speedWithName:(NSString *)aName speed:(NSInteger)aSpeed {
return [[[Speed alloc] initWithName:aName speed:aSpeed] autorelease];
}
@end
View
15 SpeedLimit.xcodeproj/project.pbxproj
@@ -281,25 +281,30 @@
1DBD214D08BA80EA00186707 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
- ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
GCC_C_LANGUAGE_STANDARD = c99;
+ GCC_ENABLE_OBJC_GC = supported;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- ONLY_ACTIVE_ARCH = YES;
+ MACOSX_DEPLOYMENT_TARGET = 10.5;
+ ONLY_ACTIVE_ARCH = NO;
PREBINDING = NO;
- SDKROOT = macosx10.5;
+ SDKROOT = macosx10.6;
};
name = Debug;
};
1DBD214E08BA80EA00186707 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
- ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
GCC_C_LANGUAGE_STANDARD = c99;
+ GCC_ENABLE_OBJC_GC = supported;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
+ MACOSX_DEPLOYMENT_TARGET = 10.5;
+ ONLY_ACTIVE_ARCH = NO;
PREBINDING = NO;
- SDKROOT = macosx10.5;
+ SDKROOT = macosx10.6;
};
name = Release;
};
View
14 SpeedLimitPref.m
@@ -47,7 +47,7 @@ - (NSString *)execute:(NSString *)command withArguments:(NSArray *)arguments {
char *args[[finalArguments count] + 2];
args[0] = (char *)[command cStringUsingEncoding:NSUTF8StringEncoding];
- int argNum = 0;
+ NSInteger argNum = 0;
for (NSString *argument in finalArguments) {
args[argNum ++] = (char *)[argument cStringUsingEncoding:NSUTF8StringEncoding];
}
@@ -73,7 +73,7 @@ - (void)saveSettings {
[prefs setObject:self.delay forKey:DELAY_KEY];
}
if (speed) {
- [prefs setObject:[NSNumber numberWithInt:speed.speed] forKey:SPEED_KEY];
+ [prefs setObject:[NSNumber numberWithInteger:speed.speed] forKey:SPEED_KEY];
}
if (rules) {
[prefs setObject:rules forKey:RULES_KEY];
@@ -91,12 +91,12 @@ - (NSArray *)rulesForCommand:(NSString *)command withArguments:(NSArray *)argume
NSArray *lines = [[self execute:command withArguments:arguments] componentsSeparatedByString:@"\n"];
for (NSString *line in lines) {
if ([line length] > 0) {
- int ruleNumber = [line intValue];
+ NSInteger ruleNumber = [line integerValue];
if (!ruleNumber) {
[returnRules removeAllObjects];
}
else {
- [returnRules addObject:[NSString stringWithFormat:@"%d", ruleNumber]];
+ [returnRules addObject:[NSString stringWithFormat:@"%ld", ruleNumber]];
}
}
}
@@ -109,7 +109,7 @@ - (void)updateStatus {
[startStopButton setEnabled:TRUE];
if (self.slow) {
[startStopButton setTitle:@"Speed Up"];
- [speedLimitLabel setStringValue:[NSString stringWithFormat:@"%d", speed.speed]];
+ [speedLimitLabel setStringValue:[NSString stringWithFormat:@"%ld", speed.speed]];
}
else {
[speedLimitLabel setStringValue:@"-"];
@@ -166,7 +166,7 @@ - (void)willSelect {
self.hosts = @"";
}
- int previousSpeed = [[prefs objectForKey:SPEED_KEY] intValue];
+ NSInteger previousSpeed = [[prefs objectForKey:SPEED_KEY] integerValue];
if (previousSpeed) {
for (Speed *loopSpeed in [speedsController arrangedObjects]) {
if (loopSpeed.speed == previousSpeed) {
@@ -233,7 +233,7 @@ -(IBAction)toggle:(id)sender {
if (!self.slow) {
NSArray *ports = [self.portsController arrangedObjects];
if (self.speed && [ports count]) {
- NSString *finalSpeed = [NSString stringWithFormat:@"%d", speed.speed];
+ NSString *finalSpeed = [NSString stringWithFormat:@"%ld", speed.speed];
NSString *finalDelay = (self.delay == nil || [self.delay length] == 0) ? 0 : self.delay;
NSString *finalHosts = (self.hosts == nil) ? @"" : self.hosts;
NSMutableArray *arguments = [NSMutableArray array];
View
8 SpeedLimit_Prefix.pch
@@ -2,6 +2,14 @@
// Prefix header for all source files of the 'SpeedLimit' target in the 'SpeedLimit' project.
//
+#if __LP64__ || NS_BUILD_32_LIKE_64
+typedef long NSInteger;
+typedef unsigned long NSUInteger;
+#else
+typedef int NSInteger;
+typedef unsigned int NSUInteger;
+#endif
+
#ifdef __OBJC__
#import <Foundation/Foundation.h>
#import <AppKit/AppKit.h>

0 comments on commit 613f74a

Please sign in to comment.
Something went wrong with that request. Please try again.