iosobjective-cnsdatezlibnsstream

zlib decompression method with unknown object types


I am on a quest to figure out how to decompress some NSData thats been compressed using Zlib. I have recently had some help here, I had added the second method into the my class where I need to use it but not the first as I do not need to compress the NSData only decompress.

However I am having trouble with these lines of code

z_stream strm;
strm.next_in = (Bytef *)[compressedData bytes];
strm.avail_in = (unsigned int)[compressedData length];
strm.total_out = 0;
strm.zalloc = Z_NULL;
strm.zfree = Z_NULL;

I do not know the object types of z-stream or strm I have tried declaring them in my header as NSStreams but that dose not do anything.

the errors I am getting are as follows

Use of undeclared identifier 'z_stream'

any help would be great appreciated.


Solution

  • It looks like you haven't included (imported) the header file that defines z_stream:

    #import "zlib.h"