Re: dataWithBytesNoCopy:length:freeWhenDone
Re: dataWithBytesNoCopy:length:freeWhenDone
- Subject: Re: dataWithBytesNoCopy:length:freeWhenDone
- From: Quincey Morris <email@hidden>
- Date: Sun, 09 Oct 2011 11:29:56 -0700
On Oct 9, 2011, at 05:44 , email@hidden wrote:
> But what I tried to achieve was to do it somewhat more "OO", although sharing the payload between various instances seems to be contradicting it ;-)
Not at all. Sharing the payload is neither a problem nor wrong, but trying to take a shortcut by using NSMutableData to do it isn't the solution.
Don't be afraid of writing your own class for this. You need to encapsulate the underlying NSMutableData object, a starting offset and a byte length, and you need to be able to retrieve a pointer (maybe a structure pointer rather than a void*) to the corresponding mutable data fragment. Sounds pretty straightforward.
_______________________________________________
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