aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-dcm.c
diff options
context:
space:
mode:
authorJeff Morriss <jeff.morriss@ulticom.com>2011-01-20 03:49:44 +0000
committerJeff Morriss <jeff.morriss@ulticom.com>2011-01-20 03:49:44 +0000
commit705f2ede5d8300ce62fb353f032934722f3a22f2 (patch)
treec9b44bf334fd6a1596e7ac2929476a05a22c979d /epan/dissectors/packet-dcm.c
parent573b4d449f5240238e5e120bc3e4c6dfa1759ee3 (diff)
Roll some calls to tvb_get_ptr() into proto_tree_add_bytes_format() (instead
of going through a temporary variable). This just makes it more obvious which add_bytes_format() calls are or are not being given pointers into the TVB. Use tvb_ip_to_str() and tvb_ip6_to_str() in a couple spots. svn path=/trunk/; revision=35593
Diffstat (limited to 'epan/dissectors/packet-dcm.c')
-rw-r--r--epan/dissectors/packet-dcm.c42
1 files changed, 12 insertions, 30 deletions
diff --git a/epan/dissectors/packet-dcm.c b/epan/dissectors/packet-dcm.c
index 23a49510fe..0ab797a9aa 100644
--- a/epan/dissectors/packet-dcm.c
+++ b/epan/dissectors/packet-dcm.c
@@ -5321,17 +5321,14 @@ dissect_dcm_tag_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, dcm_s
else if ((strncmp(vr, "OB", 2) == 0) || (strncmp(vr, "OF", 2) == 0) ||
(strncmp(vr, "OW", 2) == 0)) {
/* Array of Bytes, Float or Words. Don't perform any decoding */
- const guint8* valb;
- valb = tvb_get_ptr(tvb, offset, vl_max);
proto_tree_add_bytes_format(tree, hf_dcm_tag_value_byte, tvb, offset, vl_max,
- valb, "%-8.8s%s", "Value:", "(binary)");
+ tvb_get_ptr(tvb, offset, vl_max), "%-8.8s%s", "Value:", "(binary)");
g_snprintf(*tag_value, MAX_BUF_LEN, "(binary)");
}
else if (strncmp(vr, "UN", 2) == 0) {
/* Usually the case for private tags in implicit syntax, since tag was not found and vr not specified */
- const guint8 *valb;
guint8 val8;
gchar *vals;
guint32 i;
@@ -5367,9 +5364,8 @@ dissect_dcm_tag_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, dcm_s
g_snprintf(*tag_value, MAX_BUF_LEN, "%s", vals);
}
else {
- valb = tvb_get_ptr(tvb, offset, vl_max);
proto_tree_add_bytes_format(tree, hf_dcm_tag_value_byte, tvb, offset, vl_max,
- valb, "%-8.8s%s", "Value:", "(binary)");
+ tvb_get_ptr(tvb, offset, vl_max), "%-8.8s%s", "Value:", "(binary)");
g_snprintf(*tag_value, MAX_BUF_LEN, "(binary)");
}
@@ -5398,30 +5394,24 @@ dissect_dcm_tag_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, dcm_s
else if (strncmp(vr, "FL", 2) == 0) { /* Single Float */
gfloat valf;
- const guint8* valb;
-
- valb = tvb_get_ptr(tvb, offset, 4);
if (is_little_endian) valf = tvb_get_letohieee_float(tvb, offset);
else valf = tvb_get_ntohieee_float(tvb, offset);
proto_tree_add_bytes_format(tree, hf_dcm_tag_value_byte, tvb, offset, 4,
- valb, "%-8.8s%f", "Value:", valf);
+ tvb_get_ptr(tvb, offset, 4), "%-8.8s%f", "Value:", valf);
g_snprintf(*tag_value, MAX_BUF_LEN, "%f", valf);
}
else if (strncmp(vr, "FD", 2) == 0) { /* Double Float */
gdouble vald;
- const guint8* valb;
-
- valb = tvb_get_ptr(tvb, offset, 8);
if (is_little_endian) vald = tvb_get_letohieee_double(tvb, offset);
else vald = tvb_get_ntohieee_double(tvb, offset);
proto_tree_add_bytes_format(tree, hf_dcm_tag_value_byte, tvb, offset, 8,
- valb, "%-8.8s%f", "Value:", vald);
+ tvb_get_ptr(tvb, offset, 8), "%-8.8s%f", "Value:", vald);
g_snprintf(*tag_value, MAX_BUF_LEN, "%f", vald);
}
@@ -5519,12 +5509,8 @@ dissect_dcm_tag_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, dcm_s
}
/* Invalid VR, can only occur with Explicit syntax */
else {
- const guint8* valb;
-
- valb = tvb_get_ptr(tvb, offset, vl_max);
-
proto_tree_add_bytes_format(tree, hf_dcm_tag_value_byte, tvb, offset, vl_max,
- valb, "%-8.8s%s", "Value:", (vl > vl_max ? "" : "(unknown VR)"));
+ tvb_get_ptr(tvb, offset, vl_max), "%-8.8s%s", "Value:", (vl > vl_max ? "" : "(unknown VR)"));
g_snprintf(*tag_value, MAX_BUF_LEN, "(unknown VR)");
}
@@ -5987,12 +5973,10 @@ dissect_dcm_tag(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
else if (vl > vl_max) {
/* Tag is longer than the PDV/PDU. Don't perform any decoding */
- const guint8* valb;
gchar *tag_desc;
- valb = tvb_get_ptr(tvb, offset, vl_max);
proto_tree_add_bytes_format(tag_ptree, hf_dcm_tag_value_byte, tvb, offset, vl_max,
- valb, "%-8.8sBytes %d - %d [start]", "Value:", 1, vl_max);
+ tvb_get_ptr(tvb, offset, vl_max), "%-8.8sBytes %d - %d [start]", "Value:", 1, vl_max);
g_snprintf(tag_value, MAX_BUF_LEN, "<Bytes %d - %d, start>", 1, vl_max);
offset += vl_max;
@@ -6058,7 +6042,6 @@ dissect_dcm_tag_open(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
/* 'Decode' open tags from previous PDV */
proto_item *pitem = NULL;
- const guint8 *val = NULL;
guint32 tag_value_fragment_len = 0;
@@ -6103,11 +6086,10 @@ dissect_dcm_tag_open(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
pdv->is_corrupt = FALSE;
}
- val = tvb_get_ptr(tvb, offset, tag_value_fragment_len);
-
if (pdv->is_corrupt) {
pitem = proto_tree_add_bytes_format(tree, hf_dcm_data_tag, tvb,
- offset, tag_value_fragment_len, val, "%s <incomplete>",
+ offset, tag_value_fragment_len,
+ tvb_get_ptr(tvb, offset, tag_value_fragment_len), "%s <incomplete>",
pdv->prev->open_tag.desc);
expert_add_info_format(pinfo, pitem, PI_MALFORMED, PI_ERROR,
@@ -6116,7 +6098,8 @@ dissect_dcm_tag_open(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
}
else {
proto_tree_add_bytes_format(tree, hf_dcm_data_tag, tvb,
- offset, tag_value_fragment_len, val, "%s <Bytes %d - %d, %s>",
+ offset, tag_value_fragment_len,
+ tvb_get_ptr(tvb, offset, tag_value_fragment_len), "%s <Bytes %d - %d, %s>",
pdv->prev->open_tag.desc,
pdv->prev->open_tag.len_total - pdv->prev->open_tag.len_remaining + 1,
pdv->prev->open_tag.len_total - pdv->prev->open_tag.len_remaining + tag_value_fragment_len,
@@ -6147,11 +6130,10 @@ dissect_dcm_pdv_body(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
if (pdv->syntax == DCM_UNK) {
/* Eventually, we will have a syntax detector. Until then, don't decode */
- const guint8 *val = NULL;
- val = tvb_get_ptr(tvb, offset, pdv_body_len);
proto_tree_add_bytes_format(tree, hf_dcm_data_tag, tvb,
- offset, pdv_body_len, val, "(%04x,%04x) %-8x Unparsed data", 0, 0, pdv_body_len);
+ offset, pdv_body_len, tvb_get_ptr(tvb, offset, pdv_body_len),
+ "(%04x,%04x) %-8x Unparsed data", 0, 0, pdv_body_len);
offset = endpos;
}
else {