ReactOS 0.4.15-dev-7907-g95bf896
uncompr.c File Reference
#include "zlib.h"
Include dependency graph for uncompr.c:

Go to the source code of this file.

Macros

#define ZLIB_INTERNAL
 

Functions

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

Macro Definition Documentation

◆ ZLIB_INTERNAL

#define ZLIB_INTERNAL

Definition at line 8 of file uncompr.c.

Function Documentation

◆ uncompress()

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

Definition at line 86 of file uncompr.c.

91{
92 return uncompress2(dest, destLen, source, &sourceLen);
93}
static char * dest
Definition: rtl.c:135
int ZEXPORT uncompress2(Bytef *dest, uLongf *destLen, const Bytef *source, uLong *sourceLen)
Definition: uncompr.c:27

Referenced by extract_one().

◆ uncompress2()

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

Definition at line 27 of file uncompr.c.

32{
34 int err;
35 const uInt max = (uInt)-1;
36 uLong len, left;
37 Byte buf[1]; /* for detection of incomplete stream when *destLen == 0 */
38
39 len = *sourceLen;
40 if (*destLen) {
41 left = *destLen;
42 *destLen = 0;
43 }
44 else {
45 left = 1;
46 dest = buf;
47 }
48
49 stream.next_in = (z_const Bytef *)source;
50 stream.avail_in = 0;
51 stream.zalloc = (alloc_func)0;
52 stream.zfree = (free_func)0;
53 stream.opaque = (voidpf)0;
54
56 if (err != Z_OK) return err;
57
58 stream.next_out = dest;
59 stream.avail_out = 0;
60
61 do {
62 if (stream.avail_out == 0) {
63 stream.avail_out = left > (uLong)max ? max : (uInt)left;
64 left -= stream.avail_out;
65 }
66 if (stream.avail_in == 0) {
67 stream.avail_in = len > (uLong)max ? max : (uInt)len;
68 len -= stream.avail_in;
69 }
71 } while (err == Z_OK);
72
73 *sourceLen -= len + stream.avail_in;
74 if (dest != buf)
75 *destLen = stream.total_out;
76 else if (stream.total_out && err == Z_BUF_ERROR)
77 left = 1;
78
80 return err == Z_STREAM_END ? Z_OK :
82 err == Z_BUF_ERROR && left + stream.avail_out ? Z_DATA_ERROR :
83 err;
84}
int inflate(z_streamp strm, int flush)
Definition: inflate.c:1257
int inflateEnd(z_streamp strm)
Definition: inflate.c:1910
void(* free_func)(voidpf opaque, voidpf address)
Definition: zlib.h:54
unsigned long uLong
Definition: zlib.h:39
#define Z_NEED_DICT
Definition: zlib.h:116
#define Z_BUF_ERROR
Definition: zlib.h:121
voidpf(* alloc_func)(voidpf opaque, uInt items, uInt size)
Definition: zlib.h:53
void FAR * voidpf
Definition: zlib.h:42
#define Z_STREAM_END
Definition: zlib.h:115
unsigned int uInt
Definition: zlib.h:38
#define Z_OK
Definition: zlib.h:114
#define z_const
Definition: zlib.h:35
#define Z_DATA_ERROR
Definition: zlib.h:119
#define Z_NO_FLUSH
Definition: zlib.h:105
unsigned char Byte
Definition: zlib.h:37
Byte FAR Bytef
Definition: zlib.h:41
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLint left
Definition: glext.h:7726
GLenum GLsizei len
Definition: glext.h:6722
#define err(...)
#define inflateInit(strm)
Definition: zlib.h:1812
Definition: parse.h:23
#define max(a, b)
Definition: svc.c:63

Referenced by uncompress().