[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
NSMutableData memcpy vs. memmove
From: |
Alexander Malmberg |
Subject: |
NSMutableData memcpy vs. memmove |
Date: |
Mon, 11 Mar 2002 20:35:04 +0100 |
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. If it
should remain like it is, the behavior should at least be documented.
- Alexander Malmberg
- NSMutableData memcpy vs. memmove,
Alexander Malmberg <=