Skip to content

Commit 40b7be8

Browse files
fix allocation (CA2014)
1 parent 8de08ba commit 40b7be8

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/ImageSharp/Metadata/Profiles/Exif/ExifReader.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,7 @@ protected void ReadSubIfd(List<IExifValue> values)
191191
{
192192
do
193193
{
194-
int sz = this.subIfds.Count;
195-
Span<ulong> buf = sz <= 256 ? stackalloc ulong[sz] : new ulong[sz];
196-
197-
this.subIfds.CopyTo(buf);
194+
ulong[] buf = [.. this.subIfds];
198195
this.subIfds.Clear();
199196
foreach (ulong subIfdOffset in buf)
200197
{
@@ -456,6 +453,7 @@ private void ReadValue64(List<IExifValue> values, Span<byte> offsetBuffer)
456453
ExifTagValue.TileByteCounts => new ExifLong8Array(ExifTagValue.TileByteCounts),
457454
_ => ExifValues.Create(tag) ?? ExifValues.Create(tag, dataType, numberOfComponents),
458455
};
456+
459457
if (exifValue is null)
460458
{
461459
this.AddInvalidTag(new UnkownExifTag(tag));

0 commit comments

Comments
 (0)