Why does FCompression not support GZIP for UncompressMemory?

We are working on a project that will be receiving custom compressed messages from over the network in GZIP format. Why is the implementation of FCompression incomplete it that it supports compressing to GZIP but not decompressing from GZIP?

I know this is probably too late to help you but I’m going to post this anyway as it puzzled me for a while so hopefully it will help someone else.

According to advice on using the zlib library (found here Stack Overflow) you can decompress using GZIP format by passing in a different parameter for the WindowBits argument. You must pass DEFAULT_ZLIB_BIT_WINDOW | 16 instead

My code for uncompression is as follows
(where UncompressedContent and Content are of type TArray<uint8> of the correct sizes)

FCompression::UncompressMemory(COMPRESS_ZLIB, (void*)UncompressedContent.GetData(), UncompressedContent.Num(), (const void*)Content.GetData(), Content.Num(), false, DEFAULT_ZLIB_BIT_WINDOW | 16)
1 Like

In the meantime, the parameters have changed but your example was a great help to me. Thank you.

You revived a rather old question, but there’s another answer to it that I’m surprised no one noticed.

You aren’t Allowed to use GZip with UE4 or anything connected with it.
It violates the ULA. GPL licenses force you to make code available that you don’t have a license to make available.

The only use you can make of any GPL licensed product is to dymanically link a shared library.