mirror of
https://github.com/Thealexbarney/LibHac.git
synced 2024-11-14 10:49:41 +01:00
Fixed StorageStream and NxFileStream from possibly reading too much
This commit is contained in:
parent
5e321b7601
commit
b5bd5346d4
2 changed files with 2 additions and 2 deletions
|
@ -18,7 +18,7 @@ namespace LibHac.IO
|
||||||
public override int Read(byte[] buffer, int offset, int count)
|
public override int Read(byte[] buffer, int offset, int count)
|
||||||
{
|
{
|
||||||
int toRead = (int)Math.Min(count, Length - Position);
|
int toRead = (int)Math.Min(count, Length - Position);
|
||||||
BaseFile.Read(buffer.AsSpan(offset, count), Position);
|
BaseFile.Read(buffer.AsSpan(offset, toRead), Position);
|
||||||
|
|
||||||
Position += toRead;
|
Position += toRead;
|
||||||
return toRead;
|
return toRead;
|
||||||
|
|
|
@ -21,7 +21,7 @@ namespace LibHac.IO
|
||||||
public override int Read(byte[] buffer, int offset, int count)
|
public override int Read(byte[] buffer, int offset, int count)
|
||||||
{
|
{
|
||||||
int toRead = (int) Math.Min(count, Length - Position);
|
int toRead = (int) Math.Min(count, Length - Position);
|
||||||
BaseStorage.Read(buffer.AsSpan(offset, count), Position);
|
BaseStorage.Read(buffer.AsSpan(offset, toRead), Position);
|
||||||
|
|
||||||
Position += toRead;
|
Position += toRead;
|
||||||
return toRead;
|
return toRead;
|
||||||
|
|
Loading…
Reference in a new issue