ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
compress_.c File Reference
#include "zlib.h"
Include dependency graph for compress_.c:

Go to the source code of this file.

Macros

#define ZLIB_INTERNAL
 

Functions

ABC_NAMESPACE_IMPL_START int ZEXPORT compress2 (Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen, int level)
 
int ZEXPORT compress (Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen)
 
uLong ZEXPORT compressBound (uLong sourceLen)
 

Macro Definition Documentation

◆ ZLIB_INTERNAL

#define ZLIB_INTERNAL

Definition at line 8 of file compress_.c.

Function Documentation

◆ compress()

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

Definition at line 59 of file compress_.c.

60{
61 return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION);
62}
ABC_NAMESPACE_IMPL_START int ZEXPORT compress2(Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen, int level)
Definition compress_.c:24
#define Z_DEFAULT_COMPRESSION
Definition zlib.h:197
Here is the call graph for this function:
Here is the caller graph for this function:

◆ compress2()

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

Definition at line 24 of file compress_.c.

25{
26 z_stream stream;
27 int err;
28
29 stream.next_in = (Bytef*)source;
30 stream.avail_in = (uInt)sourceLen;
31#ifdef MAXSEG_64K
32 /* Check for source > 64K on 16-bit machine: */
33 if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR;
34#endif
35 stream.next_out = dest;
36 stream.avail_out = (uInt)*destLen;
37 if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR;
38
39 stream.zalloc = (alloc_func)0;
40 stream.zfree = (free_func)0;
41 stream.opaque = (voidpf)0;
42
43 err = deflateInit(&stream, level);
44 if (err != Z_OK) return err;
45
46 err = deflate(&stream, Z_FINISH);
47 if (err != Z_STREAM_END) {
48 deflateEnd(&stream);
49 return err == Z_OK ? Z_BUF_ERROR : err;
50 }
51 *destLen = stream.total_out;
52
53 err = deflateEnd(&stream);
54 return err;
55}
int ZEXPORT deflateEnd(z_streamp strm)
Definition deflate.c:866
int ZEXPORT deflate(z_streamp strm, int flush)
Definition deflate.c:555
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
voidpf opaque
Definition zlib.h:107
uLong total_out
Definition zlib.h:100
Bytef * next_out
Definition zlib.h:98
Byte FAR * voidpf
Definition zconf.h:355
unsigned int uInt
Definition zconf.h:335
unsigned long uLong
Definition zconf.h:336
Byte FAR Bytef
Definition zconf.h:342
#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
struct z_stream_s z_stream
#define deflateInit(strm, level)
Definition zlib.h:1554
Here is the call graph for this function:
Here is the caller graph for this function:

◆ compressBound()

uLong ZEXPORT compressBound ( uLong sourceLen)

Definition at line 68 of file compress_.c.

69{
70 return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
71 (sourceLen >> 25) + 13;
72}
Here is the caller graph for this function: