diff options
author | Werner Koch <wk@gnupg.org> | 1997-11-26 23:02:28 +0100 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 1997-11-26 23:02:28 +0100 |
commit | 9479cf7e24abf0998ebbc083e28741038d535b68 (patch) | |
tree | 987fa4ffc48db5e94342901fa064f41bf1a7a2da /g10/compress.c | |
parent | added assembler modules (diff) | |
download | gnupg2-9479cf7e24abf0998ebbc083e28741038d535b68.tar.xz gnupg2-9479cf7e24abf0998ebbc083e28741038d535b68.zip |
How with some assembly support
Diffstat (limited to 'g10/compress.c')
-rw-r--r-- | g10/compress.c | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/g10/compress.c b/g10/compress.c index 980f5f976..38d23adf8 100644 --- a/g10/compress.c +++ b/g10/compress.c @@ -27,8 +27,6 @@ #include <errno.h> #ifdef HAVE_ZLIB_H #include <zlib.h> -#else - #error You need ZLIB to compile this module #endif #include "util.h" @@ -38,6 +36,7 @@ #include "options.h" +#ifdef HAVE_ZLIB_H static void init_compress( compress_filter_context_t *zfx, z_stream *zs ) { @@ -163,7 +162,6 @@ do_uncompress( compress_filter_context_t *zfx, z_stream *zs, return rc; } - int compress_filter( void *opaque, int control, IOBUF a, byte *buf, size_t *ret_len) @@ -228,6 +226,35 @@ compress_filter( void *opaque, int control, *(char**)buf = "compress_filter"; return rc; } +#else /* No ZLIB */ +int +compress_filter( void *opaque, int control, + IOBUF a, byte *buf, size_t *ret_len) +{ + size_t size = *ret_len; + compress_filter_context_t *zfx = opaque; + int c, rc=0; + size_t n; + + if( control == IOBUFCTRL_UNDERFLOW ) { + for( n=0; n < size; n++ ) { + if( (c=iobuf_get(a)) == -1 ) + break; + buf[n] = c & 0xff; + } + if( !n ) + rc = -1; + *ret_len = n; + } + else if( control == IOBUFCTRL_FLUSH ) { + if( iobuf_write( a, buf, size ) ) + rc = G10ERR_WRITE_FILE; + } + else if( control == IOBUFCTRL_DESC ) + *(char**)buf = "dummy compress_filter"; + return rc; +} +#endif /*no ZLIB*/ /**************** * Handle a compressed packet |