aboutsummaryrefslogtreecommitdiffstats
path: root/g10/compress.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>1999-05-31 17:49:37 +0000
committerWerner Koch <[email protected]>1999-05-31 17:49:37 +0000
commitc34c67695888aafe5fb4fa0b2c2345bede16cefe (patch)
treed0a9d9d99d05a6a530712a4a432ecaf6ea94c880 /g10/compress.c
parentSee ChangeLog: Thu May 27 09:40:55 CEST 1999 Werner Koch (diff)
downloadgnupg-c34c67695888aafe5fb4fa0b2c2345bede16cefe.tar.gz
gnupg-c34c67695888aafe5fb4fa0b2c2345bede16cefe.zip
See ChangeLog: Mon May 31 19:41:10 CEST 1999 Werner Koch
Diffstat (limited to 'g10/compress.c')
-rw-r--r--g10/compress.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/g10/compress.c b/g10/compress.c
index 5ad4a27de..4862346ad 100644
--- a/g10/compress.c
+++ b/g10/compress.c
@@ -132,8 +132,7 @@ do_uncompress( compress_filter_context_t *zfx, z_stream *zs,
int zrc;
int rc=0;
size_t n;
- byte *p;
- int c;
+ int nread, count;
int refill = !zs->avail_in;
if( DBG_FILTER )
@@ -145,16 +144,17 @@ do_uncompress( compress_filter_context_t *zfx, z_stream *zs,
n = zs->avail_in;
if( !n )
zs->next_in = zfx->inbuf;
- for( p=zfx->inbuf+n; n < zfx->inbufsize; n++, p++ ) {
- if( (c=iobuf_get(a)) == -1 ) {
- /* If we use the undocumented feature to suppress
- * the zlib header, we have to give inflate an
- * extra dummy byte to read */
- if( zfx->algo != 1 || zfx->algo1hack )
- break;
- zfx->algo1hack = 1;
- }
- *p = c & 0xff;
+ count = zfx->inbufsize - n;
+ nread = iobuf_read( a, zfx->inbuf + n, count );
+ if( nread == -1 ) nread = 0;
+ n += nread;
+ /* If we use the undocumented feature to suppress
+ * the zlib header, we have to give inflate an
+ * extra dummy byte to read */
+ if( nread < count && zfx->algo == 1 ) {
+ *(zfx->inbuf + n) = 0xFF; /* is it really needed ? */
+ zfx->algo1hack = 1;
+ n++;
}
zs->avail_in = n;
}