From d8350b2fe736ab38ac980183a003a2dc88e46efa Mon Sep 17 00:00:00 2001 From: kramm Date: Wed, 7 Apr 2004 10:08:03 +0000 Subject: [PATCH] zlib writer no longer calls finish() on it's output writer --- lib/bitio.c | 10 +++++++++- lib/bitio.h | 11 ++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/lib/bitio.c b/lib/bitio.c index 2394121..923430a 100644 --- a/lib/bitio.c +++ b/lib/bitio.c @@ -303,6 +303,10 @@ static int writer_zlibdeflate_write(struct writer_t*writer, void* data, int len) #ifdef HAVE_ZLIB struct zlibdeflate_t*z = (struct zlibdeflate_t*)writer->internal; int ret; + if(writer->type != WRITER_TYPE_ZLIB) { + fprintf(stderr, "Wrong writer ID (writer not initialized?)\n"); + return 0; + } if(!z) { fprintf(stderr, "zlib not initialized!\n"); return 0; @@ -341,6 +345,10 @@ static void writer_zlibdeflate_finish(struct writer_t*writer) struct zlibdeflate_t*z = (struct zlibdeflate_t*)writer->internal; struct writer_t*output; int ret; + if(writer->type != WRITER_TYPE_ZLIB) { + fprintf(stderr, "Wrong writer ID (writer not initialized?)\n"); + return; + } if(!z) return; output= z->output; @@ -364,7 +372,7 @@ static void writer_zlibdeflate_finish(struct writer_t*writer) if (ret != Z_OK) zlib_error(ret, "bitio:deflate_end", &z->zs); free(writer->internal); writer->internal = 0; - output->finish(output); + //output->finish(output); #else fprintf(stderr, "Error: swftools was compiled without zlib support"); exit(1); diff --git a/lib/bitio.h b/lib/bitio.h index 085597b..a8dcd5c 100644 --- a/lib/bitio.h +++ b/lib/bitio.h @@ -26,11 +26,16 @@ #define READER_TYPE_FILE 0 #define READER_TYPE_MEM 1 -#define READER_TYPE_ZLIB 2 +#define READER_TYPE_ZLIB_U 2 +#define READER_TYPE_ZLIB_C 3 +#define READER_TYPE_ZLIB READER_TYPE_ZLIB_U + #define WRITER_TYPE_FILE 0 #define WRITER_TYPE_MEM 1 -#define WRITER_TYPE_ZLIB 2 -#define WRITER_TYPE_NULL 3 +#define WRITER_TYPE_ZLIB_C 2 +#define WRITER_TYPE_ZLIB_U 3 +#define WRITER_TYPE_NULL 4 +#define WRITER_TYPE_ZLIB WRITER_TYPE_ZLIB_C struct reader_t { -- 1.7.10.4