diff options
author | Neal H. Walfield <neal@g10code.com> | 2016-02-25 21:16:41 +0100 |
---|---|---|
committer | Neal H. Walfield <neal@g10code.com> | 2016-02-25 21:16:41 +0100 |
commit | 105a5629c7e938ec7b3c9c338ebe7bdfee4cfdad (patch) | |
tree | 49d1f524af4e72d8fdffe9dfb8895201f675c49d /g10/build-packet.c | |
parent | gpg: Improve documentation and comments related to OpenPGP packets. (diff) | |
download | gnupg2-105a5629c7e938ec7b3c9c338ebe7bdfee4cfdad.tar.xz gnupg2-105a5629c7e938ec7b3c9c338ebe7bdfee4cfdad.zip |
gpg: Avoid directly twiddling bits.
* g10/build-packet.c (do_plaintext): Use ctb_new_format_p to check the
packet's format.
(write_header2): Likewise.
--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
Diffstat (limited to 'g10/build-packet.c')
-rw-r--r-- | g10/build-packet.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/g10/build-packet.c b/g10/build-packet.c index 5bcfae182..fe6234f10 100644 --- a/g10/build-packet.c +++ b/g10/build-packet.c @@ -638,8 +638,9 @@ do_plaintext( IOBUF out, int ctb, PKT_plaintext *pt ) return rc; nbytes = iobuf_copy (out, pt->buf); - if( (ctb&0x40) && !pt->len ) - iobuf_set_partial_body_length_mode(out, 0 ); /* turn off partial */ + if(ctb_new_format_p (ctb) && !pt->len) + /* Turn off partial body length mode. */ + iobuf_set_partial_body_length_mode (out, 0); if( pt->len && nbytes != pt->len ) log_error("do_plaintext(): wrote %lu bytes but expected %lu bytes\n", (ulong)nbytes, (ulong)pt->len ); @@ -1443,7 +1444,7 @@ write_sign_packet_header (IOBUF out, int ctb, u32 len) static int write_header2( IOBUF out, int ctb, u32 len, int hdrlen ) { - if( ctb & 0x40 ) + if (ctb_new_format_p (ctb)) return write_new_header( out, ctb, len, hdrlen ); /* An old format packet. Refer to RFC 4880, Section 4.2.1 to |