Skip to content

Commit a4f63d7

Browse files
Fix read count.
1 parent 6f40e43 commit a4f63d7

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/ImageSharp/IO/ChunkedMemoryStream.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ private int ReadImpl(Span<byte> buffer)
295295
}
296296

297297
int readCount = Math.Min(count, chunkSize - this.readOffset);
298-
chunkBuffer.Slice(this.readOffset, count).CopyTo(buffer.Slice(offset));
298+
chunkBuffer.Slice(this.readOffset, readCount).CopyTo(buffer.Slice(offset));
299299
offset += readCount;
300300
count -= readCount;
301301
this.readOffset += readCount;

tests/ImageSharp.Tests/IO/ChunkedMemoryStreamTests.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ public void CopyTo(Stream source, byte[] expected)
300300
public static TheoryData<string> GetAllTestImages()
301301
{
302302
IEnumerable<string> allImageFiles = Directory.EnumerateFiles(TestEnvironment.InputImagesDirectoryFullPath, "*.*", SearchOption.AllDirectories)
303-
.Where(s => !s.ToLower().EndsWith("txt"));
303+
.Where(s => !s.EndsWith("txt", StringComparison.OrdinalIgnoreCase));
304304
var result = new TheoryData<string>();
305305
foreach (string path in allImageFiles)
306306
{
@@ -314,7 +314,12 @@ public static TheoryData<string> GetAllTestImages()
314314
[MemberData(nameof(GetAllTestImages))]
315315
public void DecoderIntegrationTest(string testFileFullPath)
316316
{
317-
Image<Rgba32> expected = null;
317+
if (!TestEnvironment.Is64BitProcess)
318+
{
319+
return;
320+
}
321+
322+
Image<Rgba32> expected;
318323
try
319324
{
320325
expected = Image.Load<Rgba32>(testFileFullPath);
@@ -326,7 +331,7 @@ public void DecoderIntegrationTest(string testFileFullPath)
326331
}
327332

328333
using FileStream fs = File.OpenRead(testFileFullPath);
329-
using NonSeekableStream nonSeekableStream = new NonSeekableStream(fs);
334+
using var nonSeekableStream = new NonSeekableStream(fs);
330335

331336
var actual = Image.Load<Rgba32>(nonSeekableStream);
332337

0 commit comments

Comments
 (0)