The deflateCopy() function shall copy the compression state information in source to the uninitialized z_stream structure referenced by dest.
On successful return, dest will be an exact copy
of the stream referenced by source. The input and
output buffer pointers in
next_out will reference the same data.
On success, deflateCopy() shall return Z_OK. Otherwise it shall return a value less than zero to indicate the error.
On error, deflateCopy() shall return a value as described below:
The state in source is inconsistent, or
either source or
Insufficient memory available.
This function can be useful when several compression strategies will be tried, for example when there are several ways of pre-processing the input data with a filter. The streams that will be discarded should then be freed by calling deflateEnd(). Note that deflateCopy() duplicates the internal compression state which can be quite large, so this strategy may be slow and can consume lots of memory.