-
Notifications
You must be signed in to change notification settings - Fork 7.3k
buffer copy with overlapping regions #8857
Comments
Unfortunately looking at the source doesn't make this one any clearer. Definitely appears to be a straightforward documentation bug. The expected behavior is just that buf1[sourceStart...sourceEnd] is copied to buf1[targetStart...n], where n depends on a number of factors. The sentence about regions being overlapped just adds unnecessary confusion. |
|
Ah yes... completely overlooked that one the first time through. It would definitely be a good thing to call that out a bit more explicitly in the docs then. |
Improve documentation for buffer.toString and buffer.copy per issues nodejs#8859 and nodejs#8857.
Improvements to document for buffer.toString and buffer.copy per issues nodejs#8859 and nodejs#8857 (rebased and on joyent/v0.10 and improved slightly)
Better wording for start and end parameters, also document .length should be considered readonly. RE: nodejs#8857, nodejs#8859, nodejs#8913 PR: nodejs#8910 PR-URL: nodejs#8910 Signed-off-by: Timothy J Fontaine <[email protected]>
Better wording for start and end parameters, also document .length should be considered readonly. RE: nodejs#8857, nodejs#8859, nodejs#8913 PR: nodejs#8910 PR-URL: nodejs#8910 Signed-off-by: Timothy J Fontaine <[email protected]>
The documentation merely says:
What is the expected behavior in this case? Experimentally, the line
buf.copy(buf, targetStart, sourceStart, sourceEnd)
appears to be roughly equivalent tofor(var i = sourceEnd - sourceStart; i > 0; --i) buf[targetStart + i - 1] = buf[sourceStart + i - 1];
, but the documentation is unclear.The text was updated successfully, but these errors were encountered: