From f4437f578ca91a8c1b167f1e42966e33b9149b4f Mon Sep 17 00:00:00 2001 From: Jason Nelson Date: Fri, 2 Feb 2024 11:04:34 -0800 Subject: [PATCH] Improve code readability in BplistReader --- MetadataExtractor/Formats/Apple/BplistReader.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/MetadataExtractor/Formats/Apple/BplistReader.cs b/MetadataExtractor/Formats/Apple/BplistReader.cs index e591bf2d6..0e76130b5 100644 --- a/MetadataExtractor/Formats/Apple/BplistReader.cs +++ b/MetadataExtractor/Formats/Apple/BplistReader.cs @@ -43,19 +43,20 @@ public static PropertyListResults Parse(byte[] bplist) Trailer trailer = ReadTrailer(); - var reader = new BufferReader(bplist.AsSpan(checked((int)(trailer.OffsetTableOffset + trailer.TopObject))), isBigEndian: true); + int offset = checked((int)(trailer.OffsetTableOffset + trailer.TopObject)); + var reader = new BufferReader(bplist.AsSpan(offset), isBigEndian: true); int[] offsets = new int[(int)trailer.NumObjects]; - for (long i = 0; i < trailer.NumObjects; i++) + for (int i = 0; i < (int)trailer.NumObjects; i++) { if (trailer.OffsetIntSize == 1) { - offsets[(int)i] = reader.GetByte(); + offsets[i] = reader.GetByte(); } else if (trailer.OffsetIntSize == 2) { - offsets[(int)i] = reader.GetUInt16(); + offsets[i] = reader.GetUInt16(); } }