Re: Data Structure to Data
Re: Data Structure to Data
- Subject: Re: Data Structure to Data
- From: "Hamish Allan" <email@hidden>
- Date: Fri, 18 Jan 2008 19:53:36 +0000
On Jan 18, 2008 7:10 PM, Bruce Johnson <email@hidden> wrote:
> Okay so there isn't a way to get it to copy what the pointer is pointing too
> then.
There is no automatic deep copy, no. (If you were trying to write an
automatic deep copy function, how would you make it determine how many
bytes to copy?!)
> CFDataRef imgData = CFDataCreate(kCFAllocatorDefault, data, sz);
This code asks for a CFData to be created from a block of data
starting at "data" whose length is "sz". But this is only ever correct
if sizeOfImage == 0.
Imagine you were using malloc and memcpy (i.e., the allocation and the
copy in CFDataCreate were separated). How many times would you need to
call memcpy?
Hamish
_______________________________________________
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