COSMOS core  1.0.2 (beta)
Comprehensive Open-architecture Solution for Mission Operations Systems
uncompr.c File Reference
Include dependency graph for uncompr.c:

Macros

#define ZLIB_INTERNAL
 

Functions

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

Macro Definition Documentation

#define ZLIB_INTERNAL

Function Documentation

int ZEXPORT uncompress ( Bytef dest,
uLongf destLen,
const Bytef source,
uLong  sourceLen 
)
29 {
30  z_stream stream;
31  int err;
32 
33  stream.next_in = (z_const Bytef *)source;
34  stream.avail_in = (uInt)sourceLen;
35  /* Check for source > 64K on 16-bit machine: */
36  if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR;
37 
38  stream.next_out = dest;
39  stream.avail_out = (uInt)*destLen;
40  if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR;
41 
42  stream.zalloc = (alloc_func)0;
43  stream.zfree = (free_func)0;
44 
45  err = inflateInit(&stream);
46  if (err != Z_OK) return err;
47 
48  err = inflate(&stream, Z_FINISH);
49  if (err != Z_STREAM_END) {
50  inflateEnd(&stream);
51  if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0))
52  return Z_DATA_ERROR;
53  return err;
54  }
55  *destLen = stream.total_out;
56 
57  err = inflateEnd(&stream);
58  return err;
59 }
voidpf(* alloc_func)()
Definition: zlib.h:80
Bytef * next_in
Definition: zlib.h:86
uInt avail_in
Definition: zlib.h:87
#define Z_NEED_DICT
Definition: zlib.h:175
unsigned long uLong
Definition: zconf.h:371
#define z_const
Definition: zconf.h:224
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
string & err
Definition: json11.cpp:362
uLong total_out
Definition: zlib.h:92
Byte Bytef
Definition: zconf.h:377
static string source
Definition: ax25_recv.cpp:42
#define Z_BUF_ERROR
Definition: zlib.h:180
#define inflateInit(strm)
Definition: zlib.h:1649
uInt avail_out
Definition: zlib.h:91
#define Z_OK
Definition: zlib.h:173
int ZEXPORT inflate(z_streamp strm, int flush)
Definition: inflate.c:605
int ZEXPORT inflateEnd(z_streamp strm)
Definition: inflate.c:1254
void(* free_func)()
Definition: zlib.h:81
Definition: zlib.h:85
unsigned int uInt
Definition: zconf.h:370