• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Static Analyzer and Core Foundation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Static Analyzer and Core Foundation


  • Subject: Re: Static Analyzer and Core Foundation
  • From: Jean-Daniel Dupas <email@hidden>
  • Date: Sat, 19 Sep 2009 12:05:21 +0200

Le 19 sept. 2009 à 02:25, Steve Cronin a écrit :

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


Currently, the static analyzer doesn't know what types are reference counted CF based object, so it does not know that MDItemRef is an CFTypeRef and so it doesn't try to track reference counting for it.
This is true with for all cf based types, but CoreGraphic one and is noted as a FIXME in the clang code. Maybe filling a radar about it may prioritize it ?


-- Jean-Daniel




_______________________________________________

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


References: 
 >Static Analyzer and Core Foundation (From: Steve Cronin <email@hidden>)
 >Re: Static Analyzer and Core Foundation (From: Luke the Hiesterman <email@hidden>)
 >Re: Static Analyzer and Core Foundation (From: Steve Cronin <email@hidden>)
 >Re: Static Analyzer and Core Foundation (From: Luke the Hiesterman <email@hidden>)
 >Re: Static Analyzer and Core Foundation (From: Steve Cronin <email@hidden>)

  • Prev by Date: Re: nested NSDictionary's and objectForKey
  • Next by Date: Re: Reliable way to find out if CoreData finished loading
  • Previous by thread: Re: Static Analyzer and Core Foundation
  • Next by thread: Re: Static Analyzer and Core Foundation
  • Index(es):
    • Date
    • Thread