--- pgp/src/zinflate.c 2018/04/24 16:39:30 1.1.1.3 +++ pgp/src/zinflate.c 2018/04/24 16:42:30 1.1.1.5 @@ -167,7 +167,7 @@ struct huft { /* Function prototypes */ int huft_build OF((unsigned *, unsigned, unsigned, UWORD *, UWORD *, - struct huft **, int *)); + struct huft **, int *)); int huft_free OF((struct huft *)); void flush OF((unsigned)); int inflate_codes OF((struct huft *, struct huft *, int, int)); @@ -176,7 +176,7 @@ int inflate_fixed OF((void)); int inflate_dynamic OF((void)); int inflate_block OF((int *)); int inflate_entry OF((void)); -void inflate OF((void)); +int inflate OF((void)); /* The inflate algorithm uses a sliding 32K byte window on the uncompressed @@ -205,7 +205,7 @@ static UWORD cpdist[] = { /* Copy 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577}; static UWORD cpdext[] = { /* Extra bits for distance codes */ - 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, + 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13}; @@ -243,8 +243,18 @@ ULONG bb; /* bit b unsigned bk; /* bits in bit buffer */ UWORD bytebuf; +#if 0 #define NEXTBYTE (ReadByte(&bytebuf), bytebuf) #define NEEDBITS(n) {while(k<(n)){b|=((ULONG)NEXTBYTE)<>=(n);k-=(n);} @@ -404,7 +414,7 @@ int *m; /* maximum looku z = (z = g - w) > l ? l : z; /* upper limit on table size */ if ((f = 1 << (j = k - w)) > a + 1) /* try a k-w bit table */ { /* too few codes for k-w bit table */ - f -= a + 1; /* deduct codes from patterns left */ + f -= a + 1; /* deduct codes from patterns left */ xp = c + k; while (++j < z) /* try smaller tables up to z bits */ { @@ -608,7 +618,7 @@ int bl, bd; /* number of bit { memcpy(slide + w, slide + d, e); w += e; - d += e; + d += e; } else /* do it slow to avoid memcpy() overlap */ #endif /* !NOMEMCPY */ @@ -971,9 +981,11 @@ int inflate_entry() } -void inflate() +int inflate() /* ignore the return code for now ... */ { + int status; + #ifdef DYN_ALLOC window = (char*) calloc((unsigned)WSIZE, 2*sizeof(char)); /* Note that inflate only needs WSIZE bytes, but the window @@ -982,10 +994,12 @@ void inflate() if (window==NULL) err(4, ""); #endif - inflate_entry(); + status = inflate_entry(); #ifdef DYN_ALLOC free(window); window = NULL; #endif + + return status; }