Re: NSData, CFData maximum length question
Re: NSData, CFData maximum length question
- Subject: Re: NSData, CFData maximum length question
- From: Seth Willits <email@hidden>
- Date: Wed, 21 Mar 2012 23:12:29 -0700
On Mar 21, 2012, at 10:49 PM, Seth Willits wrote:
> On Mar 21, 2012, at 6:00 PM, Grandinetti Philip wrote:
>
>> I am confused about different behavior I'm seeing with CFData and NSData. If I create a new project in XCode 4.3.1 as a Core Foundation command line tool, and enter the code below…
>
> You've triggered a bug!
>
> And it took me a long time, but I found it. The bug is in __CFDataRoundUpCapacity, and has to do with a bad (1 << ….) which should be (1L << …).
>
>
> I'll file a report.
Filed as 11097403. And yeah, setting the length to anything > 0 when the data is created will avoid the bug because the CFData is not "growable", and CFDataSetLength is handled a little different for growable CFDatas vs fixed-length mutable ones.
I'm not sure what [NSMutableData dataWithCapacity:0] does, but it's not a simple call to CFDataCreateMutable(kCFAllocatorDefault, 0) which is why it behaves differently as well.
--
Seth Willits
_______________________________________________
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