Skip to content

Commit 18bca7d

Browse files
committed
analyze
1 parent 6740a36 commit 18bca7d

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

iLcatraz/FileResponse.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010

1111
@implementation FileResponse
1212
- (id)initWithFilePath:(NSString *)aFilePath andLocation:(NSString*)location forConnection:(HTTPConnection *)aConnection{
13-
if (self==[super initWithFilePath:aFilePath forConnection:aConnection]){
13+
self=[super initWithFilePath:aFilePath forConnection:aConnection];
14+
if (self!=NULL){
1415
headers = [NSDictionary dictionaryWithObjectsAndKeys:location,@"X-iTunes-Location",nil];
1516
};
1617
return self;

iLcatraz/ITunesService.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,7 @@ - (NSInteger) resultAsCount:(NSString *)code
660660
NSAppleEventDescriptor* returnDescriptor = [self resultForCode:code];
661661
return (NSInteger)[returnDescriptor int32Value];
662662
}
663-
- (NSString*) resultAsPath:(NSString *)code
663+
- (NSString*) copyResultAsString:(NSString *)code
664664
{
665665
NSAppleEventDescriptor* descriptor=[self resultForCode:code];
666666
CFStringRef posixPath = NULL;
@@ -689,7 +689,7 @@ - (NSString*) resultAsPath:(NSString *)code
689689
kCFURLPOSIXPathStyle );
690690
CFRelease( myURLRef );
691691
}
692-
692+
//TODO: Memory leak, i do not know how to avoid
693693
return (__bridge NSString *)posixPath;
694694
}
695695

@@ -728,7 +728,7 @@ - (NSString*) jsonTrackWithID:(NSString*) pid {
728728
return [self jsonForCode:[NSString stringWithFormat:@"tell application \"iTunes\"\n properties of first item of (tracks whose persistent ID is \"%@\")\n end tell",pid]];
729729
}
730730
- (NSString*) locationForTrackWithID:(NSString*) pid{
731-
return [self resultAsPath:[NSString stringWithFormat:@"tell application \"iTunes\"\n location of first item of (tracks whose persistent ID is \"%@\")\n end tell",pid]];
731+
return [self copyResultAsString:[NSString stringWithFormat:@"tell application \"iTunes\"\n location of first item of (tracks whose persistent ID is \"%@\")\n end tell",pid]];
732732
}
733733

734734
//v2
@@ -745,7 +745,7 @@ - (NSString*) jsonTrackWithID:(NSString*)tid ofPlaysitWithID:(NSString*)pid{
745745
return [self jsonForCode:[NSString stringWithFormat:@"tell application \"iTunes\"\n properties of first item of (tracks of (first item of (playlists whose persistent ID is \"%@\")) whose persistent ID is \"%@\")\n end tell",pid,tid]];
746746
};
747747
- (NSString*) pathForTrackWithID:(NSString*)tid ofPlaysitWithID:(NSString*)pid{
748-
return [self resultAsPath:[NSString stringWithFormat:@"tell application \"iTunes\"\n location of first item of (tracks of (first item of (playlists whose persistent ID is \"%@\")) whose persistent ID is \"%@\")\n end tell",pid,tid]];
748+
return [self copyResultAsString:[NSString stringWithFormat:@"tell application \"iTunes\"\n location of first item of (tracks of (first item of (playlists whose persistent ID is \"%@\")) whose persistent ID is \"%@\")\n end tell",pid,tid]];
749749
};
750750
- (NSString*) locationForTrackPath:(NSString*)path{
751751
NSArray *components=[path componentsSeparatedByString:@"iTunes Media/"];

0 commit comments

Comments
 (0)