From aec8cd9508854ebfc53be7faa414d9c325c20bea Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Mon, 23 Sep 2024 05:14:17 +0200 Subject: [PATCH] started debugging, making endian change --- image/Png.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/image/Png.h b/image/Png.h index c0569a7..e68f965 100644 --- a/image/Png.h +++ b/image/Png.h @@ -419,14 +419,17 @@ bool image_png_generate(const FileBody* src_data, Image* image, RingMemory* ring chunk.length = SWAP_ENDIAN_BIG(*((uint32 *) stream.pos)); stream.pos += sizeof(chunk.length); - chunk.type = SWAP_ENDIAN_BIG(*((uint32 *) stream.pos)); + chunk.type = *((uint32 *) stream.pos); stream.pos += sizeof(chunk.type); - if (chunk.type == 'IEND') { + if (chunk.type == SWAP_ENDIAN_BIG('IEND')) { // we arrived at the end of the file break; - } else if (chunk.type != 'IDAT') { - // some other data?! + } else if (chunk.type != SWAP_ENDIAN_BIG('IDAT')) { + // some other data + + // Jump to next chunk + stream.pos += chunk.length + sizeof(chunk.crc); continue; }