Migrate APL plug-in to use ARC.

CQTexperiment
Chris Moeller 2016-05-03 00:57:52 -07:00
parent a2ff3dcb0a
commit 3c229f2017
3 changed files with 6 additions and 18 deletions

View File

@ -186,6 +186,7 @@
1DEB913F08733D840010E9CD /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_OBJC_ARC = YES;
GCC_PREPROCESSOR_DEFINITIONS = "DEBUG=1";
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
@ -200,6 +201,7 @@
1DEB914008733D840010E9CD /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_OBJC_ARC = YES;
CODE_SIGN_IDENTITY = "Developer ID Application";
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_WARN_ABOUT_RETURN_TYPE = YES;

View File

@ -22,7 +22,7 @@
//Need to alter length
[properties setObject:[NSNumber numberWithLong:trackLength] forKey:@"totalFrames"];
return [properties autorelease];
return properties;
}
- (BOOL)open:(id<CogSource>)s
@ -35,18 +35,15 @@
[s close];
apl = [APLFile createWithFile:[url path]];
[apl retain];
//Kind of a hackish way of accessing outside classes.
source = [NSClassFromString(@"AudioSource") audioSourceForURL:[apl file]];
[source retain];
if (![source open:[apl file]]) {
ALog(@"Could not open source for file '%@' referenced in apl", [apl file]);
return NO;
}
decoder = [NSClassFromString(@"AudioDecoder") audioDecoderForSource:source];
[decoder retain];
if (![decoder open:source]) {
ALog(@"Could not open decoder for source for apl");
@ -80,18 +77,11 @@
- (void)close {
if (decoder) {
[decoder close];
[decoder release];
decoder = nil;
}
if (source) {
[source release];
source = nil;
}
if (apl) {
[apl release];
apl = nil;
}
source = nil;
apl = nil;
}

View File

@ -39,7 +39,6 @@
[unixPath insertString:basePath atIndex:0];
}
NSURL *url = [NSURL URLWithString:[[NSURL fileURLWithPath:unixPath] absoluteString]];
[unixPath release];
return url;
}
@ -59,7 +58,7 @@
ALog(@"Cannot read header");
return nil;
}
NSString* str = [[[NSString alloc] autorelease] initWithData:da encoding: NSASCIIStringEncoding];
NSString* str = [[NSString alloc] initWithData:da encoding: NSASCIIStringEncoding];
if([str compare:header options:NSCaseInsensitiveSearch]) {
ALog(@"APL header mismatch");
return nil;
@ -71,7 +70,6 @@
while((line = [self readline:f])) {
if (![line compare:@"----- APE TAG (DO NOT TOUCH!!!) -----\r\n" options:NSCaseInsensitiveSearch]) break;
if([line characterAtIndex:0] == '-') break;
[scanner release];
scanner = [[NSScanner alloc] initWithString:line];
NSString* field = nil, *value = nil;
if (![scanner scanUpToString:@"=" intoString:&field]) continue;
@ -79,7 +77,6 @@
if (![scanner scanUpToString:@"\r\n" intoString:&value]) continue;
if (![field compare:@"Image File" options:NSCaseInsensitiveSearch])
{
[file release];
file = [self urlForPath:value relativeTo:filename];
DLog(@"APL refers to file '%@' read '%@'", file, value);
continue;
@ -97,7 +94,6 @@
continue;
}
}
[scanner release];
//check here for EOF? cocoa does not have this functionality :(
[f closeFile];
}