deflateReset — Resets all state associated with stream.
On success, deflateReset() shall return Z_OK. Otherwise it shall return Z_STREAM_ERROR to indicate the error.
The deflateReset()
function shall reset
all state
associated with stream.
All pending output shall be discarded, and the counts of processed
bytes (total_in
and total_out
) shall be reset to zero.
To reset all the states associated with the stream:
#include <stdio.h>
#include <zlib.h> void DeflateReset( ) { z_stream stream; int level = Z_DEFAULT_COMPRESSION ; uLong sourceLen = (uLong)strlen(hello)+1; Byte *compr, *uncompr; Bytef *dest = compr ; uLongf *destLen = &comprLen; const char hello[] = "hello, hello!"; const Bytef *source = (const Bytef*)hello; uLong sourceLen = len; stream.next_in = (Bytef*)source; stream.avail_in = (uInt)sourceLen; uLong comprLen = 20*sizeof(int); uLong uncomprLen = comprLen; compr = (Byte*)calloc((uInt)comprLen, 1); uncompr = (Byte*)calloc((uInt)uncomprLen, 1); stream.zalloc = (alloc_func)0; stream.zfree = (free_func)0; stream.opaque = (voidpf)0; deflateInit(&stream, level); deflateReset(&stream); deflateEnd(&stream); free(compr); free(uncompr); } |
On error, deflateReset() shall return Z_STREAM_ERROR. The following conditions shall be treated as an error:
The state in stream is inconsistent or
inappropriate.
stream is NULL
For additional information or queries on this page send feedback
© 2008 Nokia Corporation. All rights reserved. This documentation can be used in the connection with this Product to help and support the user. |