Name

inflateSyncPoint — Tests for synchronization point.


Library

Libz.lib


Synopsis

#include <zlib.h>

int inflateSyncPoint(z_streamp stream);


Return Value

If the compressed data in stream is at a synchronization point (see deflate() with a flush level of Z_SYNC_FLUSH or Z_FULL_FLUSH), inflateSyncPoint() shall return a non-zero value, other than Z_STREAM_ERROR. Otherwise, if the stream is valid, inflateSyncPoint() shall return 0. If stream is invalid, or in an invalid state, inflateSyncPoint() shall return Z_STREAM_ERROR to indicate the error.


Detailed Description

The inflateSyncPoint() function shall return a non-zero value if the compressed data stream referenced by stream is at a synchronization point.


Examples

To test for synchronization point:

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

void InflateSyncPoint( )
{
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);
z_stream stream;
const char hello[] = "hello, hello!";
stream.next_in = (Bytef*)hello;
stream.avail_in = (uInt)sourceLen;
stream.next_out = dest;
stream.avail_out = (uInt)*destLen;
stream.zalloc = (alloc_func)0;
stream.zfree = (free_func)0;
stream.opaque = (voidpf)0;
err = deflateInit(&stream, level);
err = deflate(&stream, Z_FINISH);
*destLen = stream.total_out;
int h=inflateSyncPoint(&stream);
deflateEnd(&stream);
free(compr);
free(uncompr);
}

Output

A non-zero value of h , other than Z_STREAM_ERROR is indication of synchronization point. 

Errors

On error, inflateSyncPoint() shall return a value as described below:

Z_STREAM_ERROR

The state (as represented in stream) is inconsistent, or stream was NULL.


Feedback

For additional information or queries on this page send feedback

© 2005-2007 Nokia

Top