From e1e5b4e92bcd460b43ce1b852560751b6525593e Mon Sep 17 00:00:00 2001 From: Clement Sibille Date: Tue, 27 Feb 2024 17:23:33 +0900 Subject: Implement Deflate decompression This patch adds the decompression code for zlib compressed data streams that are compressed using Deflate based on RFC-1950 and RFC-1951. This implementation lacks support for zlib prefix dictionaries and for non-compressed Deflate blocks as these are less common. --- lisiblepng/src/deflate.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lisiblepng/src/deflate.h') diff --git a/lisiblepng/src/deflate.h b/lisiblepng/src/deflate.h index e40f816..77100c6 100644 --- a/lisiblepng/src/deflate.h +++ b/lisiblepng/src/deflate.h @@ -5,7 +5,11 @@ #include #include -bool zlib_decompress(const uint8_t *compressed_data_buffer, - const size_t compressed_data_length); +/// Decompresses zlib compressed data as defined by RFC 1950 +/// +/// @return A pointer to the decompressed data, the caller is responsible to +/// deallocate it using free(). In case of error, NULL is returned. +char *zlib_decompress(const uint8_t *compressed_data_buffer, + const size_t compressed_data_length); #endif // LISIBLE_PNG_DEFLATE_H -- cgit v1.2.3