1 /*
2  * inflate.h -  inflate decompression routine
3  *
4  * Version 1.1.2
5  */
6 
7 /*
8  * Copyright (C) 1995, Edward B. Hamrick
9  *
10  * Permission to use, copy, modify, and distribute this software and
11  * its documentation for any purpose and without fee is hereby granted,
12  * provided that the above copyright notice appear in all copies and
13  * that both that copyright notice and this permission notice appear in
14  * supporting documentation, and that the name of the copyright holders
15  * not be used in advertising or publicity pertaining to distribution of
16  * the software without specific, written prior permission. The copyright
17  * holders makes no representations about the suitability of this software
18  * for any purpose. It is provided "as is" without express or implied warranty.
19  *
20  * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
21  * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
22  * IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT
23  * OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
24  * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
25  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
26  * OF THIS SOFTWARE.
27  */
28 
29 /*
30  * Changes from 1.1 to 1.1.2:
31  * Relicensed under the MIT license, with consent of the copyright holders.
32  * Claudio Matsuoka (Jan 11 2011)
33  */
34 
35 /*
36  * 1) All file i/o is done externally to these routines
37  * 2) Routines are symmetrical so inflate can feed into deflate
38  * 3) Routines can be easily integrated into wide range of applications
39  * 4) Routines are very portable, and use only ANSI C
40  * 5) No #defines in inflate.h to conflict with external #defines
41  * 6) No external routines need be called by these routines
42  * 7) Buffers are owned by the calling routine
43  * 8) No static non-constant variables are allowed
44  */
45 
46 /*
47  * Note that for each call to InflatePutBuffer, there will be
48  * 0 or more calls to (*putbuffer_ptr).  All except the last
49  * call to (*putbuffer_ptr) will be with 32768 bytes, although
50  * this behaviour may change in the future.  Before InflatePutBuffer
51  * returns, it will have output as much uncompressed data as
52  * is possible.
53  */
54 
55 #ifndef __INFLATE_H
56 #define __INFLATE_H
57 
58 #ifdef __cplusplus
59 extern "C" {
60 #endif
61 
62 /* Routine to initialize inflate decompression */
63 void *InflateInitialize(                      /* returns InflateState       */
64   void *AppState,                             /* for passing to putbuffer   */
65   int (*putbuffer_ptr)(                       /* returns 0 on success       */
66     void *AppState,                           /* opaque ptr from Initialize */
67     unsigned char *buffer,                    /* buffer to put              */
68     long length                               /* length of buffer           */
69   ),
70   void *(*malloc_ptr)(long length),           /* utility routine            */
71   void (*free_ptr)(void *buffer)              /* utility routine            */
72 );
73 
74 /* Call-in routine to put a buffer into inflate decompression */
75 int InflatePutBuffer(                         /* returns 0 on success       */
76   void *InflateState,                         /* opaque ptr from Initialize */
77   unsigned char *buffer,                      /* buffer to put              */
78   long length                                 /* length of buffer           */
79 );
80 
81 /* Routine to terminate inflate decompression */
82 int InflateTerminate(                         /* returns 0 on success       */
83   void *InflateState                          /* opaque ptr from Initialize */
84 );
85 
86 #ifdef __cplusplus
87 }
88 #endif
89 
90 #endif
91