Is there an easy way to figure out the capacity of a NSMutableData object - 
that is the number of bytes that can be written to the data object without 
causing it to reallocate the internal buffer or invalidating the base pointer 
to the internal buffer?

Example:

NSMutableData* data  =  ..

[data increaseLengthBy:1234];
void * p = [data mutableBytes];
NSUInteger data_capacity = [data capacity];  // An API like this would be fine!
[data setLength: data_capacity];
assert(p == [data mutableBytes]);


That would be a "nice to have" feature. I wouldn't use an approach that 
requires tricky hacks into the allocator.


Any ideas?



Regards
Andreas
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to