misc/libfreetype/src/gzip/zlib.h
author koda
Tue, 04 Jun 2013 21:59:01 +0200
branch0.9.19
changeset 9123 19c57656460f
parent 5172 88f2e05288ba
permissions -rw-r--r--
trying to appease almighty unC0Rr
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5172
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     1
/* zlib.h -- interface of the 'zlib' general purpose compression library
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     2
  version 1.1.4, March 11th, 2002
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     3
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     4
  Copyright (C) 1995-2002 Jean-loup Gailly and Mark Adler
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     5
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     6
  This software is provided 'as-is', without any express or implied
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     7
  warranty.  In no event will the authors be held liable for any damages
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     8
  arising from the use of this software.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     9
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    10
  Permission is granted to anyone to use this software for any purpose,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    11
  including commercial applications, and to alter it and redistribute it
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    12
  freely, subject to the following restrictions:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    13
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    14
  1. The origin of this software must not be misrepresented; you must not
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    15
     claim that you wrote the original software. If you use this software
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    16
     in a product, an acknowledgment in the product documentation would be
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    17
     appreciated but is not required.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    18
  2. Altered source versions must be plainly marked as such, and must not be
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    19
     misrepresented as being the original software.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    20
  3. This notice may not be removed or altered from any source distribution.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    21
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    22
  Jean-loup Gailly        Mark Adler
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    23
  jloup@gzip.org          madler@alumni.caltech.edu
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    24
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    25
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    26
  The data format used by the zlib library is described by RFCs (Request for
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    27
  Comments) 1950 to 1952 in the files ftp://ds.internic.net/rfc/rfc1950.txt
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    28
  (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    29
*/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    30
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    31
#ifndef _ZLIB_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    32
#define _ZLIB_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    33
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    34
#include "zconf.h"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    35
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    36
#ifdef __cplusplus
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    37
extern "C" {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    38
#endif
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    39
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    40
#define ZLIB_VERSION "1.1.4"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    41
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    42
/*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    43
     The 'zlib' compression library provides in-memory compression and
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    44
  decompression functions, including integrity checks of the uncompressed
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    45
  data.  This version of the library supports only one compression method
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    46
  (deflation) but other algorithms will be added later and will have the same
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    47
  stream interface.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    48
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    49
     Compression can be done in a single step if the buffers are large
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    50
  enough (for example if an input file is mmap'ed), or can be done by
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    51
  repeated calls of the compression function.  In the latter case, the
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    52
  application must provide more input and/or consume the output
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    53
  (providing more output space) before each call.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    54
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    55
     The library also supports reading and writing files in gzip (.gz) format
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    56
  with an interface similar to that of stdio.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    57
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    58
     The library does not install any signal handler. The decoder checks
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    59
  the consistency of the compressed data, so the library should never
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    60
  crash even in case of corrupted input.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    61
*/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    62
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    63
typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size));
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    64
typedef void   (*free_func)  OF((voidpf opaque, voidpf address));
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    65
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    66
struct internal_state;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    67
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    68
typedef struct z_stream_s {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    69
    Bytef    *next_in;  /* next input byte */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    70
    uInt     avail_in;  /* number of bytes available at next_in */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    71
    uLong    total_in;  /* total nb of input bytes read so far */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    72
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    73
    Bytef    *next_out; /* next output byte should be put there */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    74
    uInt     avail_out; /* remaining free space at next_out */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    75
    uLong    total_out; /* total nb of bytes output so far */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    76
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    77
    char     *msg;      /* last error message, NULL if no error */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    78
    struct internal_state FAR *state; /* not visible by applications */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    79
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    80
    alloc_func zalloc;  /* used to allocate the internal state */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    81
    free_func  zfree;   /* used to free the internal state */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    82
    voidpf     opaque;  /* private data object passed to zalloc and zfree */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    83
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    84
    int     data_type;  /* best guess about the data type: ascii or binary */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    85
    uLong   adler;      /* adler32 value of the uncompressed data */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    86
    uLong   reserved;   /* reserved for future use */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    87
} z_stream;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    88
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    89
typedef z_stream FAR *z_streamp;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    90
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    91
/*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    92
   The application must update next_in and avail_in when avail_in has
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    93
   dropped to zero. It must update next_out and avail_out when avail_out
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    94
   has dropped to zero. The application must initialize zalloc, zfree and
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    95
   opaque before calling the init function. All other fields are set by the
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    96
   compression library and must not be updated by the application.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    97
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    98
   The opaque value provided by the application will be passed as the first
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    99
   parameter for calls of zalloc and zfree. This can be useful for custom
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   100
   memory management. The compression library attaches no meaning to the
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   101
   opaque value.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   102
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   103
   zalloc must return Z_NULL if there is not enough memory for the object.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   104
   If zlib is used in a multi-threaded application, zalloc and zfree must be
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   105
   thread safe.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   106
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   107
   On 16-bit systems, the functions zalloc and zfree must be able to allocate
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   108
   exactly 65536 bytes, but will not be required to allocate more than this
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   109
   if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   110
   pointers returned by zalloc for objects of exactly 65536 bytes *must*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   111
   have their offset normalized to zero. The default allocation function
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   112
   provided by this library ensures this (see zutil.c). To reduce memory
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   113
   requirements and avoid any allocation of 64K objects, at the expense of
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   114
   compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h).
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   115
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   116
   The fields total_in and total_out can be used for statistics or
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   117
   progress reports. After compression, total_in holds the total size of
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   118
   the uncompressed data and may be saved for use in the decompressor
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   119
   (particularly if the decompressor wants to decompress everything in
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   120
   a single step).
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   121
*/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   122
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   123
                        /* constants */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   124
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   125
#define Z_NO_FLUSH      0
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   126
#define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   127
#define Z_SYNC_FLUSH    2
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   128
#define Z_FULL_FLUSH    3
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   129
#define Z_FINISH        4
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   130
/* Allowed flush values; see deflate() below for details */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   131
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   132
#define Z_OK            0
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   133
#define Z_STREAM_END    1
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   134
#define Z_NEED_DICT     2
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   135
#define Z_ERRNO        (-1)
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   136
#define Z_STREAM_ERROR (-2)
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   137
#define Z_DATA_ERROR   (-3)
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   138
#define Z_MEM_ERROR    (-4)
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   139
#define Z_BUF_ERROR    (-5)
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   140
#define Z_VERSION_ERROR (-6)
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   141
/* Return codes for the compression/decompression functions. Negative
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   142
 * values are errors, positive values are used for special but normal events.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   143
 */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   144
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   145
#define Z_NO_COMPRESSION         0
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   146
#define Z_BEST_SPEED             1
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   147
#define Z_BEST_COMPRESSION       9
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   148
#define Z_DEFAULT_COMPRESSION  (-1)
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   149
/* compression levels */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   150
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   151
#define Z_FILTERED            1
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   152
#define Z_HUFFMAN_ONLY        2
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   153
#define Z_DEFAULT_STRATEGY    0
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   154
/* compression strategy; see deflateInit2() below for details */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   155
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   156
#define Z_BINARY   0
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   157
#define Z_ASCII    1
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   158
#define Z_UNKNOWN  2
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   159
/* Possible values of the data_type field */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   160
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   161
#define Z_DEFLATED   8
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   162
/* The deflate compression method (the only one supported in this version) */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   163
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   164
#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   165
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   166
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   167
                        /* basic functions */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   168
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   169
/* The application can compare zlibVersion and ZLIB_VERSION for consistency.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   170
   If the first character differs, the library code actually used is
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   171
   not compatible with the zlib.h header file used by the application.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   172
   This check is automatically made by deflateInit and inflateInit.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   173
 */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   174
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   175
/*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   176
ZEXTERN(int)  deflateInit OF((z_streamp strm, int level));
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   177
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   178
     Initializes the internal stream state for compression. The fields
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   179
   zalloc, zfree and opaque must be initialized before by the caller.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   180
   If zalloc and zfree are set to Z_NULL, deflateInit updates them to
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   181
   use default allocation functions.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   182
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   183
     The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   184
   1 gives best speed, 9 gives best compression, 0 gives no compression at
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   185
   all (the input data is simply copied a block at a time).
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   186
   Z_DEFAULT_COMPRESSION requests a default compromise between speed and
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   187
   compression (currently equivalent to level 6).
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   188
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   189
     deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   190
   enough memory, Z_STREAM_ERROR if level is not a valid compression level,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   191
   Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   192
   with the version assumed by the caller (ZLIB_VERSION).
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   193
   msg is set to null if there is no error message.  deflateInit does not
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   194
   perform any compression: this will be done by deflate().
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   195
*/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   196
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   197
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   198
/*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   199
    deflate compresses as much data as possible, and stops when the input
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   200
  buffer becomes empty or the output buffer becomes full. It may introduce some
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   201
  output latency (reading input without producing any output) except when
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   202
  forced to flush.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   203
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   204
    The detailed semantics are as follows. deflate performs one or both of the
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   205
  following actions:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   206
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   207
  - Compress more input starting at next_in and update next_in and avail_in
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   208
    accordingly. If not all input can be processed (because there is not
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   209
    enough room in the output buffer), next_in and avail_in are updated and
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   210
    processing will resume at this point for the next call of deflate().
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   211
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   212
  - Provide more output starting at next_out and update next_out and avail_out
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   213
    accordingly. This action is forced if the parameter flush is non zero.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   214
    Forcing flush frequently degrades the compression ratio, so this parameter
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   215
    should be set only when necessary (in interactive applications).
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   216
    Some output may be provided even if flush is not set.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   217
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   218
  Before the call of deflate(), the application should ensure that at least
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   219
  one of the actions is possible, by providing more input and/or consuming
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   220
  more output, and updating avail_in or avail_out accordingly; avail_out
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   221
  should never be zero before the call. The application can consume the
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   222
  compressed output when it wants, for example when the output buffer is full
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   223
  (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   224
  and with zero avail_out, it must be called again after making room in the
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   225
  output buffer because there might be more output pending.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   226
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   227
    If the parameter flush is set to Z_SYNC_FLUSH, all pending output is
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   228
  flushed to the output buffer and the output is aligned on a byte boundary, so
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   229
  that the decompressor can get all input data available so far. (In particular
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   230
  avail_in is zero after the call if enough output space has been provided
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   231
  before the call.)  Flushing may degrade compression for some compression
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   232
  algorithms and so it should be used only when necessary.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   233
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   234
    If flush is set to Z_FULL_FLUSH, all output is flushed as with
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   235
  Z_SYNC_FLUSH, and the compression state is reset so that decompression can
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   236
  restart from this point if previous compressed data has been damaged or if
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   237
  random access is desired. Using Z_FULL_FLUSH too often can seriously degrade
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   238
  the compression.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   239
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   240
    If deflate returns with avail_out == 0, this function must be called again
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   241
  with the same value of the flush parameter and more output space (updated
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   242
  avail_out), until the flush is complete (deflate returns with non-zero
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   243
  avail_out).
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   244
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   245
    If the parameter flush is set to Z_FINISH, pending input is processed,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   246
  pending output is flushed and deflate returns with Z_STREAM_END if there
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   247
  was enough output space; if deflate returns with Z_OK, this function must be
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   248
  called again with Z_FINISH and more output space (updated avail_out) but no
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   249
  more input data, until it returns with Z_STREAM_END or an error. After
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   250
  deflate has returned Z_STREAM_END, the only possible operations on the
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   251
  stream are deflateReset or deflateEnd.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   252
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   253
    Z_FINISH can be used immediately after deflateInit if all the compression
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   254
  is to be done in a single step. In this case, avail_out must be at least
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   255
  0.1% larger than avail_in plus 12 bytes.  If deflate does not return
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   256
  Z_STREAM_END, then it must be called again as described above.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   257
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   258
    deflate() sets strm->adler to the adler32 checksum of all input read
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   259
  so far (that is, total_in bytes).
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   260
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   261
    deflate() may update data_type if it can make a good guess about
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   262
  the input data type (Z_ASCII or Z_BINARY). In doubt, the data is considered
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   263
  binary. This field is only for information purposes and does not affect
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   264
  the compression algorithm in any manner.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   265
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   266
    deflate() returns Z_OK if some progress has been made (more input
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   267
  processed or more output produced), Z_STREAM_END if all input has been
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   268
  consumed and all output has been produced (only when flush is set to
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   269
  Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   270
  if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   271
  (for example avail_in or avail_out was zero).
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   272
*/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   273
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   274
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   275
/*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   276
     All dynamically allocated data structures for this stream are freed.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   277
   This function discards any unprocessed input and does not flush any
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   278
   pending output.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   279
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   280
     deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   281
   stream state was inconsistent, Z_DATA_ERROR if the stream was freed
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   282
   prematurely (some input or output was discarded). In the error case,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   283
   msg may be set but then points to a static string (which must not be
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   284
   deallocated).
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   285
*/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   286
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   287
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   288
/*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   289
ZEXTERN(int)  inflateInit OF((z_streamp strm));
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   290
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   291
     Initializes the internal stream state for decompression. The fields
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   292
   next_in, avail_in, zalloc, zfree and opaque must be initialized before by
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   293
   the caller. If next_in is not Z_NULL and avail_in is large enough (the exact
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   294
   value depends on the compression method), inflateInit determines the
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   295
   compression method from the zlib header and allocates all data structures
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   296
   accordingly; otherwise the allocation will be deferred to the first call of
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   297
   inflate.  If zalloc and zfree are set to Z_NULL, inflateInit updates them to
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   298
   use default allocation functions.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   299
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   300
     inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   301
   memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   302
   version assumed by the caller.  msg is set to null if there is no error
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   303
   message. inflateInit does not perform any decompression apart from reading
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   304
   the zlib header if present: this will be done by inflate().  (So next_in and
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   305
   avail_in may be modified, but next_out and avail_out are unchanged.)
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   306
*/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   307
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   308
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   309
ZEXTERN(int) inflate OF((z_streamp strm, int flush));
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   310
/*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   311
    inflate decompresses as much data as possible, and stops when the input
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   312
  buffer becomes empty or the output buffer becomes full. It may some
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   313
  introduce some output latency (reading input without producing any output)
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   314
  except when forced to flush.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   315
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   316
  The detailed semantics are as follows. inflate performs one or both of the
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   317
  following actions:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   318
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   319
  - Decompress more input starting at next_in and update next_in and avail_in
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   320
    accordingly. If not all input can be processed (because there is not
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   321
    enough room in the output buffer), next_in is updated and processing
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   322
    will resume at this point for the next call of inflate().
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   323
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   324
  - Provide more output starting at next_out and update next_out and avail_out
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   325
    accordingly.  inflate() provides as much output as possible, until there
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   326
    is no more input data or no more space in the output buffer (see below
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   327
    about the flush parameter).
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   328
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   329
  Before the call of inflate(), the application should ensure that at least
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   330
  one of the actions is possible, by providing more input and/or consuming
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   331
  more output, and updating the next_* and avail_* values accordingly.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   332
  The application can consume the uncompressed output when it wants, for
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   333
  example when the output buffer is full (avail_out == 0), or after each
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   334
  call of inflate(). If inflate returns Z_OK and with zero avail_out, it
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   335
  must be called again after making room in the output buffer because there
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   336
  might be more output pending.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   337
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   338
    If the parameter flush is set to Z_SYNC_FLUSH, inflate flushes as much
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   339
  output as possible to the output buffer. The flushing behavior of inflate is
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   340
  not specified for values of the flush parameter other than Z_SYNC_FLUSH
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   341
  and Z_FINISH, but the current implementation actually flushes as much output
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   342
  as possible anyway.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   343
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   344
    inflate() should normally be called until it returns Z_STREAM_END or an
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   345
  error. However if all decompression is to be performed in a single step
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   346
  (a single call of inflate), the parameter flush should be set to
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   347
  Z_FINISH. In this case all pending input is processed and all pending
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   348
  output is flushed; avail_out must be large enough to hold all the
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   349
  uncompressed data. (The size of the uncompressed data may have been saved
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   350
  by the compressor for this purpose.) The next operation on this stream must
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   351
  be inflateEnd to deallocate the decompression state. The use of Z_FINISH
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   352
  is never required, but can be used to inform inflate that a faster routine
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   353
  may be used for the single inflate() call.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   354
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   355
     If a preset dictionary is needed at this point (see inflateSetDictionary
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   356
  below), inflate sets strm-adler to the adler32 checksum of the
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   357
  dictionary chosen by the compressor and returns Z_NEED_DICT; otherwise
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   358
  it sets strm->adler to the adler32 checksum of all output produced
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   359
  so far (that is, total_out bytes) and returns Z_OK, Z_STREAM_END or
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   360
  an error code as described below. At the end of the stream, inflate()
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   361
  checks that its computed adler32 checksum is equal to that saved by the
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   362
  compressor and returns Z_STREAM_END only if the checksum is correct.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   363
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   364
    inflate() returns Z_OK if some progress has been made (more input processed
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   365
  or more output produced), Z_STREAM_END if the end of the compressed data has
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   366
  been reached and all uncompressed output has been produced, Z_NEED_DICT if a
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   367
  preset dictionary is needed at this point, Z_DATA_ERROR if the input data was
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   368
  corrupted (input stream not conforming to the zlib format or incorrect
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   369
  adler32 checksum), Z_STREAM_ERROR if the stream structure was inconsistent
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   370
  (for example if next_in or next_out was NULL), Z_MEM_ERROR if there was not
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   371
  enough memory, Z_BUF_ERROR if no progress is possible or if there was not
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   372
  enough room in the output buffer when Z_FINISH is used. In the Z_DATA_ERROR
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   373
  case, the application may then call inflateSync to look for a good
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   374
  compression block.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   375
*/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   376
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   377
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   378
ZEXTERN(int)  inflateEnd OF((z_streamp strm));
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   379
/*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   380
     All dynamically allocated data structures for this stream are freed.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   381
   This function discards any unprocessed input and does not flush any
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   382
   pending output.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   383
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   384
     inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   385
   was inconsistent. In the error case, msg may be set but then points to a
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   386
   static string (which must not be deallocated).
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   387
*/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   388
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   389
                        /* Advanced functions */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   390
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   391
/*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   392
    The following functions are needed only in some special applications.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   393
*/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   394
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   395
/*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   396
ZEXTERN(int)  deflateInit2 OF((z_streamp strm,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   397
                                     int  level,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   398
                                     int  method,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   399
                                     int  windowBits,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   400
                                     int  memLevel,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   401
                                     int  strategy));
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   402
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   403
     This is another version of deflateInit with more compression options. The
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   404
   fields next_in, zalloc, zfree and opaque must be initialized before by
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   405
   the caller.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   406
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   407
     The method parameter is the compression method. It must be Z_DEFLATED in
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   408
   this version of the library.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   409
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   410
     The windowBits parameter is the base two logarithm of the window size
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   411
   (the size of the history buffer).  It should be in the range 8..15 for this
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   412
   version of the library. Larger values of this parameter result in better
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   413
   compression at the expense of memory usage. The default value is 15 if
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   414
   deflateInit is used instead.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   415
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   416
     The memLevel parameter specifies how much memory should be allocated
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   417
   for the internal compression state. memLevel=1 uses minimum memory but
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   418
   is slow and reduces compression ratio; memLevel=9 uses maximum memory
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   419
   for optimal speed. The default value is 8. See zconf.h for total memory
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   420
   usage as a function of windowBits and memLevel.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   421
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   422
     The strategy parameter is used to tune the compression algorithm. Use the
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   423
   value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   424
   filter (or predictor), or Z_HUFFMAN_ONLY to force Huffman encoding only (no
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   425
   string match).  Filtered data consists mostly of small values with a
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   426
   somewhat random distribution. In this case, the compression algorithm is
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   427
   tuned to compress them better. The effect of Z_FILTERED is to force more
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   428
   Huffman coding and less string matching; it is somewhat intermediate
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   429
   between Z_DEFAULT and Z_HUFFMAN_ONLY. The strategy parameter only affects
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   430
   the compression ratio but not the correctness of the compressed output even
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   431
   if it is not set appropriately.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   432
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   433
      deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   434
   memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   435
   method). msg is set to null if there is no error message.  deflateInit2 does
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   436
   not perform any compression: this will be done by deflate().
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   437
*/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   438
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   439
/*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   440
     Initializes the compression dictionary from the given byte sequence
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   441
   without producing any compressed output. This function must be called
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   442
   immediately after deflateInit, deflateInit2 or deflateReset, before any
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   443
   call of deflate. The compressor and decompressor must use exactly the same
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   444
   dictionary (see inflateSetDictionary).
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   445
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   446
     The dictionary should consist of strings (byte sequences) that are likely
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   447
   to be encountered later in the data to be compressed, with the most commonly
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   448
   used strings preferably put towards the end of the dictionary. Using a
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   449
   dictionary is most useful when the data to be compressed is short and can be
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   450
   predicted with good accuracy; the data can then be compressed better than
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   451
   with the default empty dictionary.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   452
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   453
     Depending on the size of the compression data structures selected by
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   454
   deflateInit or deflateInit2, a part of the dictionary may in effect be
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   455
   discarded, for example if the dictionary is larger than the window size in
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   456
   deflate or deflate2. Thus the strings most likely to be useful should be
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   457
   put at the end of the dictionary, not at the front.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   458
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   459
     Upon return of this function, strm->adler is set to the Adler32 value
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   460
   of the dictionary; the decompressor may later use this value to determine
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   461
   which dictionary has been used by the compressor. (The Adler32 value
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   462
   applies to the whole dictionary even if only a subset of the dictionary is
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   463
   actually used by the compressor.)
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   464
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   465
     deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   466
   parameter is invalid (such as NULL dictionary) or the stream state is
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   467
   inconsistent (for example if deflate has already been called for this stream
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   468
   or if the compression method is bsort). deflateSetDictionary does not
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   469
   perform any compression: this will be done by deflate().
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   470
*/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   471
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   472
/*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   473
     Sets the destination stream as a complete copy of the source stream.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   474
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   475
     This function can be useful when several compression strategies will be
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   476
   tried, for example when there are several ways of pre-processing the input
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   477
   data with a filter. The streams that will be discarded should then be freed
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   478
   by calling deflateEnd.  Note that deflateCopy duplicates the internal
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   479
   compression state which can be quite large, so this strategy is slow and
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   480
   can consume lots of memory.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   481
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   482
     deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   483
   enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   484
   (such as zalloc being NULL). msg is left unchanged in both source and
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   485
   destination.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   486
*/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   487
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   488
/*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   489
     This function is equivalent to deflateEnd followed by deflateInit,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   490
   but does not free and reallocate all the internal compression state.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   491
   The stream will keep the same compression level and any other attributes
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   492
   that may have been set by deflateInit2.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   493
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   494
      deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   495
   stream state was inconsistent (such as zalloc or state being NULL).
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   496
*/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   497
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   498
/*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   499
     Dynamically update the compression level and compression strategy.  The
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   500
   interpretation of level and strategy is as in deflateInit2.  This can be
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   501
   used to switch between compression and straight copy of the input data, or
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   502
   to switch to a different kind of input data requiring a different
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   503
   strategy. If the compression level is changed, the input available so far
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   504
   is compressed with the old level (and may be flushed); the new level will
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   505
   take effect only at the next call of deflate().
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   506
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   507
     Before the call of deflateParams, the stream state must be set as for
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   508
   a call of deflate(), since the currently available input may have to
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   509
   be compressed and flushed. In particular, strm->avail_out must be non-zero.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   510
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   511
     deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   512
   stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   513
   if strm->avail_out was zero.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   514
*/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   515
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   516
/*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   517
ZEXTERN(int)  inflateInit2 OF((z_streamp strm,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   518
                                     int  windowBits));
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   519
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   520
     This is another version of inflateInit with an extra parameter. The
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   521
   fields next_in, avail_in, zalloc, zfree and opaque must be initialized
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   522
   before by the caller.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   523
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   524
     The windowBits parameter is the base two logarithm of the maximum window
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   525
   size (the size of the history buffer).  It should be in the range 8..15 for
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   526
   this version of the library. The default value is 15 if inflateInit is used
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   527
   instead. If a compressed stream with a larger window size is given as
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   528
   input, inflate() will return with the error code Z_DATA_ERROR instead of
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   529
   trying to allocate a larger window.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   530
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   531
      inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   532
   memory, Z_STREAM_ERROR if a parameter is invalid (such as a negative
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   533
   memLevel). msg is set to null if there is no error message.  inflateInit2
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   534
   does not perform any decompression apart from reading the zlib header if
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   535
   present: this will be done by inflate(). (So next_in and avail_in may be
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   536
   modified, but next_out and avail_out are unchanged.)
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   537
*/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   538
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   539
/*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   540
     Initializes the decompression dictionary from the given uncompressed byte
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   541
   sequence. This function must be called immediately after a call of inflate
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   542
   if this call returned Z_NEED_DICT. The dictionary chosen by the compressor
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   543
   can be determined from the Adler32 value returned by this call of
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   544
   inflate. The compressor and decompressor must use exactly the same
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   545
   dictionary (see deflateSetDictionary).
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   546
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   547
     inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   548
   parameter is invalid (such as NULL dictionary) or the stream state is
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   549
   inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   550
   expected one (incorrect Adler32 value). inflateSetDictionary does not
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   551
   perform any decompression: this will be done by subsequent calls of
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   552
   inflate().
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   553
*/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   554
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   555
/*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   556
    Skips invalid compressed data until a full flush point (see above the
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   557
  description of deflate with Z_FULL_FLUSH) can be found, or until all
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   558
  available input is skipped. No output is provided.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   559
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   560
    inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   561
  if no more input was provided, Z_DATA_ERROR if no flush point has been found,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   562
  or Z_STREAM_ERROR if the stream structure was inconsistent. In the success
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   563
  case, the application may save the current current value of total_in which
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   564
  indicates where valid compressed data was found. In the error case, the
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   565
  application may repeatedly call inflateSync, providing more input each time,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   566
  until success or end of the input data.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   567
*/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   568
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   569
ZEXTERN(int)  inflateReset OF((z_streamp strm));
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   570
/*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   571
     This function is equivalent to inflateEnd followed by inflateInit,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   572
   but does not free and reallocate all the internal decompression state.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   573
   The stream will keep attributes that may have been set by inflateInit2.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   574
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   575
      inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   576
   stream state was inconsistent (such as zalloc or state being NULL).
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   577
*/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   578
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   579
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   580
                        /* utility functions */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   581
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   582
/*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   583
     The following utility functions are implemented on top of the
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   584
   basic stream-oriented functions. To simplify the interface, some
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   585
   default options are assumed (compression level and memory usage,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   586
   standard memory allocation functions). The source code of these
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   587
   utility functions can easily be modified if you need special options.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   588
*/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   589
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   590
/*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   591
     Compresses the source buffer into the destination buffer.  sourceLen is
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   592
   the byte length of the source buffer. Upon entry, destLen is the total
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   593
   size of the destination buffer, which must be at least 0.1% larger than
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   594
   sourceLen plus 12 bytes. Upon exit, destLen is the actual size of the
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   595
   compressed buffer.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   596
     This function can be used to compress a whole file at once if the
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   597
   input file is mmap'ed.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   598
     compress returns Z_OK if success, Z_MEM_ERROR if there was not
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   599
   enough memory, Z_BUF_ERROR if there was not enough room in the output
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   600
   buffer.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   601
*/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   602
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   603
/*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   604
     Compresses the source buffer into the destination buffer. The level
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   605
   parameter has the same meaning as in deflateInit.  sourceLen is the byte
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   606
   length of the source buffer. Upon entry, destLen is the total size of the
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   607
   destination buffer, which must be at least 0.1% larger than sourceLen plus
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   608
   12 bytes. Upon exit, destLen is the actual size of the compressed buffer.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   609
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   610
     compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   611
   memory, Z_BUF_ERROR if there was not enough room in the output buffer,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   612
   Z_STREAM_ERROR if the level parameter is invalid.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   613
*/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   614
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   615
/*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   616
     Decompresses the source buffer into the destination buffer.  sourceLen is
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   617
   the byte length of the source buffer. Upon entry, destLen is the total
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   618
   size of the destination buffer, which must be large enough to hold the
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   619
   entire uncompressed data. (The size of the uncompressed data must have
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   620
   been saved previously by the compressor and transmitted to the decompressor
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   621
   by some mechanism outside the scope of this compression library.)
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   622
   Upon exit, destLen is the actual size of the compressed buffer.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   623
     This function can be used to decompress a whole file at once if the
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   624
   input file is mmap'ed.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   625
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   626
     uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   627
   enough memory, Z_BUF_ERROR if there was not enough room in the output
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   628
   buffer, or Z_DATA_ERROR if the input data was corrupted.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   629
*/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   630
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   631
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   632
/*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   633
     Opens a gzip (.gz) file for reading or writing. The mode parameter
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   634
   is as in fopen ("rb" or "wb") but can also include a compression level
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   635
   ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   636
   Huffman only compression as in "wb1h". (See the description
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   637
   of deflateInit2 for more information about the strategy parameter.)
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   638
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   639
     gzopen can be used to read a file which is not in gzip format; in this
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   640
   case gzread will directly read from the file without decompression.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   641
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   642
     gzopen returns NULL if the file could not be opened or if there was
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   643
   insufficient memory to allocate the (de)compression state; errno
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   644
   can be checked to distinguish the two cases (if errno is zero, the
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   645
   zlib error is Z_MEM_ERROR).  */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   646
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   647
/*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   648
     gzdopen() associates a gzFile with the file descriptor fd.  File
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   649
   descriptors are obtained from calls like open, dup, creat, pipe or
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   650
   fileno (in the file has been previously opened with fopen).
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   651
   The mode parameter is as in gzopen.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   652
     The next call of gzclose on the returned gzFile will also close the
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   653
   file descriptor fd, just like fclose(fdopen(fd), mode) closes the file
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   654
   descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode).
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   655
     gzdopen returns NULL if there was insufficient memory to allocate
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   656
   the (de)compression state.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   657
*/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   658
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   659
/*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   660
     Dynamically update the compression level or strategy. See the description
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   661
   of deflateInit2 for the meaning of these parameters.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   662
     gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   663
   opened for writing.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   664
*/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   665
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   666
/*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   667
     Reads the given number of uncompressed bytes from the compressed file.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   668
   If the input file was not in gzip format, gzread copies the given number
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   669
   of bytes into the buffer.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   670
     gzread returns the number of uncompressed bytes actually read (0 for
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   671
   end of file, -1 for error). */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   672
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   673
/*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   674
     Writes the given number of uncompressed bytes into the compressed file.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   675
   gzwrite returns the number of uncompressed bytes actually written
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   676
   (0 in case of error).
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   677
*/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   678
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   679
/*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   680
     Converts, formats, and writes the args to the compressed file under
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   681
   control of the format string, as in fprintf. gzprintf returns the number of
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   682
   uncompressed bytes actually written (0 in case of error).
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   683
*/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   684
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   685
/*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   686
      Writes the given null-terminated string to the compressed file, excluding
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   687
   the terminating null character.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   688
      gzputs returns the number of characters written, or -1 in case of error.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   689
*/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   690
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   691
/*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   692
      Reads bytes from the compressed file until len-1 characters are read, or
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   693
   a newline character is read and transferred to buf, or an end-of-file
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   694
   condition is encountered.  The string is then terminated with a null
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   695
   character.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   696
      gzgets returns buf, or Z_NULL in case of error.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   697
*/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   698
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   699
/*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   700
      Writes c, converted to an unsigned char, into the compressed file.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   701
   gzputc returns the value that was written, or -1 in case of error.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   702
*/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   703
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   704
/*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   705
      Reads one byte from the compressed file. gzgetc returns this byte
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   706
   or -1 in case of end of file or error.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   707
*/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   708
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   709
/*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   710
     Flushes all pending output into the compressed file. The parameter
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   711
   flush is as in the deflate() function. The return value is the zlib
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   712
   error number (see function gzerror below). gzflush returns Z_OK if
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   713
   the flush parameter is Z_FINISH and all output could be flushed.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   714
     gzflush should be called only when strictly necessary because it can
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   715
   degrade compression.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   716
*/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   717
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   718
/*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   719
      Sets the starting position for the next gzread or gzwrite on the
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   720
   given compressed file. The offset represents a number of bytes in the
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   721
   uncompressed data stream. The whence parameter is defined as in lseek(2);
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   722
   the value SEEK_END is not supported.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   723
     If the file is opened for reading, this function is emulated but can be
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   724
   extremely slow. If the file is opened for writing, only forward seeks are
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   725
   supported; gzseek then compresses a sequence of zeroes up to the new
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   726
   starting position.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   727
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   728
      gzseek returns the resulting offset location as measured in bytes from
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   729
   the beginning of the uncompressed stream, or -1 in case of error, in
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   730
   particular if the file is opened for writing and the new starting position
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   731
   would be before the current position.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   732
*/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   733
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   734
/*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   735
     Rewinds the given file. This function is supported only for reading.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   736
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   737
   gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET)
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   738
*/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   739
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   740
/*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   741
     Returns the starting position for the next gzread or gzwrite on the
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   742
   given compressed file. This position represents a number of bytes in the
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   743
   uncompressed data stream.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   744
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   745
   gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR)
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   746
*/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   747
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   748
/*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   749
     Returns 1 when EOF has previously been detected reading the given
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   750
   input stream, otherwise zero.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   751
*/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   752
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   753
/*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   754
     Flushes all pending output if necessary, closes the compressed file
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   755
   and deallocates all the (de)compression state. The return value is the zlib
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   756
   error number (see function gzerror below).
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   757
*/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   758
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   759
/*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   760
     Returns the error message for the last error which occurred on the
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   761
   given compressed file. errnum is set to zlib error number. If an
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   762
   error occurred in the file system and not in the compression library,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   763
   errnum is set to Z_ERRNO and the application may consult errno
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   764
   to get the exact error code.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   765
*/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   766
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   767
                        /* checksum functions */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   768
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   769
/*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   770
     These functions are not related to compression but are exported
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   771
   anyway because they might be useful in applications using the
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   772
   compression library.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   773
*/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   774
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   775
ZEXTERN(uLong)  adler32 OF((uLong adler, const Bytef *buf, uInt len));
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   776
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   777
/*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   778
     Update a running Adler-32 checksum with the bytes buf[0..len-1] and
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   779
   return the updated checksum. If buf is NULL, this function returns
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   780
   the required initial value for the checksum.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   781
   An Adler-32 checksum is almost as reliable as a CRC32 but can be computed
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   782
   much faster. Usage example:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   783
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   784
     uLong adler = adler32(0L, Z_NULL, 0);
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   785
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   786
     while (read_buffer(buffer, length) != EOF) {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   787
       adler = adler32(adler, buffer, length);
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   788
     }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   789
     if (adler != original_adler) error();
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   790
*/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   791
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   792
/*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   793
     Update a running crc with the bytes buf[0..len-1] and return the updated
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   794
   crc. If buf is NULL, this function returns the required initial value
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   795
   for the crc. Pre- and post-conditioning (one's complement) is performed
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   796
   within this function so it shouldn't be done by the application.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   797
   Usage example:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   798
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   799
     uLong crc = crc32(0L, Z_NULL, 0);
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   800
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   801
     while (read_buffer(buffer, length) != EOF) {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   802
       crc = crc32(crc, buffer, length);
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   803
     }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   804
     if (crc != original_crc) error();
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   805
*/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   806
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   807
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   808
                        /* various hacks, don't look :) */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   809
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   810
/* deflateInit and inflateInit are macros to allow checking the zlib version
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   811
 * and the compiler's view of z_stream:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   812
 */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   813
ZEXTERN(int)  inflateInit2_ OF((z_streamp strm, int  windowBits,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   814
                                      const char *version, int stream_size));
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   815
#define deflateInit(strm, level) \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   816
        deflateInit_((strm), (level),       ZLIB_VERSION, sizeof(z_stream))
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   817
#define inflateInit(strm) \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   818
        inflateInit_((strm),                ZLIB_VERSION, sizeof(z_stream))
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   819
#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   820
        deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   821
                      (strategy),           ZLIB_VERSION, sizeof(z_stream))
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   822
#define inflateInit2(strm, windowBits) \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   823
        inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream))
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   824
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   825
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   826
#ifdef __cplusplus
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   827
}
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   828
#endif
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   829
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   830
#endif /* _ZLIB_H */