To compress/decompress data with zlib , first I need to set up a struct called z_stream.
z_stream has two non-const pointers called next_in and next_out.
If I want to do a function like this:
void ungzip(std::vector<unsigned char>& dst,const std::vector<unsigned char>& src)
{
z_stream strm;
// more code
}
and other like,
void gzip (std::vector<unsigned char>& dst,const std::vector<unsigned char>& src);
What I should do?
Copy src in a local std::vector<unsigned char>
std::vector<unsigned char> tmp(src);
and use it as source or setting pointer like this , strm.next_in = const_cast<char*>(&src[0])?
Does zlib keep input data?