Re: dataWithBytesNoCopy:length:freeWhenDone

2011-10-09 Thread silverdr
On 2011-10-09, at 05:50, Ken Thomases wrote: I'd guess that, with the 'NO' parameter, NSMutableData copies the data anyway. This is actually documented. In the Binary Data Programming Guide, in the article Working With Binary Data[1], it says: However, if you create an NSData object

Re: dataWithBytesNoCopy:length:freeWhenDone

2011-10-09 Thread silverdr
On 2011-10-09, at 05:05, Quincey Morris wrote: What am I doing wrong? Shouldn't the instance created using dataWithBytesNoCopy:length:freeWhenDone simply hold the same bytes as the originally provided ones? Presumably you're using 'dataWithBytesNoCopy:length:freeWhenDone:NO', since

Re: dataWithBytesNoCopy:length:freeWhenDone

2011-10-09 Thread Quincey Morris
On Oct 9, 2011, at 05:44 , silve...@wfmh.org.pl 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

dataWithBytesNoCopy:length:freeWhenDone

2011-10-08 Thread silverdr
in the large one. I tried creating the small instances using dataWithBytesNoCopy:length:freeWhenDone: but it doesn't seem to work as expected - mutableBytes of the newly created instance point elsewhere than the original mutableBytes. What am I doing wrong? Shouldn't the instance created

Re: dataWithBytesNoCopy:length:freeWhenDone

2011-10-08 Thread Quincey Morris
On Oct 8, 2011, at 14:31 , silve...@wfmh.org.pl wrote: What am I doing wrong? Shouldn't the instance created using dataWithBytesNoCopy:length:freeWhenDone simply hold the same bytes as the originally provided ones? Presumably you're using 'dataWithBytesNoCopy:length:freeWhenDone:NO', since

Re: dataWithBytesNoCopy:length:freeWhenDone

2011-10-08 Thread Ken Thomases
On Oct 8, 2011, at 10:05 PM, Quincey Morris wrote: On Oct 8, 2011, at 14:31 , silve...@wfmh.org.pl wrote: What am I doing wrong? Shouldn't the instance created using dataWithBytesNoCopy:length:freeWhenDone simply hold the same bytes as the originally provided ones? I'd guess