From: Francois-Xavier Le Bail Date: Tue, 21 Nov 2017 18:30:53 +0000 (+0100) Subject: Use more the EXTRACT_8BITS() macro to fetch a one-byte value (16/n) X-Git-Tag: tcpdump-4.99-bp~1738 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/f7606784dba04b65edbd2f1582465aab2266ce7f Use more the EXTRACT_8BITS() macro to fetch a one-byte value (16/n) Assignment, two operators. ((*e1) op1 e2) op2 e3 --- diff --git a/print-aoe.c b/print-aoe.c index 7dcf5aa2..a5878ea7 100644 --- a/print-aoe.c +++ b/print-aoe.c @@ -409,7 +409,7 @@ aoe_print(netdissect_options *ndo, goto invalid; /* Ver/Flags */ ND_TCHECK2(*cp, 1); - ver = (*cp & 0xF0) >> 4; + ver = (EXTRACT_8BITS(cp) & 0xF0) >> 4; /* Don't advance cp yet: low order 4 bits are version-specific. */ ND_PRINT((ndo, ", Ver %u", ver)); diff --git a/print-atm.c b/print-atm.c index bb7eaf3b..5da96cd5 100644 --- a/print-atm.c +++ b/print-atm.c @@ -462,7 +462,7 @@ oam_print (netdissect_options *ndo, ND_TCHECK(*(p+ATM_HDR_LEN_NOHEC+hec)); cell_header = EXTRACT_BE_32BITS(p + hec); - cell_type = ((*(p+ATM_HDR_LEN_NOHEC+hec))>>4) & 0x0f; + cell_type = (EXTRACT_8BITS((p + ATM_HDR_LEN_NOHEC + hec)) >> 4) & 0x0f; func_type = EXTRACT_8BITS((p + ATM_HDR_LEN_NOHEC + hec)) & 0x0f; vpi = (cell_header>>20)&0xff; diff --git a/print-snmp.c b/print-snmp.c index dc6f1a6e..a729ea0a 100644 --- a/print-snmp.c +++ b/print-snmp.c @@ -440,7 +440,7 @@ asn1_parse(netdissect_options *ndo, */ id = EXTRACT_8BITS(p) & ASN_ID_BITS; /* lower 5 bits, range 00-1f */ #ifdef notdef - form = (*p & 0xe0) >> 5; /* move upper 3 bits to lower 3 */ + form = (EXTRACT_8BITS(p) & 0xe0) >> 5; /* move upper 3 bits to lower 3 */ class = form >> 1; /* bits 7&6 -> bits 1&0, range 0-3 */ form &= 0x1; /* bit 5 -> bit 0, range 0-1 */ #else