Re: convert CFRange to NSRange?
Re: convert CFRange to NSRange?
- Subject: Re: convert CFRange to NSRange?
- From: Scott Ribe <email@hidden>
- Date: Tue, 14 Dec 2010 12:13:24 -0700
On Dec 14, 2010, at 9:58 AM, Matt Neuburg wrote:
> I recognize that the conversion is not simple, but that is exactly why I am surprised that the frameworks do not supply a utility conversion method. If I were to write my own I would surely get it wrong.
The size & layout of the members is the same on 32-bit and 64-bit. But the "not found" values are different, so, you can't use any vile casting to reinterpret. But a macro to convert is pretty simple:
#define NSMakeRangeFromCF(cfr) NSMakeRange( cfr.location == kCFNotFound ? NSNotFound : cfr.location, cfr.length )
--
Scott Ribe
email@hidden
http://www.elevated-dev.com/
(303) 722-0567 voice
_______________________________________________
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