mirror of
git://git.gnupg.org/gnupg.git
synced 2025-04-17 15:44:34 +02:00
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>
This commit is contained in:
parent
b7b4a1bdd9
commit
105a5629c7
@ -638,8 +638,9 @@ do_plaintext( IOBUF out, int ctb, PKT_plaintext *pt )
|
|||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
nbytes = iobuf_copy (out, pt->buf);
|
nbytes = iobuf_copy (out, pt->buf);
|
||||||
if( (ctb&0x40) && !pt->len )
|
if(ctb_new_format_p (ctb) && !pt->len)
|
||||||
iobuf_set_partial_body_length_mode(out, 0 ); /* turn off partial */
|
/* Turn off partial body length mode. */
|
||||||
|
iobuf_set_partial_body_length_mode (out, 0);
|
||||||
if( pt->len && nbytes != pt->len )
|
if( pt->len && nbytes != pt->len )
|
||||||
log_error("do_plaintext(): wrote %lu bytes but expected %lu bytes\n",
|
log_error("do_plaintext(): wrote %lu bytes but expected %lu bytes\n",
|
||||||
(ulong)nbytes, (ulong)pt->len );
|
(ulong)nbytes, (ulong)pt->len );
|
||||||
@ -1443,7 +1444,7 @@ write_sign_packet_header (IOBUF out, int ctb, u32 len)
|
|||||||
static int
|
static int
|
||||||
write_header2( IOBUF out, int ctb, u32 len, int hdrlen )
|
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 );
|
return write_new_header( out, ctb, len, hdrlen );
|
||||||
|
|
||||||
/* An old format packet. Refer to RFC 4880, Section 4.2.1 to
|
/* An old format packet. Refer to RFC 4880, Section 4.2.1 to
|
||||||
|
Loading…
x
Reference in New Issue
Block a user