From: Guy Harris Date: Sun, 14 Jan 2018 22:20:30 +0000 (-0800) Subject: Check against various modes explicitly. X-Git-Tag: tcpdump-4.99-bp~1455 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/10f1fe5fd8dfaa321621a1063d252940bb65029e Check against various modes explicitly. This avoids a "comparison is always true" warning when checking whether mode is >= MODE_UNSPEC. --- diff --git a/print-ntp.c b/print-ntp.c index 99cf72b2..b4fa6129 100644 --- a/print-ntp.c +++ b/print-ntp.c @@ -479,12 +479,24 @@ ntp_print(netdissect_options *ndo, tok2str(ntp_leapind_values, "Unknown", leapind), leapind); - if (mode >= MODE_UNSPEC && mode <= MODE_BROADCAST) + switch (mode) { + + case MODE_UNSPEC: + case MODE_SYM_ACT: + case MODE_SYM_PAS: + case MODE_CLIENT: + case MODE_SERVER: + case MODE_BROADCAST: ntp_time_print(ndo, &bp->td, length); - else if (mode == MODE_CONTROL) + break; + + case MODE_CONTROL: ntp_control_print(ndo, &bp->cd, length); - else - {;} /* XXX: not implemented! */ + break; + + default: + break; /* XXX: not implemented! */ + } return; trunc: