From b546ce9fa75a2191c1193c0b2d3f9632759d0839 Mon Sep 17 00:00:00 2001 From: Abdelrahman Date: Sat, 4 May 2024 22:47:23 +0100 Subject: [PATCH] Calculate strip field size once --- src/tiff/tiffread.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/tiff/tiffread.c b/src/tiff/tiffread.c index d9e0289..3a14ce0 100644 --- a/src/tiff/tiffread.c +++ b/src/tiff/tiffread.c @@ -327,11 +327,14 @@ bool read_strip_data(TiffReader *reader, Arena *arena) { return false; } + u16 offset_size = reader->img.strip_offsets_type_byte_count; + u16 counts_size = reader->img.strip_byte_count_type_byte_count; + for (u32 i = 0; i < reader->img.strip_count; ++i) { TiffStrip *strip = &(reader->img.strips[i]); - u16 offset_size = reader->img.strip_offsets_type_byte_count; - u16 counts_size = reader->img.strip_byte_count_type_byte_count; + // read_strip_field(reader, &(strip->offset), &(reader->img.strip_offsets), + // i, offsets_total_bytes, offset_size); if (offsets_total_bytes > sizeof(u32)) { u32 offset = reader->img.strip_offsets.long_val + offset_size * i;