gzip compression utility

Posted by Marian Edu on 29-Mar-2014 02:36

Released a small utility project that can handle compression/decompression using gzip file format - it's just a wrapper around zlib library written by Jean-loup Gailly - http://www.zlib.net/.

http://www.oehive.org/project/zlib4gl

or

https://sourceforge.net/projects/zlib4gl/

Released under GNU LGPL (https://www.gnu.org/licenses/lgpl.html) courtesy of XPower (www.xpower.be).

All Replies

Posted by CMI on 30-Mar-2014 21:54

Hey. Well Done.

I've been trying to use the zLib library on-and-off for years, with no real luck apart from being able to compress memptr using the DEFALTE algorithm of zLib.

I'm reading a compress GZIP data from a socket as part of a HTTP/web client. Why would you think that the compress memprt would fail when calling the uncompress() method with the following error 'Error on data uncompression. However if I write the compressed memptr to a file then call the uncompressFile() method it works.

Is there some extra headers in the GZIP data which is stripped as part of the gzread procedure in the zlib library???

Posted by Marian Edu on 31-Mar-2014 00:31

Indeed, all in-memory methods works only with actual payload while those dealing with files can deal with the extra gzip file format headers. Guess this can be fixed, what you are trying to do is to uncompress a gzip file (not just the payload) from a memptr... need output to a file or in-memory?

Posted by CMI on 31-Mar-2014 03:37

Yeah. That's what I wanted to achieve, decompression in memory. A few months ago I was looking at the inflateInit2 function in the zlib library  but due to the lacking of C programming skills I was never successful in being able to pass the correct values.

I'm never sure on how to define a memprt to act like C type definition structure, especially when the definition can variable bytes size of data.  

Posted by Marian Edu on 31-Mar-2014 03:52

think those works with a stream as input, what can be done is to check if memptr starts with a gzip header an then only get the payload out of it... maybe we can use the info in header as well, will look into that time permitting :)

This thread is closed