flate

deflate implementation
git clone git://git.suckless.org/flate
Log | Files | Refs | README

commit be0d4117f31f10eec14de20df693790d31b3c91e
parent 58be19c3d3ebac615b49986977b2a958d604f4da
Author: nsz <nszabolcs@gmail.com>
Date:   Mon, 20 Apr 2009 20:42:05 +0200

minor clean up
Diffstat:
inflate.c | 10+++-------
1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/inflate.c b/inflate.c @@ -210,7 +210,6 @@ static void decode_trees(FlateStream *s, HuffTree *lt, HuffTree *dt) { } else /* error */; } - /* build dynamic trees */ build_tree(lt, lens, nlit); build_tree(dt, lens + nlit, ndist); @@ -242,7 +241,6 @@ static int decode_block(FlateStream *s, HuffTree *lt, HuffTree *dt) { if (sym >= Ndist) /* error */; dist = distbase[sym] + getbits(s, distbits[sym]); - /* copy match */ for (i = 0; i < len; i++) s->dst[i] = s->dst[i - dist]; @@ -257,7 +255,6 @@ static int inflate_uncompressed_block(FlateStream *s) { len = (s->src[1] << 8) | s->src[0]; invlen = (s->src[3] << 8) | s->src[2]; s->src += 4; - if (len != (~invlen & 0x0000ffff)) /* error */; @@ -329,9 +326,9 @@ int inflate(void *dst, uint *dstlen, const void *src, uint srclen) { #include <stdio.h> #include <stdlib.h> -unsigned char *readall(char *name, uint *len) { +void *readall(char *name, uint *len) { ulong size = 1 << 22; - uchar *buf; + void *buf; FILE *in; in = fopen(name, "r"); @@ -345,9 +342,8 @@ unsigned char *readall(char *name, uint *len) { int main(int argc, char **argv) { int ret; - uchar *src; + uchar *src, *dst; uint srclen, dstlen=1<<22; - uchar *dst; if (argc < 2) return -1;