[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: NSMutableData memcpy vs. memmove
From: |
Richard Frith-Macdonald |
Subject: |
Re: NSMutableData memcpy vs. memmove |
Date: |
Mon, 11 Mar 2002 19:54:59 +0000 |
On Monday, March 11, 2002, at 07:35 PM, Alexander Malmberg wrote:
Hi,
I noticed that [NSMutableData -replaceBytesInRange: withBytes:] uses
memcpy() when copying the new bytes into its mutableBytes. This means
that eg.:
NSMutableData *foo;
...
[foo replaceBytesInRange: NSMakeRange(5,[foo length]) withBytes: [foo
bytes]];
isn't safe. The docs I have don't say anything about how overlapping
should be handled, but it seems safer to use memmove() anyway.
ok.
Don't know how MacOS-X does it, but I see no reason why our version
should not be safe.