diff options
Diffstat (limited to 'g10/encode.c')
-rw-r--r-- | g10/encode.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/g10/encode.c b/g10/encode.c index 1e37dfd74..142ffeac2 100644 --- a/g10/encode.c +++ b/g10/encode.c @@ -112,13 +112,10 @@ encode_simple( const char *filename, int mode ) if( opt.armor ) iobuf_push_filter( out, armor_filter, &afx ); - - write_comment( out, "#created by GNUPG v" VERSION " (" + else + write_comment( out, "#created by GNUPG v" VERSION " (" PRINTABLE_OS_NAME ")"); - if( opt.compress ) - iobuf_push_filter( out, compress_filter, &zfx ); - if( s2k ) { PKT_symkey_enc *enc = m_alloc_clear( sizeof *enc ); enc->version = 4; @@ -150,11 +147,14 @@ encode_simple( const char *filename, int mode ) pt->buf = inp; pkt.pkttype = PKT_PLAINTEXT; pkt.pkt.plaintext = pt; - cfx.datalen = filesize? calc_packet_length( &pkt ) : 0; + cfx.datalen = filesize && !opt.compress ? calc_packet_length( &pkt ) : 0; /* register the cipher filter */ if( mode ) iobuf_push_filter( out, cipher_filter, &cfx ); + /* register the compress filter */ + if( opt.compress ) + iobuf_push_filter( out, compress_filter, &zfx ); /* do the work */ if( (rc = build_packet( out, &pkt )) ) @@ -211,13 +211,10 @@ encode_crypt( const char *filename, STRLIST remusr ) if( opt.armor ) iobuf_push_filter( out, armor_filter, &afx ); - - write_comment( out, "#created by GNUPG v" VERSION " (" + else + write_comment( out, "#created by GNUPG v" VERSION " (" PRINTABLE_OS_NAME ")"); - if( opt.compress ) - iobuf_push_filter( out, compress_filter, &zfx ); - /* create a session key */ cfx.dek = m_alloc_secure( sizeof *cfx.dek ); cfx.dek->algo = opt.def_cipher_algo; @@ -249,10 +246,13 @@ encode_crypt( const char *filename, STRLIST remusr ) init_packet(&pkt); pkt.pkttype = PKT_PLAINTEXT; pkt.pkt.plaintext = pt; - cfx.datalen = filesize? calc_packet_length( &pkt ) : 0; + cfx.datalen = filesize && !opt.compress? calc_packet_length( &pkt ) : 0; /* register the cipher filter */ iobuf_push_filter( out, cipher_filter, &cfx ); + /* register the compress filter */ + if( opt.compress ) + iobuf_push_filter( out, compress_filter, &zfx ); /* do the work */ if( (rc = build_packet( out, &pkt )) ) |