1 /***********************************************************
3 ***********************************************************/
6 extern struct lha_opts opts;
9 decode(struct lzh_istream *rp, FILE *outfile, unsigned long remainder, unsigned int *crc)
15 huf_decode_start(rp, opts.method);
18 n = (uint)MIN(remainder, MAXDICSIZ);
21 uint c = decode_c(&huf, rp);
25 fwrite_crc(buf, n, outfile, crc);
26 if (outfile != stdout && opts.quiet < 1) {
31 if (remainder <= 0) return;
34 n = (uint)MIN(remainder, MAXDICSIZ);
38 unsigned int slide_off = 0;
41 slide_len = c - (UCHAR_MAX + 1 - THRESHOLD);
42 slide_off = (r - decode_p(&huf, rp) - 1) & (MAXDICSIZ - 1);
43 while (--slide_len >= 0) {
44 buf[r] = buf[slide_off];
45 slide_off = (slide_off+1) & (MAXDICSIZ - 1);
47 fwrite_crc(buf, n, outfile, crc);
48 if (outfile != stdout && opts.quiet < 1) {
53 if (remainder <= 0) return;
56 n = (uint)MIN(remainder, MAXDICSIZ);