1 |
torben |
328 |
/* zpipe.c: example of proper use of zlib's inflate() and deflate() |
2 |
|
|
Not copyrighted -- provided to the public domain |
3 |
|
|
Version 1.2 9 November 2004 Mark Adler */ |
4 |
|
|
|
5 |
|
|
/* Version history: |
6 |
|
|
1.0 30 Oct 2004 First version |
7 |
|
|
1.1 8 Nov 2004 Add void casting for unused return values |
8 |
|
|
Use switch statement for inflate() return values |
9 |
|
|
1.2 9 Nov 2004 Add assertions to document zlib guarantees |
10 |
|
|
*/ |
11 |
|
|
|
12 |
|
|
#include "zlib.h" |
13 |
|
|
|
14 |
|
|
|
15 |
|
|
/* Compress from file source to file dest until EOF on source. |
16 |
|
|
def() returns Z_OK on success, Z_MEM_ERROR if memory could not be |
17 |
|
|
allocated for processing, Z_STREAM_ERROR if an invalid compression |
18 |
|
|
level is supplied, Z_VERSION_ERROR if the version of zlib.h and the |
19 |
|
|
version of the library linked do not match, or Z_ERRNO if there is |
20 |
|
|
an error reading or writing the files. */ |
21 |
|
|
int def(FILE *source, FILE *dest, int level); |
22 |
|
|
|
23 |
|
|
/* Decompress from file source to file dest until stream ends or EOF. |
24 |
|
|
inf() returns Z_OK on success, Z_MEM_ERROR if memory could not be |
25 |
|
|
allocated for processing, Z_DATA_ERROR if the deflate data is |
26 |
|
|
invalid or incomplete, Z_VERSION_ERROR if the version of zlib.h and |
27 |
|
|
the version of the library linked do not match, or Z_ERRNO if there |
28 |
|
|
is an error reading or writing the files. */ |
29 |
|
|
int inf(FILE *source, FILE *dest); |
30 |
|
|
|
31 |
|
|
/* report a zlib or i/o error */ |
32 |
|
|
void zerr(int ret); |