From 189d66fb5387239ad25801678ecd2f73ef7f6e60 Mon Sep 17 00:00:00 2001 From: Jason Nelson Date: Wed, 31 Jan 2024 10:16:32 -0800 Subject: [PATCH] Eliminate a few allocations in PngMetadataReader --- MetadataExtractor/Formats/Png/PngMetadataReader.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MetadataExtractor/Formats/Png/PngMetadataReader.cs b/MetadataExtractor/Formats/Png/PngMetadataReader.cs index 73f2802d3..21a0742a8 100644 --- a/MetadataExtractor/Formats/Png/PngMetadataReader.cs +++ b/MetadataExtractor/Formats/Png/PngMetadataReader.cs @@ -295,7 +295,7 @@ private static IEnumerable ProcessChunk(PngChunk chunk) } else if (chunkType == PngChunkType.tIME) { - var reader = new SequentialByteArrayReader(bytes); + var reader = new BufferReader(bytes, isBigEndian: true); var year = reader.GetUInt16(); var month = reader.GetByte(); int day = reader.GetByte(); @@ -316,7 +316,7 @@ private static IEnumerable ProcessChunk(PngChunk chunk) } else if (chunkType == PngChunkType.pHYs) { - var reader = new SequentialByteArrayReader(bytes); + var reader = new BufferReader(bytes, isBigEndian: true); var pixelsPerUnitX = reader.GetInt32(); var pixelsPerUnitY = reader.GetInt32(); var unitSpecifier = reader.GetSByte();