Use Stream extension to ensure read operations return the requested number of bytes (unless EOF arrives first).

This commit is contained in:
2022-11-14 09:43:15 +00:00
parent 7437cb04a5
commit 5bb04c0204
5 changed files with 12 additions and 12 deletions

View File

@@ -498,13 +498,13 @@ public sealed class Crc64Context : IChecksum
ulong[][] localTable = GenerateTable(polynomial);
var buffer = new byte[65536];
int read = fileStream.Read(buffer, 0, 65536);
int read = fileStream.EnsureRead(buffer, 0, 65536);
while(read > 0)
{
Step(ref localHashInt, localTable, buffer, (uint)read, useEcma, useNative, nativeContext);
read = fileStream.Read(buffer, 0, 65536);
read = fileStream.EnsureRead(buffer, 0, 65536);
}
localHashInt ^= seed;