The line
return (__bridge DCSDictionaryRef)d;
gives me a "Address of stack memory associated with local variable retured to caller?" warning. Ideally I think I ought to create a new copy of the DCSDictionaryRef
instance but I'm absolute clueless about how it works.
Would appreciate any hints/help on how I can get rid of the warning (and a potential leak or the object being gcollected midway).
P.S. DCSCopyAvailableDictionaries
and DCSDictionaryGetShortName
are one of the 'undocumented' functions in CoreFoundation.
DCSDictionaryRef _DCSDictionary() {
NSArray *dicts = DCSCopyAvailableDictionaries();
for (NSObject *d in dicts) {
NSString *sn = DCSDictionaryGetShortName((__bridge DCSDictionaryRef)d);
NSLog(@"%@", sn);
if ([sn isEqualToString:@"Thesaurus"]) {
return (__bridge DCSDictionaryRef)d;
}
}
return NULL;
}
CFStringRef
instead ofNSString *
, and useCFEqual( sn, CFSTR( "Thesaurus" ) )
? – nielsbot Feb 22 '12 at 8:45DCSDictionaryRef
I'm interested in...? – softbear Feb 22 '12 at 13:14