iphone - Invalid conversion from const void* error -
i running following code in .mm file , error:
invalid conversion 'const void*' 'const __cfdata*'
i need run code in .mm. if change .m doesn't complain. why behaving this? compile iphone
cfsocketnativehandle native; cfdataref nativeprop = cfreadstreamcopyproperty(thereadstream, kcfstreampropertysocketnativehandle); if(nativeprop == null) { if (errptr) *errptr = [self getstreamerror]; return no; } cfindex nativeproplen = cfdatagetlength(nativeprop); cfindex nativelen = (cfindex)sizeof(native); cfindex len = min(nativeproplen, nativelen); cfdatagetbytes(nativeprop, cfrangemake(0, len), (uint8 *)&native); cfrelease(nativeprop); cfsocketref thesocket = cfsocketcreatewithnative(kcfallocatordefault, native, 0, null, null); if(thesocket == null) { if (errptr) *errptr = [self getsocketerror]; return no; }
cfreadstreamcopyproperty()
returns cftyperef
, typedef
const void*
, , c++ stricter conversions c (or objective-c). need cast explicitly here:
cfdataref nativeprop = (cfdataref)cfreadstreamcopyproperty(...);
Comments
Post a Comment