#[export_name = "deflateCopy"]
pub unsafe extern "C-unwind" fn deflateCopy(
dest: z_streamp,
source: z_streamp,
) -> c_int
Expand description
Sets the destination stream as a complete copy of the source stream.
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 is slow and can consume lots of memory.
§Returns
Z_OK
if successZ_MEM_ERROR
if there was not enough memoryZ_STREAM_ERROR
if the source stream state was inconsistent (such as zalloc being NULL)
The msg
field is left unchanged in both source and destination.
§Safety
The caller must guarantee that
- Either
dest
isNULL
dest
satisfies the requirements of&mut *(dest as *mut MaybeUninit<z_stream>)
- Either
source
isNULL
source
satisfies the requirements of&mut *strm
and was initialized withdeflateInit_
or similar