Skip to content

Commit 5127202

Browse files
committed
pr comment fix
1 parent e259e35 commit 5127202

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ public void Dispose()
523523
/// <param name="markerContentByteSize">The remaining bytes in the segment block.</param>
524524
private void ProcessComMarker(BufferedReadStream stream, int markerContentByteSize)
525525
{
526-
Span<byte> temp = stackalloc byte[markerContentByteSize];
526+
Span<byte> temp = new byte[markerContentByteSize];
527527
char[] chars = new char[markerContentByteSize];
528528
JpegMetadata metadata = this.Metadata.GetFormatMetadata(JpegFormat.Instance);
529529

src/ImageSharp/Formats/Jpeg/JpegEncoderCore.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ private void WriteComment(JpegMetadata metadata)
185185
// Length (comment strings lengths) + (comments markers with payload sizes)
186186
int commentsBytes = metadata.Comments.Sum(x => x.Length) + (metadata.Comments.Count * 4);
187187
int commentStart = 0;
188-
Span<byte> commentBuffer = stackalloc byte[commentsBytes];
188+
Span<byte> commentBuffer = new byte[commentsBytes];
189189

190190
foreach (Memory<char> comment in metadata.Comments)
191191
{

tests/ImageSharp.Tests/Formats/Jpg/JpegEncoderTests.Metadata.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public void Encode_PreserveRatio(string imagePath, int xResolution, int yResolut
137137
[MemberData(nameof(QualityFiles))]
138138
public void Encode_PreservesQuality(string imagePath, int quality)
139139
{
140-
var testFile = TestFile.Create(imagePath);
140+
TestFile testFile = TestFile.Create(imagePath);
141141
using (Image<Rgba32> input = testFile.CreateRgba32Image())
142142
{
143143
using (var memStream = new MemoryStream())
@@ -160,15 +160,15 @@ public void Encode_PreservesComments<TPixel>(TestImageProvider<TPixel> provider)
160160
where TPixel : unmanaged, IPixel<TPixel>
161161
{
162162
// arrange
163-
using var input = provider.GetImage(JpegDecoder.Instance);
163+
using Image<TPixel> input = provider.GetImage(JpegDecoder.Instance);
164164
using var memStream = new MemoryStream();
165165

166166
// act
167167
input.Save(memStream, JpegEncoder);
168168

169169
// assert
170170
memStream.Position = 0;
171-
using var output = Image.Load<Rgba32>(memStream);
171+
using Image<Rgba32> output = Image.Load<Rgba32>(memStream);
172172
JpegMetadata actual = output.Metadata.GetJpegMetadata();
173173
Assert.NotEmpty(actual.Comments);
174174
Assert.Equal(1, actual.Comments.Count);
@@ -190,7 +190,7 @@ public void Encode_SavesMultipleComments()
190190

191191
// assert
192192
memStream.Position = 0;
193-
using var output = Image.Load<Rgba32>(memStream);
193+
using Image<Rgba32> output = Image.Load<Rgba32>(memStream);
194194
JpegMetadata actual = output.Metadata.GetJpegMetadata();
195195
Assert.NotEmpty(actual.Comments);
196196
Assert.Equal(2, actual.Comments?.Count);

0 commit comments

Comments
 (0)