Return Type | Function name | Arguments |
---|---|---|
hzEcode | Gunzip | (hzChain&,const hzChain&,) |
Declared in file: hzCodec.h
Defined in file : hzCodec.cpp
Function Logic:
Function body:
hzEcode Gunzip (hzChain& orig, const hzChain& gzipped) { _hzfunc(__func__) ; z_stream infstream ; chIter zi ; char* tmp ; char* buf ; uint32_t n ; tmp = new char[gzipped.Size()+1]; buf = new char[20480]; for (n = 0,zi = gzipped ; !zi.eof() ; n++, zi++) tmp[n] = *zi ; infstream.zalloc = Z_NULL; infstream.zfree = Z_NULL; infstream.opaque = Z_NULL; // setup "b" as the input and "c" as the compressed output infstream.avail_in = (uInt) gzipped.Size() ; infstream.next_in = (Bytef*)tmp ; // input char array infstream.avail_out = 20480; infstream.next_out = (Bytef*)buf ; // output char array // the actual DE-compression work. if (inflateInit2(&infstream, 31)!=Z_OK) return E_NOINIT ; inflate(&infstream, Z_NO_FLUSH); inflateEnd(&infstream); for (n = 0; n < infstream.total_out ; n++) orig.AddByte(buf[n]) ; delete tmp ; delete buf ; return E_OK ; }