diff options
Diffstat (limited to 'epan')
-rw-r--r-- | epan/dissectors/packet-bmc.c | 7 | ||||
-rw-r--r-- | epan/dissectors/packet-fddi.c | 7 | ||||
-rw-r--r-- | epan/dissectors/packet-h223.c | 5 |
3 files changed, 6 insertions, 13 deletions
diff --git a/epan/dissectors/packet-bmc.c b/epan/dissectors/packet-bmc.c index b70e2381ae..38217a64db 100644 --- a/epan/dissectors/packet-bmc.c +++ b/epan/dissectors/packet-bmc.c @@ -88,7 +88,7 @@ static int dissect_bmc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) { guint8 message_type; - guint8 *p_rev, *reversing_buffer; + guint8 *reversing_buffer; gint offset = 0; gint i, len; proto_item *ti; @@ -104,10 +104,7 @@ dissect_bmc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) /* Needs bit-reversing. Create a new buffer, copy the message to it and bit-reverse */ len = tvb_length(tvb); reversing_buffer = (guint8 *)tvb_memdup(NULL, tvb, offset, len); - p_rev = reversing_buffer; - /* Entire message is bit reversed */ - for (i=0; i<len; i++, p_rev++) - *p_rev = BIT_SWAP(*p_rev); + bit_swap_buf_inplace(reversing_buffer, len); /* Make this new buffer part of the display and provide a way to dispose of it */ bit_reversed_tvb = tvb_new_child_real_data(tvb, reversing_buffer, len, len); diff --git a/epan/dissectors/packet-fddi.c b/epan/dissectors/packet-fddi.c index c6347941cb..78671225f7 100644 --- a/epan/dissectors/packet-fddi.c +++ b/epan/dissectors/packet-fddi.c @@ -137,11 +137,8 @@ static dissector_handle_t data_handle; static void swap_mac_addr(guint8 *swapped_addr, tvbuff_t *tvb, gint offset) { - int i; - - for (i = 0; i < 6; i++) { - swapped_addr[i] = BIT_SWAP(tvb_get_guint8(tvb, offset+i)); - } + tvb_memcpy(tvb, swapped_addr, offset, 6); + bit_swap_buf_inplace(swapped_addr, 6); } diff --git a/epan/dissectors/packet-h223.c b/epan/dissectors/packet-h223.c index 078ee5fd48..0463013763 100644 --- a/epan/dissectors/packet-h223.c +++ b/epan/dissectors/packet-h223.c @@ -1370,9 +1370,8 @@ dissect_h223_bitswapped (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) guint i; len = tvb_length(tvb); - datax = (guint8 *)wmem_alloc(pinfo->pool, len); - for( i=0; i<len; i++) - datax[i]=BIT_SWAP(tvb_get_guint8(tvb,i)); + datax = tvb_memdup(pinfo->pool, tvb, 0, len); + bit_swap_buf_inplace(datax, len); /* * Add the reversed tvbuff to the list of tvbuffs to which |