commit 144b062df1777a3fe05588e5c62d5e4aed9f4c13
parent 75899c653f9541fafdacfd02bb7df46b6a82e22c
Author: nsz@tpx <unknown>
Date: Fri, 7 Aug 2009 09:54:51 +0200
+flate.h -inflate.h deflate.h
Diffstat:
8 files changed, 28 insertions(+), 11 deletions(-)
diff --git a/Makefile b/Makefile
@@ -17,7 +17,7 @@ deflate: deflate.o deflate_example.o
${CC} -o $@ $^ ${LDFLAGS}
deflate_simple: deflate_simple.o
${CC} -o $@ $^ ${LDFLAGS}
-${OBJ}: Makefile
+${OBJ}: Makefile flate.h
.c.o:
${CC} -c ${CFLAGS} $<
clean:
diff --git a/deflate.c b/deflate.c
@@ -2,7 +2,6 @@
#include <string.h>
#include <stdio.h>
#include "flate.h"
-#include "deflate.h"
/*
TODO:
diff --git a/deflate.h b/deflate.h
@@ -1,3 +0,0 @@
-/* TODO: deflete_reset deflate_free */
-int deflate(FlateStream *s);
-int deflate_callback(int (*r)(void *, int, void *), void *rdata, int (*w)(void *, int, void *), void *wdata);
diff --git a/deflate_example.c b/deflate_example.c
@@ -1,7 +1,6 @@
#include <stdlib.h>
#include <stdio.h>
#include "flate.h"
-#include "deflate.h"
int compress_stream(FILE *in, FILE *out) {
FlateStream s;
diff --git a/flate.h b/flate.h
@@ -0,0 +1,27 @@
+typedef unsigned char uchar;
+typedef unsigned short ushort;
+typedef unsigned int uint;
+
+/* deflate and inflate return values */
+enum {
+ FlateOk = 0,
+ FlateErr = -1,
+ FlateIn = -2,
+ FlateOut = -3,
+};
+/* TODO inflate assume Flate* < 0 */
+
+typedef struct {
+ int nin;
+ int nout;
+ uchar *in;
+ uchar *out;
+ char *err;
+ void *state;
+} FlateStream;
+
+/* TODO: _reset _free */
+int deflate(FlateStream *s);
+int deflate_callback(int (*r)(void *, int, void *), void *rdata, int (*w)(void *, int, void *), void *wdata);
+int inflate(FlateStream *s);
+int inflate_callback(int (*r)(void *, int, void *), void *rdata, int (*w)(void *, int, void *), void *wdata);
diff --git a/inflate.c b/inflate.c
@@ -1,7 +1,6 @@
#include <stdlib.h>
#include <string.h>
#include "flate.h"
-#include "inflate.h"
enum {
CodeBits = 16, /* max number of bits in a code + 1 */
diff --git a/inflate.h b/inflate.h
@@ -1,3 +0,0 @@
-/* TODO: inflate_reset, inflate_free */
-int inflate(FlateStream *s);
-int inflate_callback(int (*r)(void *, int, void *), void *rdata, int (*w)(void *, int, void *), void *wdata);
diff --git a/inflate_example.c b/inflate_example.c
@@ -1,7 +1,6 @@
#include <stdlib.h>
#include <stdio.h>
#include "flate.h"
-#include "inflate.h"
int decompress_stream(FILE *in, FILE *out) {
FlateStream s;