ReactOS  0.4.14-dev-41-g31d7680
infutil.h
Go to the documentation of this file.
1 /* infutil.h -- types and macros common to blocks and codes
2  * Copyright (C) 1995-2002 Mark Adler
3  * For conditions of distribution and use, see copyright notice in zlib.h
4  */
5 
6 /* WARNING: this file should *not* be used by applications. It is
7  part of the implementation of the compression library and is
8  subject to change. Applications should only use zlib.h.
9  */
10 
11 #ifndef _INFUTIL_H
12 #define _INFUTIL_H
13 
14 typedef enum {
15  TYPE, /* get type bits (3, including end bit) */
16  LENS, /* get lengths for stored */
17  STORED, /* processing stored block */
18  TABLE, /* get table lengths */
19  BTREE, /* get bit lengths tree for a dynamic block */
20  DTREE, /* get length, distance trees for a dynamic block */
21  CODES, /* processing fixed or dynamic block */
22  DRY, /* output remaining window bytes */
23  DONE, /* finished last block, done */
24  BAD} /* got a data error--stuck here */
26 
27 /* inflate blocks semi-private state */
29 
30  /* mode */
31  inflate_block_mode mode; /* current inflate_block mode */
32 
33  /* mode dependent information */
34  union {
35  uInt left; /* if STORED, bytes left to copy */
36  struct {
37  uInt table; /* table lengths (14 bits) */
38  uInt index; /* index into blens (or border) */
39  uIntf *blens; /* bit lengths of codes */
40  uInt bb; /* bit length tree depth */
41  inflate_huft *tb; /* bit length decoding tree */
42  } trees; /* if DTREE, decoding info for trees */
43  struct {
46  } decode; /* if CODES, current state */
47  } sub; /* submode */
48  uInt last; /* true if this block is the last block */
49 
50  /* mode independent information */
51  uInt bitk; /* bits in bit buffer */
52  uLong bitb; /* bit buffer */
53  inflate_huft *hufts; /* single malloc for tree space */
54  Bytef *window; /* sliding window */
55  Bytef *end; /* one byte after sliding window */
56  Bytef *read; /* window read pointer */
57  Bytef *write; /* window write pointer */
58  check_func checkfn; /* check function */
59  uLong check; /* check on output */
60 
61 };
62 
63 
64 /* defines for inflate input/output */
65 /* update pointers and return */
66 #define UPDBITS {s->bitb=b;s->bitk=k;}
67 #define UPDIN {z->avail_in=n;z->total_in+=p-z->next_in;z->next_in=p;}
68 #define UPDOUT {s->write=q;}
69 #define UPDATE {UPDBITS UPDIN UPDOUT}
70 #define LEAVE {UPDATE return inflate_flush(s,z,r);}
71 /* get bytes and bits */
72 #define LOADIN {p=z->next_in;n=z->avail_in;b=s->bitb;k=s->bitk;}
73 #define NEEDBYTE {if(n)r=Z_OK;else LEAVE}
74 #define NEXTBYTE (n--,*p++)
75 #define NEEDBITS(j) {while(k<(j)){NEEDBYTE;b|=((uLong)NEXTBYTE)<<k;k+=8;}}
76 #define DUMPBITS(j) {b>>=(j);k-=(j);}
77 /* output bytes */
78 #define WAVAIL (uInt)(q<s->read?s->read-q-1:s->end-q)
79 #define LOADOUT {q=s->write;m=(uInt)WAVAIL;}
80 #define WRAP {if(q==s->end&&s->read!=s->window){q=s->window;m=(uInt)WAVAIL;}}
81 #define FLUSH {UPDOUT r=inflate_flush(s,z,r); LOADOUT}
82 #define NEEDOUT {if(m==0){WRAP if(m==0){FLUSH WRAP if(m==0) LEAVE}}r=Z_OK;}
83 #define OUTBYTE(a) {*q++=(Byte)(a);m--;}
84 /* load local pointers */
85 #define LOAD {LOADIN LOADOUT}
86 
87 /* masks for lower bits (size given to avoid silly warnings with Visual C++) */
88 #ifndef NO_INFLATE_MASK
90 #endif
91 
92 /* copy as much as possible from the sliding window to the output area */
95  z_streamp ,
96  int));
97 
98 #endif
Definition: infutil.h:17
Definition: infutil.h:16
inflate_huft * hufts
Definition: infutil.h:53
struct inflate_blocks_state FAR inflate_blocks_statef
Definition: infblock.h:15
uInt FAR uIntf
Definition: zconf.h:404
struct inflate_blocks_state::@3850::@3852 decode
uInt inflate_mask[17]
Definition: infutil.h:89
inflate_block_mode mode
Definition: infutil.h:31
struct inflate_blocks_state::@3850::@3851 trees
Byte FAR Bytef
Definition: zconf.h:400
z_stream FAR * z_streamp
Definition: zlib.h:108
union inflate_blocks_state::@3850 sub
Definition: infutil.h:20
check_func checkfn
Definition: infutil.h:58
Definition: infutil.h:21
unsigned long uLong
Definition: zconf.h:394
Definition: infutil.h:22
Definition: infutil.h:24
Definition: infutil.h:23
Definition: infutil.h:19
struct inflate_huft_s FAR inflate_huft
Definition: inftrees.h:17
inflate_huft * tb
Definition: infutil.h:41
#define local
Definition: zutil.h:30
Definition: infutil.h:18
inflate_block_mode
Definition: infutil.h:14
inflate_codes_statef * codes
Definition: infutil.h:45
int inflate_flush(inflate_blocks_statef *s, z_streamp z, int r)
Definition: infutil.c:22
Definition: infutil.h:15
int inflate_flush OF((inflate_blocks_statef *, z_streamp, int))
unsigned int uInt
Definition: zconf.h:393
struct inflate_codes_state FAR inflate_codes_statef
Definition: infcodes.h:15