The Forum is up for sale: XeNTaX Forum looking for new owner

Zlib help

Coders and would-be coders alike, this is the place to talk about programming.
Post Reply
grimdoomer
advanced
Posts: 70
Joined: Fri Mar 21, 2008 8:11 pm
Location: New York
Been thanked: 1 time

Zlib help

Post by grimdoomer »

Recently I have been trying to modify some files that are compressed with zlib. They were originally compressed with zlib 1.2.3 using Z_SYNC_FLUSH. I can decompress the original files just fine. But if I try to rebuild the files, and decompress my rebuilt ones, it fails part way through with the error of "invalid stored block lengths". I have tried with both zlib 1.2.3 and 1.2.5. It seems to happen no matter how big the file is. I've created a small test project in Visual C++ 2008, included is the source code for the project which will generate a test file, compress it, and try to decompress it. You may have to relink the header/library search paths in the project, but I have included all needed headers/libs in the zlib folder. Dont forget to change the file paths the project uses. By default it uses C:\test\ for storing the test files. Any help is much appreciated, I have been messing with this for days and can not get it to work.
Download
shakotay
ultra-n00b
Posts: 8
Joined: Thu Oct 28, 2010 10:43 pm

Re: Zlib help

Post by shakotay »

The streams_0_decompressed.bin is shorter than the streams_0_test.bin by 16896 bytes.

(edit: 0x4200 is the remainder if you devide the filesize 0x1C9C200 by 0x8000.)

Compresssing ends up with result = deflateEnd() = 0xfffffffd -> Z_DATA_ERROR.

To debug deflatedEnd() you should include zlib sources to your project.

I'm just too lazy now to do this... (because it's time to sleep in good old europe;-)
Post Reply