DMD2, std.zlib, and gzip

Vladimir Panteleev thecybershadow at gmail.com
Wed Jul 22 23:14:30 PDT 2009


On Thu, 23 Jul 2009 08:40:48 +0300, Glenn Lewis <nospam at nospam.org> wrote:

> If I'm not mistaken, I used to use std.zlib with DMD1, and it was  
> compatible with gzip.
> Now that Andrei's awesome book is available on RoughCuts, I finally  
> figured I would take the plunge and switch up to DMD2.

If you compare DMD1 and DMD2's zlib.d, you'll notice that the differences  
are trivial, and the zlib library itself hasn't changed at all, so nothing  
could have changed to affect this.

> I tried writing a file with std.zlib.compress, and gzip could not  
> uncompress it (both level=6 and level=9).
> I tried gzip'ing a file, and std.zlib.uncompress could not uncompress it  
> (see attached D file).

What you seem to be confusing is that zlib is a compression algorithm,  
while gzip is a compression utility and file format. You need to add a  
header to zlib-compressed data.

I've attached a simple module I use to encode/decode gzip files. Hope this  
helps.

-- 
Best regards,
  Vladimir                          mailto:thecybershadow at gmail.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Gzip.d
Type: application/octet-stream
Size: 1247 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20090723/54c691ed/attachment.obj>


More information about the Digitalmars-d mailing list