Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
compress.cc File Reference
#include "zlib.h"
Include dependency graph for compress.cc:

Go to the source code of this file.

Macros

#define ZLIB_INTERNAL
 

Functions

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

#define ZLIB_INTERNAL

Definition at line 8 of file compress.cc.

Function Documentation

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

Definition at line 57 of file compress.cc.

58 {
59  return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION);
60 }
int ZEXPORT compress2(Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen, int level)
Definition: compress.cc:22
#define Z_DEFAULT_COMPRESSION
Definition: zlib.h:189

Here is the call graph for this function:

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

Definition at line 22 of file compress.cc.

23 {
24  z_stream stream;
25  int err;
26 
27  stream.next_in = (z_const Bytef *)source;
28  stream.avail_in = (uInt)sourceLen;
29 #ifdef MAXSEG_64K
30  /* Check for source > 64K on 16-bit machine: */
31  if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR;
32 #endif
33  stream.next_out = dest;
34  stream.avail_out = (uInt)*destLen;
35  if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR;
36 
37  stream.zalloc = (alloc_func)0;
38  stream.zfree = (free_func)0;
39  stream.opaque = (voidpf)0;
40 
41  err = deflateInit(&stream, level);
42  if (err != Z_OK) return err;
43 
44  err = deflate(&stream, Z_FINISH);
45  if (err != Z_STREAM_END) {
46  deflateEnd(&stream);
47  return err == Z_OK ? Z_BUF_ERROR : err;
48  }
49  *destLen = stream.total_out;
50 
51  err = deflateEnd(&stream);
52  return err;
53 }
int ZEXPORT deflateEnd(z_streamp strm)
Definition: deflate.cc:939
uInt avail_in
Definition: zlib.h:87
voidpf opaque
Definition: zlib.h:99
free_func zfree
Definition: zlib.h:98
#define Z_FINISH
Definition: zlib.h:168
#define Z_STREAM_END
Definition: zlib.h:174
alloc_func zalloc
Definition: zlib.h:97
Bytef * next_out
Definition: zlib.h:90
uLong total_out
Definition: zlib.h:92
int ZEXPORT deflate(z_streamp strm, int flush)
Definition: deflate.cc:627
#define Z_BUF_ERROR
Definition: zlib.h:180
#define deflateInit(strm, level)
Definition: zlib.h:1647
uInt avail_out
Definition: zlib.h:91
z_const Bytef * next_in
Definition: zlib.h:86
#define Z_OK
Definition: zlib.h:173

Here is the call graph for this function:

Here is the caller graph for this function:

uLong ZEXPORT compressBound ( uLong  sourceLen)

Definition at line 66 of file compress.cc.

67 {
68  return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
69  (sourceLen >> 25) + 13;
70 }