don't assume that the number of bytes actually read/written are equal to what we asked for

This commit is contained in:
Michael Becker 2020-09-16 14:03:51 -04:00
parent b983f526f4
commit 40e016c8d1
No known key found for this signature in database
GPG Key ID: 506F54899E2BFED7

View File

@ -92,15 +92,18 @@ namespace UniversalEditor.Accessors
{
// TODO: will ct ever be != count? should we add ct to Position instead of count??
int ct = mvarBaseStream.Read(buffer, start, count);
// Position += count;
return count;
// --->: apparently, ct sometimes DOES != count, and it's important here to return ct
// instead of count to prevent freezing on certain streams
return ct;
}
protected internal override int WriteInternal(byte[] buffer, int start, int count)
{
long oldpos = Position;
mvarBaseStream.Write(buffer, start, count);
// Position += count;
return count;
return (int)(Position - oldpos);
}
protected override void OpenInternal()