diff options
author | Jakub Zawadzki <darkjames-ws@darkjames.pl> | 2013-11-29 19:21:20 +0000 |
---|---|---|
committer | Jakub Zawadzki <darkjames-ws@darkjames.pl> | 2013-11-29 19:21:20 +0000 |
commit | d99fdfda639e78feffa3d9a1a6c758ae90539442 (patch) | |
tree | 87b591d02048464feebc32f8cf1dc784c7229b17 /wiretap/libpcap.c | |
parent | 5ac6474c945133a8415fb3be917859e5d42b6256 (diff) |
Replace macros: BSWAP16, BSWAP32, BSWAP64 with glib-version.
XXX, people are not aware that expression of this macros might be evaluated multiple times, like:
- BSWAP16(tvb_get_letohs(tvb, off)) : \
+ GUINT16_SWAP_LE_BE(tvb_get_letohs(tvb, off)) : \
Should be tvb_get_ntohs() called?
svn path=/trunk/; revision=53653
Diffstat (limited to 'wiretap/libpcap.c')
-rw-r--r-- | wiretap/libpcap.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/wiretap/libpcap.c b/wiretap/libpcap.c index 907f2311f9..dd246cd65f 100644 --- a/wiretap/libpcap.c +++ b/wiretap/libpcap.c @@ -172,10 +172,10 @@ int libpcap_open(wtap *wth, int *err, gchar **err_info) if (byte_swapped) { /* Byte-swap the header fields about which we care. */ - hdr.version_major = BSWAP16(hdr.version_major); - hdr.version_minor = BSWAP16(hdr.version_minor); - hdr.snaplen = BSWAP32(hdr.snaplen); - hdr.network = BSWAP32(hdr.network); + hdr.version_major = GUINT16_SWAP_LE_BE(hdr.version_major); + hdr.version_minor = GUINT16_SWAP_LE_BE(hdr.version_minor); + hdr.snaplen = GUINT32_SWAP_LE_BE(hdr.snaplen); + hdr.network = GUINT32_SWAP_LE_BE(hdr.network); } if (hdr.version_major < 2) { /* We only support version 2.0 and later. */ @@ -792,10 +792,10 @@ adjust_header(wtap *wth, struct pcaprec_hdr *hdr) libpcap = (libpcap_t *)wth->priv; if (libpcap->byte_swapped) { /* Byte-swap the record header fields. */ - hdr->ts_sec = BSWAP32(hdr->ts_sec); - hdr->ts_usec = BSWAP32(hdr->ts_usec); - hdr->incl_len = BSWAP32(hdr->incl_len); - hdr->orig_len = BSWAP32(hdr->orig_len); + hdr->ts_sec = GUINT32_SWAP_LE_BE(hdr->ts_sec); + hdr->ts_usec = GUINT32_SWAP_LE_BE(hdr->ts_usec); + hdr->incl_len = GUINT32_SWAP_LE_BE(hdr->incl_len); + hdr->orig_len = GUINT32_SWAP_LE_BE(hdr->orig_len); } /* Swap the "incl_len" and "orig_len" fields, if necessary. */ |