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

Go to the source code of this file.

Macros

#define ZLIB_INTERNAL
 

Functions

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

Macro Definition Documentation

#define ZLIB_INTERNAL

Definition at line 8 of file uncompr.cc.

Function Documentation

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

Definition at line 24 of file uncompr.cc.

25 {
26  z_stream stream;
27  int err;
28 
29  stream.next_in = (z_const Bytef*)source;
30  stream.avail_in = (uInt)sourceLen;
31  /* Check for source > 64K on 16-bit machine: */
32  if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR;
33 
34  stream.next_out = dest;
35  stream.avail_out = (uInt)*destLen;
36  if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR;
37 
38  stream.zalloc = (alloc_func)0;
39  stream.zfree = (free_func)0;
40 
41  err = inflateInit(&stream);
42  if (err != Z_OK) return err;
43 
44  err = inflate(&stream, Z_FINISH);
45  if (err != Z_STREAM_END) {
46  inflateEnd(&stream);
47  if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0))
48  return Z_DATA_ERROR;
49  return err;
50  }
51  *destLen = stream.total_out;
52 
53  err = inflateEnd(&stream);
54  return err;
55 }
uInt avail_in
Definition: zlib.h:87
#define Z_NEED_DICT
Definition: zlib.h:175
free_func zfree
Definition: zlib.h:98
#define Z_FINISH
Definition: zlib.h:168
#define Z_DATA_ERROR
Definition: zlib.h:178
#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
#define Z_BUF_ERROR
Definition: zlib.h:180
#define inflateInit(strm)
Definition: zlib.h:1649
uInt avail_out
Definition: zlib.h:91
z_const Bytef * next_in
Definition: zlib.h:86
#define Z_OK
Definition: zlib.h:173
int ZEXPORT inflateEnd(z_streamp strm)
Definition: inflate.cc:1234
int ZEXPORT inflate(z_streamp strm, int flush)
Definition: inflate.cc:587

Here is the call graph for this function:

Here is the caller graph for this function: