Skip to content

Commit

Permalink
Committed changes to Foundation code.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rui Pacheco committed Mar 15, 2011
1 parent 2a20d7d commit 792c3d7
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions SMLBasicPerformer.m
Expand Up @@ -116,10 +116,11 @@ - (NSString *)createUUID
{
CFUUIDRef uuid = CFUUIDCreate(NULL);
CFStringRef uuidString = CFUUIDCreateString(NULL, uuid);
NSMakeCollectable(uuid);
CFRelease(uuid);

// Again, not happy with this in non-gc environments.
NSMakeCollectable(uuidString);

return (NSString *)uuidString;
return [(NSString *)uuidString autorelease];
}

/*
Expand Down Expand Up @@ -157,28 +158,29 @@ - (NSString *)resolveAliasInPath:(NSString *)path
{
NSString *resolvedPath = nil;
CFURLRef url = CFURLCreateWithFileSystemPath(NULL, (CFStringRef)path, kCFURLPOSIXPathStyle, NO);
NSMakeCollectable(url);

if (url != NULL) {
FSRef fsRef;
if (CFURLGetFSRef(url, &fsRef)) {
Boolean targetIsFolder, wasAliased;
if (FSResolveAliasFile (&fsRef, true, &targetIsFolder, &wasAliased) == noErr && wasAliased) {
CFURLRef resolvedURL = CFURLCreateFromFSRef(NULL, &fsRef);
NSMakeCollectable(resolvedURL);
if (resolvedURL != NULL) {
resolvedPath = (NSString*)CFURLCopyFileSystemPath(resolvedURL, kCFURLPOSIXPathStyle);
NSMakeCollectable(resolvedPath);
CFRelease(resolvedURL);
}
}
}
CFRelease(url);
}

if (resolvedPath==nil) {
return path;
}

return resolvedPath;
// Not sure I'm happy with this line in a non-gc environment.
NSMakeCollectable(resolvedPath);
return [resolvedPath autorelease];
}

@end

0 comments on commit 792c3d7

Please sign in to comment.