| 45 | GZipDecoder::~GZipDecoder() { release(); } |
| 46 | |
| 47 | void GZipDecoder::init() |
| 48 | { |
| 49 | finished_ = false; |
| 50 | release(); |
| 51 | strm_ = new z_stream(); |
| 52 | strm_->zalloc = Z_NULL; |
| 53 | strm_->zfree = Z_NULL; |
| 54 | strm_->opaque = Z_NULL; |
| 55 | strm_->avail_in = 0; |
| 56 | strm_->next_in = Z_NULL; |
| 57 | |
| 58 | // initialize z_stream with gzip/zlib format auto detection enabled. |
| 59 | if (Z_OK != inflateInit2(strm_, 47)) { |
| 60 | throw DL_ABORT_EX("Initializing z_stream failed."); |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | void GZipDecoder::release() |
| 65 | { |
no outgoing calls