diff options
Diffstat (limited to 'infcodes.c')
-rw-r--r-- | infcodes.c | 27 |
1 files changed, 17 insertions, 10 deletions
@@ -5,9 +5,10 @@ | |||
5 | 5 | ||
6 | #include "zutil.h" | 6 | #include "zutil.h" |
7 | #include "inftrees.h" | 7 | #include "inftrees.h" |
8 | #include "infblock.h" | ||
9 | #include "infcodes.h" | ||
8 | #include "infutil.h" | 10 | #include "infutil.h" |
9 | #include "inffast.h" | 11 | #include "inffast.h" |
10 | #include "infcodes.h" | ||
11 | 12 | ||
12 | /* simplify the use of the inflate_huft type with some defines */ | 13 | /* simplify the use of the inflate_huft type with some defines */ |
13 | #define base more.Base | 14 | #define base more.Base |
@@ -55,14 +56,14 @@ struct inflate_codes_state { | |||
55 | }; | 56 | }; |
56 | 57 | ||
57 | 58 | ||
58 | struct inflate_codes_state *inflate_codes_new(bl, bd, tl, td, z) | 59 | inflate_codes_statef *inflate_codes_new(bl, bd, tl, td, z) |
59 | uInt bl, bd; | 60 | uInt bl, bd; |
60 | inflate_huft *tl, *td; | 61 | inflate_huft *tl, *td; |
61 | z_stream *z; | 62 | z_stream *z; |
62 | { | 63 | { |
63 | struct inflate_codes_state *c; | 64 | inflate_codes_statef *c; |
64 | 65 | ||
65 | if ((c = (struct inflate_codes_state *) | 66 | if ((c = (inflate_codes_statef *) |
66 | ZALLOC(z,1,sizeof(struct inflate_codes_state))) != Z_NULL) | 67 | ZALLOC(z,1,sizeof(struct inflate_codes_state))) != Z_NULL) |
67 | { | 68 | { |
68 | c->mode = START; | 69 | c->mode = START; |
@@ -77,7 +78,7 @@ z_stream *z; | |||
77 | 78 | ||
78 | 79 | ||
79 | int inflate_codes(s, z, r) | 80 | int inflate_codes(s, z, r) |
80 | struct inflate_blocks_state *s; | 81 | inflate_blocks_statef *s; |
81 | z_stream *z; | 82 | z_stream *z; |
82 | int r; | 83 | int r; |
83 | { | 84 | { |
@@ -86,12 +87,12 @@ int r; | |||
86 | uInt e; /* extra bits or operation */ | 87 | uInt e; /* extra bits or operation */ |
87 | uLong b; /* bit buffer */ | 88 | uLong b; /* bit buffer */ |
88 | uInt k; /* bits in bit buffer */ | 89 | uInt k; /* bits in bit buffer */ |
89 | Byte *p; /* input data pointer */ | 90 | Bytef *p; /* input data pointer */ |
90 | uInt n; /* bytes available there */ | 91 | uInt n; /* bytes available there */ |
91 | Byte *q; /* output window write pointer */ | 92 | Bytef *q; /* output window write pointer */ |
92 | uInt m; /* bytes to end of window or read pointer */ | 93 | uInt m; /* bytes to end of window or read pointer */ |
93 | Byte *f; /* pointer to copy strings from */ | 94 | Bytef *f; /* pointer to copy strings from */ |
94 | struct inflate_codes_state *c = s->sub.decode.codes; /* codes state */ | 95 | inflate_codes_statef *c = s->sub.decode.codes; /* codes state */ |
95 | 96 | ||
96 | /* copy input/output information to locals (UPDATE macro restores) */ | 97 | /* copy input/output information to locals (UPDATE macro restores) */ |
97 | LOAD | 98 | LOAD |
@@ -194,9 +195,15 @@ int r; | |||
194 | Tracevv((stderr, "inflate: distance %u\n", c->sub.copy.dist)); | 195 | Tracevv((stderr, "inflate: distance %u\n", c->sub.copy.dist)); |
195 | c->mode = COPY; | 196 | c->mode = COPY; |
196 | case COPY: /* o: copying bytes in window, waiting for space */ | 197 | case COPY: /* o: copying bytes in window, waiting for space */ |
198 | #ifndef __TURBOC__ /* Turbo C bug for following expression */ | ||
197 | f = (uInt)(q - s->window) < c->sub.copy.dist ? | 199 | f = (uInt)(q - s->window) < c->sub.copy.dist ? |
198 | s->end - (c->sub.copy.dist - (q - s->window)) : | 200 | s->end - (c->sub.copy.dist - (q - s->window)) : |
199 | q - c->sub.copy.dist; | 201 | q - c->sub.copy.dist; |
202 | #else | ||
203 | f = q - c->sub.copy.dist; | ||
204 | if ((uInt)(q - s->window) < c->sub.copy.dist) | ||
205 | f = s->end - (c->sub.copy.dist - (q - s->window)); | ||
206 | #endif | ||
200 | while (c->len) | 207 | while (c->len) |
201 | { | 208 | { |
202 | NEEDOUT | 209 | NEEDOUT |
@@ -231,7 +238,7 @@ int r; | |||
231 | 238 | ||
232 | 239 | ||
233 | void inflate_codes_free(c, z) | 240 | void inflate_codes_free(c, z) |
234 | struct inflate_codes_state *c; | 241 | inflate_codes_statef *c; |
235 | z_stream *z; | 242 | z_stream *z; |
236 | { | 243 | { |
237 | ZFREE(z, c); | 244 | ZFREE(z, c); |