mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Use Stream extension to ensure read operations return the requested number of bytes (unless EOF arrives first).
This commit is contained in:
@@ -40,6 +40,7 @@ using Aaru.Checksums;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.Console;
|
||||
using Aaru.Helpers;
|
||||
|
||||
public sealed partial class CdrWin
|
||||
{
|
||||
@@ -68,13 +69,13 @@ public sealed partial class CdrWin
|
||||
|
||||
while(readBytes + verifySize < stream.Length)
|
||||
{
|
||||
stream.Read(verifyBytes, 0, verifyBytes.Length);
|
||||
stream.EnsureRead(verifyBytes, 0, verifyBytes.Length);
|
||||
ctx.Update(verifyBytes);
|
||||
readBytes += verifyBytes.LongLength;
|
||||
}
|
||||
|
||||
verifyBytes = new byte[stream.Length - readBytes];
|
||||
stream.Read(verifyBytes, 0, verifyBytes.Length);
|
||||
stream.EnsureRead(verifyBytes, 0, verifyBytes.Length);
|
||||
ctx.Update(verifyBytes);
|
||||
}
|
||||
|
||||
@@ -96,13 +97,13 @@ public sealed partial class CdrWin
|
||||
|
||||
while(readBytes + verifySize < stream.Length)
|
||||
{
|
||||
stream.Read(verifyBytes, 0, verifyBytes.Length);
|
||||
stream.EnsureRead(verifyBytes, 0, verifyBytes.Length);
|
||||
ctx.Update(verifyBytes);
|
||||
readBytes += verifyBytes.LongLength;
|
||||
}
|
||||
|
||||
verifyBytes = new byte[stream.Length - readBytes];
|
||||
stream.Read(verifyBytes, 0, verifyBytes.Length);
|
||||
stream.EnsureRead(verifyBytes, 0, verifyBytes.Length);
|
||||
ctx.Update(verifyBytes);
|
||||
}
|
||||
|
||||
@@ -124,13 +125,13 @@ public sealed partial class CdrWin
|
||||
|
||||
while(readBytes + verifySize < stream.Length)
|
||||
{
|
||||
stream.Read(verifyBytes, 0, verifyBytes.Length);
|
||||
stream.EnsureRead(verifyBytes, 0, verifyBytes.Length);
|
||||
ctx.Update(verifyBytes);
|
||||
readBytes += verifyBytes.LongLength;
|
||||
}
|
||||
|
||||
verifyBytes = new byte[stream.Length - readBytes];
|
||||
stream.Read(verifyBytes, 0, verifyBytes.Length);
|
||||
stream.EnsureRead(verifyBytes, 0, verifyBytes.Length);
|
||||
ctx.Update(verifyBytes);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user