aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-umts_mac.c
diff options
context:
space:
mode:
authorAnders Broman <anders.broman@ericsson.com>2011-09-26 15:11:14 +0000
committerAnders Broman <anders.broman@ericsson.com>2011-09-26 15:11:14 +0000
commit5f76488f0adc4bfd87c37a3c7c82bbf7b5df601f (patch)
tree6c939077945eb170eed1ef6dadbe542c0e193748 /epan/dissectors/packet-umts_mac.c
parentb87f9143e42552cb6c3181ef35a79c3df526ef4a (diff)
Move tvb_new_octet_aligned() to tvbuff.c and use it.
svn path=/trunk/; revision=39150
Diffstat (limited to 'epan/dissectors/packet-umts_mac.c')
-rw-r--r--epan/dissectors/packet-umts_mac.c48
1 files changed, 0 insertions, 48 deletions
diff --git a/epan/dissectors/packet-umts_mac.c b/epan/dissectors/packet-umts_mac.c
index a87fe9b06e..5c719f78ba 100644
--- a/epan/dissectors/packet-umts_mac.c
+++ b/epan/dissectors/packet-umts_mac.c
@@ -104,54 +104,6 @@ static const value_string mac_logical_channel_vals[] = {
{ 0, NULL }
};
-static tvbuff_t *
-tvb_new_octet_aligned(tvbuff_t *tvb, guint32 bit_offset, gint32 no_of_bits)
-{
- tvbuff_t *sub_tvb = NULL;
- guint32 byte_offset;
- gint32 datalen, i;
- guint8 left, right, *buf;
- const guint8 *data;
-
- byte_offset = bit_offset >> 3;
- left = bit_offset % 8; /* for left-shifting */
- right = 8 - left; /* for right-shifting */
-
- if (no_of_bits == -1) {
- datalen = tvb_length_remaining(tvb, byte_offset);
- } else {
- datalen = no_of_bits >> 3;
- if (no_of_bits % 8) datalen++;
- }
-
- /* already aligned -> shortcut */
- if (left == 0) {
- return tvb_new_subset(tvb, byte_offset, datalen, -1);
- }
-
- buf = ep_alloc0(datalen);
-
- /* if at least one trailing byte is available, we must use the content
- * of that byte for the last shift (i.e. tvb_get_ptr() must use datalen + 1
- * if non extra byte is available, the last shifted byte requires
- * special treatment
- */
- if (tvb_length_remaining(tvb, byte_offset) > datalen) {
- data = tvb_get_ptr(tvb, byte_offset, datalen + 1);
- } else {
- data = tvb_get_ptr(tvb, byte_offset, datalen);
- datalen--; /* correct 'datalen' for 'for' loop */
- buf[datalen] = data[datalen] << left; /* set last octet */
- }
- /* shift tvb data bit_offset bits to the left */
- for (i = 0; i < datalen; i++)
- buf[i] = (data[i] << left) | (data[i+1] >> right);
-
- sub_tvb = tvb_new_real_data(buf, datalen, datalen);
- tvb_set_child_real_data_tvbuff(tvb, sub_tvb);
-
- return sub_tvb;
-}
static guint8 fach_fdd_tctf(guint8 hdr, guint16 *bit_offs)
{