From 0e03adb88e4e412428a09ac799e1141fd92f7f47 Mon Sep 17 00:00:00 2001 From: Luna Date: Mon, 7 Jul 2025 08:50:33 +0200 Subject: [PATCH] uncompress now works? --- lily_png.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lily_png.cpp b/lily_png.cpp index 400eb83..838032a 100644 --- a/lily_png.cpp +++ b/lily_png.cpp @@ -1,4 +1,5 @@ #include "lily_png.h" +#include static metadata parse_metadata(buffer &data) { @@ -117,8 +118,7 @@ buffer_unsigned read_png(const std::string &file_path) meta = parse_metadata(std::get<0>(data)); else if (strcmp("IDAT", std::get<1>(chunk_head).data) == 0) { - buffer &temp_buf = std::get<0>(data); - image_data_concat.write(reinterpret_cast(temp_buf.data), temp_buf.size); + image_data_concat.write(reinterpret_cast(std::get<0>(data).data), std::get<0>(data).size); } else if (strcmp("IEND",std::get<1>(chunk_head).data) == 0) break; @@ -128,7 +128,7 @@ buffer_unsigned read_png(const std::string &file_path) std::println("Allocations {}", image_data_concat.allocations); image_data.allocate(get_uncompressed_size(meta)); size_t prev_allocated = image_data.allocated; - int r = uncompress(image_data.data, &prev_allocated, image_data_concat.data, image_data_concat.size); + int r = uncompress(image_data.data, &prev_allocated, image_data_concat.data, image_data_concat.allocated); if (r != Z_OK) { std::println("Uncompress failed {}", r);