1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-03 22:56:33 +02:00

added zlib and reorgnaized some stuff

This commit is contained in:
Werner Koch 1998-02-12 14:39:08 +00:00
parent bc5789665a
commit fec94908c3
52 changed files with 8138 additions and 356 deletions

View file

@ -25,9 +25,7 @@
#include <unistd.h>
#include <assert.h>
#include <errno.h>
#ifdef HAVE_ZLIB_H
#include <zlib.h>
#endif
#include <zlib.h>
#include "util.h"
#include "memory.h"
@ -36,7 +34,6 @@
#include "options.h"
#ifdef HAVE_ZLIB_H
static void
init_compress( compress_filter_context_t *zfx, z_stream *zs )
{
@ -228,34 +225,6 @@ 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;
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