On Tue, Jul 19, 2011 at 10:14 AM, Andrew Wiley <wiley.andre...@gmail.com>wrote:

> On Tue, Jul 19, 2011 at 9:57 AM, Jesse Phillips <
> jessekphillip...@gmail.com> wrote:
>
>> Andrew Wiley Wrote:
>>
>> > I know, but if you look at the docs for the inflate functions, zlib is
>> > supposed to be autodetecting the gzip header and uncompressing the
>> payload
>> > correctly, if I understand the documentation (which I probably don't at
>> this
>> > point).
>>
>> Not sure what documentation you are talking of. But it doesn't sound like
>> it does auto detection, an answer to one of the question:
>>
>> "You can request that deflate write the gzip format instead of the zlib
>> format using deflateInit2(). You can also request that inflate decode the
>> gzip format using inflateInit2(). Read zlib.h for more details."
>>
>
> Ah, I stand corrected:
> "inflate() can decompress and check either zlib-wrapped or gzip-wrapped
>   deflate data.  The header type is detected automatically, if requested
> when
>   initializing with inflateInit2()."
>

Looks like this is the solution:
ubyte[] realarr = cast(ubyte[])uncompress(arr, 0, 47);
The 47 makes zlib autodetect the header (because the 32 bit is set; if you
wanted to force gzip, you'd set the 16 bit).

Reply via email to