Problems with Zlib - data error

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Apr 21 05:57:25 PDT 2017


On Friday, 21 April 2017 at 11:18:55 UTC, Era Scarecrow wrote:
>  So that's what's going on. But if I have to dup the blocks 
> then I have the same problem as before with limited memory 
> issues. I kinda wish more there was the gz_open that is in the 
> C interface and let it deal with the decompression and memory 
> management as appropriate.

You could always declare it with extern(C) and call it yourself.

But I didn't realize your thing was a literal example from the 
docs. Ugh, can't even trust that.

> I suppose i could incorporate a 8 byte header file that has the 
> length before/after that are 0's and just drop 630Mb from the 
> data that can be skipped... which is the bulk of the compressed 
> data. I just hoped to keep it very simple.

Take a look at zlib.d's source

http://dpldocs.info/experimental-docs/source/std.zlib.d.html#L232

It isn't a long function, so if you take that you can copy/paste 
the C parts to get you started with your own function that 
manages the memory more efficiently to drop the parts you don't 
care about.


More information about the Digitalmars-d-learn mailing list