Re: Static Analyzer and Core Foundation
Re: Static Analyzer and Core Foundation
- Subject: Re: Static Analyzer and Core Foundation
- From: Steve Cronin <email@hidden>
- Date: Fri, 18 Sep 2009 19:25:08 -0500
Luke;
I've adapted the code to accomodate your's and Chris' answer to
question 2.
Here's the entire method, which now shows not static analyzer issues
but I still would like to understand why not.
+ (NSDictionary *)metadataForFilePath:(NSString *)thisPath {
NSDictionary *md = [NSDictionary dictionary];
if (![[NSFileManager defaultManager] fileExistsAtPath:thisPath]) {
NSLog(@"file does not existl");
} else {
MDItemRef mdi = MDItemCreate( nil, (CFStringRef)thisPath );
if ( mdi != nil ) {
CFArrayRef arrayRef = MDItemCopyAttributeNames(mdi);
CFDictionaryRef dictRef = MDItemCopyAttributes( mdi, arrayRef);
md = [NSDictionary dictionaryWithDictionary:(NSDictionary *)dictRef];
CFRelease(dictRef);
CFRelease(arrayRef);
} else {
NSLog(@"mdi is nil");
}
}
return md;
}
Is this the 'best' this can be?
Thanks for helping me learn,
Steve
On Sep 18, 2009, at 6:44 PM, Luke the Hiesterman wrote:
There's not enough code here to give a good answer to question 1.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden