for ( ; index < _chunksCount && withLength; index++)
{
- IOByteCount copy = min(_chunks[index].length, withLength);
+ IOByteCount copy = min(_chunks[index].length - offset, withLength);
IOByteCount copied = _chunks[index].buffer->readBytes(
/* offset */ offset + _chunks[index].offset,
/* bytes */ bytes,
for ( ; index < _chunksCount && withLength; index++)
{
- IOByteCount copy = min(_chunks[index].length, withLength);
+ IOByteCount copy = min(_chunks[index].length - offset, withLength);
IOByteCount copied = _chunks[index].buffer->writeBytes(
/* offset */ offset + _chunks[index].offset,
/* bytes */ bytes,