From 04aacc8b3fdb1d6ba3a044ac20b173b615d2c60f Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Fri, 11 Aug 2000 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 2000-08-11 --- mpc/unsac.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mpc/unsac.c b/mpc/unsac.c index a8d2a2b0a2c775005bf0e0447eba332045823c72..f918792eef7b6c1333d51bc59299900b45b14916 100644 --- a/mpc/unsac.c +++ b/mpc/unsac.c @@ -448,11 +448,13 @@ hufftab(Decode *dec, Huff *h, char *hb, ulong *bitcount, int maxleaf, int maxbit */ for(b = maxbits; b > flatbits; b--){ code = h->maxcode[b]; + if(code == -1) + break; mincode = code + 1 - bitcount[b]; mincode >>= b - flatbits; code >>= b - flatbits; - for(; code >= mincode; code--) - h->flat[code] = (b << 8) | 0xff; + for(; mincode <= code; mincode++) + h->flat[mincode] = (b << 8) | 0xff; } for(i = 0; i < maxleaf; i++){