ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
uncompr.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "misc/util/abc_global.h"
#include "zlib.h"
Include dependency graph for uncompr.c:

Go to the source code of this file.

Macros

#define ZLIB_INTERNAL
 

Functions

ABC_NAMESPACE_IMPL_START int ZEXPORT uncompress (Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen)
 

Macro Definition Documentation

◆ ZLIB_INTERNAL

#define ZLIB_INTERNAL

Definition at line 13 of file uncompr.c.

Function Documentation

◆ uncompress()

ABC_NAMESPACE_IMPL_START int ZEXPORT uncompress ( Bytef * dest,
uLongf * destLen,
const Bytef * source,
uLong sourceLen )

Definition at line 31 of file uncompr.c.

32{
33 z_stream stream;
34 int err;
35
36 stream.next_in = (Bytef*)source;
37 stream.avail_in = (uInt)sourceLen;
38 /* Check for source > 64K on 16-bit machine: */
39 if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR;
40
41 stream.next_out = dest;
42 stream.avail_out = (uInt)*destLen;
43 if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR;
44
45 stream.zalloc = (alloc_func)0;
46 stream.zfree = (free_func)0;
47
48 err = inflateInit(&stream);
49 if (err != Z_OK) return err;
50
51 err = inflate(&stream, Z_FINISH);
52 if (err != Z_STREAM_END) {
53 inflateEnd(&stream);
54 if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0))
55 return Z_DATA_ERROR;
56 return err;
57 }
58 *destLen = stream.total_out;
59
60 err = inflateEnd(&stream);
61 return err;
62}
int ZEXPORT inflate(z_streamp strm, int flush)
Definition inflate.c:580
int ZEXPORT inflateEnd(z_streamp strm)
Definition inflate.c:1227
uInt avail_in
Definition zlib.h:95
Bytef * next_in
Definition zlib.h:94
alloc_func zalloc
Definition zlib.h:105
uInt avail_out
Definition zlib.h:99
free_func zfree
Definition zlib.h:106
uLong total_out
Definition zlib.h:100
Bytef * next_out
Definition zlib.h:98
unsigned int uInt
Definition zconf.h:335
unsigned long uLong
Definition zconf.h:336
Byte FAR Bytef
Definition zconf.h:342
#define Z_NEED_DICT
Definition zlib.h:183
#define Z_BUF_ERROR
Definition zlib.h:188
#define Z_STREAM_END
Definition zlib.h:182
#define Z_FINISH
Definition zlib.h:176
#define Z_OK
Definition zlib.h:181
#define Z_DATA_ERROR
Definition zlib.h:186
struct z_stream_s z_stream
#define inflateInit(strm)
Definition zlib.h:1556
Here is the call graph for this function:
Here is the caller graph for this function: