properly update Accessor.Position for MemoryAccessor

This commit is contained in:
Michael Becker 2019-11-22 19:11:57 -05:00
parent e02d9ddb87
commit 02398ed366
No known key found for this signature in database
GPG Key ID: 389DFF5D73781A12

View File

@ -139,11 +139,12 @@ namespace UniversalEditor.Accessors
private int _actualLength = 0;
protected internal override int WriteInternal(byte[] buffer, int start, int count)
{
if (_actualLength + count > _data.Length)
if (ptr + count > _data.Length)
{
ResizeArray(ref _data, _data.Length + BufferAllocationSize);
}
System.Array.Copy(buffer, start, _data, _actualLength, count);
System.Array.Copy(buffer, start, _data, ptr, count);
ptr += count;
_actualLength += count;
return count;
}