diff options
author | Guy Harris <guy@alum.mit.edu> | 2017-11-23 11:19:38 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2017-11-23 11:19:38 -0800 |
commit | c45bfbe0abffa23618e622cc984f97244b5608dd (patch) | |
tree | 49786306f2b9f1cee2616242f1c441981a48ace4 /print-802_11.c | |
parent | d42f1df527f024122815ddfab1d7cebee042e87c (diff) | |
download | tcpdump-c45bfbe0abffa23618e622cc984f97244b5608dd.tar.gz |
Clean up signed vs. unsigned.
Have separate cpack_ routines for signed and unsigned numbers, with the
signed ones using _S_ extract macros. That way, we can do more type
checking.
Add EXTRACT_LE_S_ macros.
Use signed variables for IEEE80211_RADIOTAP_TX_ATTENUATION and
IEEE80211_RADIOTAP_DB_TX_ATTENUATION, rather than using unsigned
variables that we cast to int.
Also, use EXTRACT_U_1() in cpack_uint8.
Diffstat (limited to 'print-802_11.c')
-rw-r--r-- | print-802_11.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/print-802_11.c b/print-802_11.c index 35889815..e6e88a02 100644 --- a/print-802_11.c +++ b/print-802_11.c @@ -2707,22 +2707,22 @@ print_radiotap_field(netdissect_options *ndo, } case IEEE80211_RADIOTAP_TX_ATTENUATION: { - uint16_t tx_attenuation; + int16_t tx_attenuation; - rc = cpack_uint16(s, &tx_attenuation); + rc = cpack_int16(s, &tx_attenuation); if (rc != 0) goto trunc; - ND_PRINT((ndo, "%d tx power ", -(int)tx_attenuation)); + ND_PRINT((ndo, "%d tx power ", -tx_attenuation)); break; } case IEEE80211_RADIOTAP_DB_TX_ATTENUATION: { - uint8_t db_tx_attenuation; + int8_t db_tx_attenuation; - rc = cpack_uint8(s, &db_tx_attenuation); + rc = cpack_int8(s, &db_tx_attenuation); if (rc != 0) goto trunc; - ND_PRINT((ndo, "%ddB tx attenuation ", -(int)db_tx_attenuation)); + ND_PRINT((ndo, "%ddB tx attenuation ", -db_tx_attenuation)); break; } |