struct gunzip_state {
unsigned char *window;
+
+ /* window position */
+ unsigned int wp;
};
static unsigned char *__initdata inbuf;
/* Index of next byte to be processed in inbuf: */
static unsigned int __initdata inptr;
-/* Bytes in output buffer: */
-static unsigned int __initdata outcnt;
-
#define malloc(a) xmalloc_bytes(a)
#define free(a) xfree(a)
#define memzero(s, n) memset((s), 0, (n))
unsigned char *in, ch;
in = s->window;
- for ( n = 0; n < outcnt; n++ )
+ for ( n = 0; n < s->wp; n++ )
{
ch = *in++;
c = crc_32_tab[((int)c ^ ch) & 0xff] ^ (c >> 8);
}
crc = c;
- bytes_out += (unsigned long)outcnt;
- outcnt = 0;
+ bytes_out += s->wp;
+ s->wp = 0;
}
__init int gzip_check(char *image, unsigned long image_len)
* "uch *slide;" and then malloc'ed in the latter case. The definition
* must be in unzip.h, included above.
*/
-/* unsigned wp; current position in slide */
-#define wp outcnt
/* Tables for deflate from PKZIP's appnote.txt. */
static const unsigned border[] = { /* Order of the bit length code lengths */
/* make local copies of globals */
b = bb; /* initialize bit buffer */
k = bk;
- w = wp; /* initialize window position */
+ w = s->wp; /* initialize window position */
/* inflate the coded data */
ml = mask_bits[bl]; /* precompute masks for speed */
Tracevv((stderr, "%c", s->window[w-1]));
if (w == WSIZE)
{
- wp = w;
+ s->wp = w;
flush_window(s);
w = 0;
}
} while (--e);
if (w == WSIZE)
{
- wp = w;
+ s->wp = w;
flush_window(s);
w = 0;
}
}
/* restore the globals from the locals */
- wp = w; /* restore global window pointer */
+ s->wp = w; /* restore global window position */
bb = b; /* restore global bit buffer */
bk = k;
/* make local copies of globals */
b = bb; /* initialize bit buffer */
k = bk;
- w = wp; /* initialize window position */
+ w = s->wp; /* initialize window position */
/* go to byte boundary */
s->window[w++] = (uch)b;
if (w == WSIZE)
{
- wp = w;
+ s->wp = w;
flush_window(s);
w = 0;
}
}
/* restore the globals from the locals */
- wp = w; /* restore global window pointer */
+ s->wp = w; /* restore global window position */
bb = b; /* restore global bit buffer */
bk = k;
int r; /* result code */
/* initialize window, bit buffer */
- wp = 0;
+ s->wp = 0;
bk = 0;
bb = 0;