开发者

Casting CFDictionaryRef with pointer?

I have the code (simplified):

#define kSendBufferSize 32768
UInt8 listingBu开发者_如何学Pythonffer[kSendBufferSize];
NSDictionary *currentListing; 
CFIndex bufferLength;
CFDictionaryRef currentListingRef;
CFFTPCreateParsedResourceListing(kCFAllocatorDefault, listingBuffer, bufferLength, currentListingRef);
currentListing = (__bridge NSDictionary *) currentListingRef;

on the last line, I receive the following warning in XCode:

"Incompatible pointer types passing 'CFDictionaryRef' (aka 'const struct __CFDictionary *')
 to parameter of type 'CFDictionaryRef *' (aka const struct __CFDictionary **')"

The problem is that I need to declare the CFDictionaryRef with no pointer so that this line will work properly: (see Casting a CFDictionaryRef to NSDictionary?)

currentListing = (__bridge NSDictionary *) currentListingRef;

Thanks in advance.


I figured out my own answer through another forum. The key is to use the & operator when passing the CFDictionaryRef through the CFFTPCreateParsedResourceListing. For example:

CFFTPCreateParsedResourceListing(kCFAllocatorDefault, listingBuffer, bufferLength, &currentListingRef);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜