Actions
Bug #19252
closedIO::Buffer.pread last argument is always ignored?
Bug #19252:
IO::Buffer.pread last argument is always ignored?
Description
I am trying to document new IO::Buffer#pread and #pwrite methods.
According to what I can guess from code and tests, this code:
IO::Buffer.for('teststring') do |buffer|
buffer.pread(File.open('/dev/urandom', 'rb'), 0, 2, 3)
p buffer.get_string
end
...is expected to read 2 chars from /dev/urandom, starting from 0th char, and write it to buffer starting from its 3rd byte.
Actual output:
E.g. two first chars of the buffer are replaced.
Am I missing something, or is it a legitimate bug?..
UPD: Seems the same for pwrite:
Updated by ioquatix (Samuel Williams) over 3 years ago
It looks like the base pointer is not computed correctly, let me check and fix it.
Updated by ioquatix (Samuel Williams) over 3 years ago
- Status changed from Open to Closed
Merged.
Actions