Skip to content

Commit

Permalink
Converting all RunLoop sample Xcode projects to ARC
Browse files Browse the repository at this point in the history
  • Loading branch information
robbiehanson committed Mar 24, 2012
1 parent a369df7 commit bdbfa0c
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 49 deletions.
5 changes: 1 addition & 4 deletions RunLoop/Xcode/EchoServer/AppController.m
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ - (void)logError:(NSString *)msg
[attributes setObject:[NSColor redColor] forKey:NSForegroundColorAttributeName];

NSAttributedString *as = [[NSAttributedString alloc] initWithString:paragraph attributes:attributes];
[as autorelease];

[[logView textStorage] appendAttributedString:as];
[self scrollToBottom];
Expand All @@ -79,7 +78,6 @@ - (void)logInfo:(NSString *)msg
[attributes setObject:[NSColor purpleColor] forKey:NSForegroundColorAttributeName];

NSAttributedString *as = [[NSAttributedString alloc] initWithString:paragraph attributes:attributes];
[as autorelease];

[[logView textStorage] appendAttributedString:as];
[self scrollToBottom];
Expand All @@ -93,7 +91,6 @@ - (void)logMessage:(NSString *)msg
[attributes setObject:[NSColor blackColor] forKey:NSForegroundColorAttributeName];

NSAttributedString *as = [[NSAttributedString alloc] initWithString:paragraph attributes:attributes];
[as autorelease];

[[logView textStorage] appendAttributedString:as];
[self scrollToBottom];
Expand Down Expand Up @@ -174,7 +171,7 @@ - (void)onSocket:(AsyncSocket *)sock didWriteDataWithTag:(long)tag
- (void)onSocket:(AsyncSocket *)sock didReadData:(NSData *)data withTag:(long)tag
{
NSData *strData = [data subdataWithRange:NSMakeRange(0, [data length] - 2)];
NSString *msg = [[[NSString alloc] initWithData:strData encoding:NSUTF8StringEncoding] autorelease];
NSString *msg = [[NSString alloc] initWithData:strData encoding:NSUTF8StringEncoding];
if(msg)
{
[self logMessage:msg];
Expand Down
15 changes: 9 additions & 6 deletions RunLoop/Xcode/EchoServer/EchoServer.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
29B97313FDCFA39411CA2CEA /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0420;
LastUpgradeCheck = 0430;
};
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "EchoServer" */;
compatibilityVersion = "Xcode 3.2";
Expand Down Expand Up @@ -219,23 +219,20 @@
buildSettings = {
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_MODEL_TUNING = G5;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = EchoServer_Prefix.pch;
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(HOME)/Applications";
PRODUCT_NAME = EchoServer;
WRAPPER_EXTENSION = app;
ZERO_LINK = YES;
};
name = Debug;
};
C01FCF4C08A954540054247B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_MODEL_TUNING = G5;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = EchoServer_Prefix.pch;
INFOPLIST_FILE = Info.plist;
Expand All @@ -248,7 +245,10 @@
C01FCF4F08A954540054247B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_OBJCPP_ARC_ABI = YES;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_MISSING_PARENTHESES = YES;
Expand All @@ -263,7 +263,10 @@
C01FCF5008A954540054247B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_OBJCPP_ARC_ABI = YES;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_MISSING_PARENTHESES = YES;
Expand Down
34 changes: 17 additions & 17 deletions RunLoop/Xcode/EchoServer/English.lproj/MainMenu.nib/designable.nib

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
InterfaceTestViewController *viewController;
}

@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet InterfaceTestViewController *viewController;
@property (nonatomic) IBOutlet UIWindow *window;
@property (nonatomic) IBOutlet InterfaceTestViewController *viewController;

@end

16 changes: 5 additions & 11 deletions RunLoop/Xcode/InterfaceTest/Classes/InterfaceTestAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,12 @@ - (void)dnsResolveDidFinish

static void DNSResolveCallBack(CFHostRef theHost, CFHostInfoType typeInfo, const CFStreamError *error, void *info)
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
@autoreleasepool {

InterfaceTestAppDelegate *instance = (InterfaceTestAppDelegate *)info;
[instance dnsResolveDidFinish];
InterfaceTestAppDelegate *instance = (__bridge InterfaceTestAppDelegate *)info;
[instance dnsResolveDidFinish];

[pool release];
}
}

- (void)startDNSResolve
Expand All @@ -215,7 +215,7 @@ - (void)startDNSResolve

CFHostClientContext context;
context.version = 0;
context.info = self;
context.info = (__bridge void *)(self);
context.retain = NULL;
context.release = NULL;
context.copyDescription = NULL;
Expand Down Expand Up @@ -266,12 +266,6 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
return YES;
}

- (void)dealloc
{
[viewController release];
[window release];
[super dealloc];
}


@end
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,5 @@ - (void)viewDidUnload {
}


- (void)dealloc {
[super dealloc];
}

@end
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,15 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ENABLE_OBJC_ARC = YES;
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = InterfaceTest_Prefix.pch;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
INFOPLIST_FILE = "InterfaceTest-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 5.0;
PRODUCT_NAME = InterfaceTest;
};
name = Debug;
Expand All @@ -205,10 +208,13 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ENABLE_OBJC_ARC = YES;
COPY_PHASE_STRIP = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = InterfaceTest_Prefix.pch;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
INFOPLIST_FILE = "InterfaceTest-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 5.0;
PRODUCT_NAME = InterfaceTest;
VALIDATE_PRODUCT = YES;
};
Expand All @@ -223,7 +229,7 @@
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
PREBINDING = NO;
SDKROOT = iphoneos4.1;
SDKROOT = iphoneos;
};
name = Debug;
};
Expand All @@ -237,7 +243,7 @@
GCC_WARN_UNUSED_VARIABLE = YES;
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
PREBINDING = NO;
SDKROOT = iphoneos4.1;
SDKROOT = iphoneos;
};
name = Release;
};
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions RunLoop/Xcode/InterfaceTest/main.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

int main(int argc, char *argv[]) {

NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil, nil);
[pool release];
return retVal;
@autoreleasepool {
int retVal = UIApplicationMain(argc, argv, nil, nil);
return retVal;
}
}

0 comments on commit bdbfa0c

Please sign in to comment.