• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: dataWithBytesNoCopy:length:freeWhenDone
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >dataWithBytesNoCopy:length:freeWhenDone (From: email@hidden)
 >Re: dataWithBytesNoCopy:length:freeWhenDone (From: Quincey Morris <email@hidden>)
 >Re: dataWithBytesNoCopy:length:freeWhenDone (From: email@hidden)

  • Prev by Date: Re: NSTableView data source issue - code moving from xcode 3 to xcode 4
  • Next by Date: Re: -dateWithTimeIntervalSinceNow: 64-bits may overflow
  • Previous by thread: Re: dataWithBytesNoCopy:length:freeWhenDone
  • Next by thread: return NO in tableViewSelectionDidChange: disables button cell
  • Index(es):
    • Date
    • Thread