Name

inflateReset — Resets all state associated with stream..


Library

Libz.lib


Synopsis

#include <zlib.h>

int inflateReset(z_streamp stream);


Return Value

On success, inflateReset() shall return Z_OK. Otherwise it shall return Z_STREAM_ERROR to indicate the error.

Detailed Description

The inflateReset() 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.


Examples

To reset all the states associated with stream:

#include <stdio.h>
#include <zlib.h>

void InflateReset( )
{
z_stream d_stream; /* decompression stream */
const char * version;
d_stream.zalloc = (alloc_func)0;
d_stream.zfree = (free_func)0;
d_stream.opaque = (voidpf)0;
uLong len = (uLong)strlen(hello)+1;
Byte *compr, *uncompr;
uLong comprLen = 20*sizeof(int);
uLong uncomprLen = comprLen;
compr = (Byte*)calloc((uInt)comprLen, 1);
uncompr = (Byte*)calloc((uInt)uncomprLen, 1);
compress(compr, &comprLen, (const Bytef*)hello, len);
d_stream.next_in = compr;
d_stream.avail_in = 0;
d_stream.next_out = uncompr;
version=zlibVersion();
inflateInit_(&d_stream,(char*)version, sizeof(d_stream));
inflateReset(&d_stream);
inflateEnd(&d_stream);
}


Errors

On error, inflateReset() shall return Z_STREAM_ERROR. The following conditions shall be treated as an error:


Feedback

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.

Top