Minor cleanup, including:
- remove uneeded #include; - remove uneeded col_clear(); - widen several var definitions to prevent potential overflow; - remove uneeded initializers; - use consistent indentation; - whitespace. svn path=/trunk/; revision=44048
This commit is contained in:
parent
64b467543e
commit
f5bc152e48
|
@ -31,7 +31,6 @@
|
|||
#include <glib.h>
|
||||
|
||||
#include <epan/packet.h>
|
||||
#include <epan/prefs.h>
|
||||
#include <epan/expert.h>
|
||||
#include <epan/dissectors/packet-mpeg-sect.h>
|
||||
|
||||
|
@ -125,14 +124,14 @@ static const range_string aid_control_code_values[] = {
|
|||
static guint
|
||||
dissect_etv_bif_platform_ids(tvbuff_t *tvb, proto_tree *tree, guint offset)
|
||||
{
|
||||
proto_tree *platform_tree = NULL;
|
||||
proto_tree *platform_tree;
|
||||
proto_item *pi;
|
||||
|
||||
pi = proto_tree_add_text(tree, tvb, offset, 15, "Platform Id");
|
||||
platform_tree = proto_item_add_subtree(pi, ett_eiss_platform_id);
|
||||
proto_tree_add_item(platform_tree, hf_pdtHWManufacturer, tvb, offset, 3, ENC_BIG_ENDIAN);
|
||||
offset += 3;
|
||||
proto_tree_add_item(platform_tree, hf_pdtHWModel, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_item(platform_tree, hf_pdtHWModel, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
offset += 2;
|
||||
proto_tree_add_item(platform_tree, hf_pdtHWVersionMajor, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
offset++;
|
||||
|
@ -140,30 +139,29 @@ dissect_etv_bif_platform_ids(tvbuff_t *tvb, proto_tree *tree, guint offset)
|
|||
offset++;
|
||||
proto_tree_add_item(platform_tree, hf_pdtSWManufacturer, tvb, offset, 3, ENC_BIG_ENDIAN);
|
||||
offset += 3;
|
||||
proto_tree_add_item(platform_tree, hf_pdtSWModel, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_item(platform_tree, hf_pdtSWModel, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
offset += 2;
|
||||
proto_tree_add_item(platform_tree, hf_pdtSWVersionMajor, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
offset++;
|
||||
proto_tree_add_item(platform_tree, hf_pdtSWVersionMinor, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
offset++;
|
||||
proto_tree_add_item(platform_tree, hf_pdtProfile, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_item(platform_tree, hf_pdtProfile, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
offset++;
|
||||
|
||||
return 15;
|
||||
}
|
||||
|
||||
static guint
|
||||
dissect_eiss_descriptors(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
||||
guint offset)
|
||||
dissect_eiss_descriptors(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset)
|
||||
{
|
||||
proto_item *pi;
|
||||
proto_tree *sub_tree;
|
||||
guint tag;
|
||||
guint tag;
|
||||
|
||||
tag = tvb_get_guint8(tvb, offset);
|
||||
|
||||
if (0xe0 == tag) {
|
||||
guint8 total_length;
|
||||
guint total_length;
|
||||
|
||||
total_length = tvb_get_guint8(tvb, offset+1);
|
||||
pi = proto_tree_add_text(tree, tvb, offset, (2+total_length),
|
||||
|
@ -221,8 +219,8 @@ dissect_eiss_descriptors(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|||
offset, 4, ENC_BIG_ENDIAN);
|
||||
return 6;
|
||||
} else if (0xe2 == tag) {
|
||||
guint16 tmp;
|
||||
tvbuff_t *payload = NULL;
|
||||
guint tmp;
|
||||
tvbuff_t *payload;
|
||||
|
||||
tmp = tvb_get_ntohs(tvb, offset+1);
|
||||
pi = proto_tree_add_text(tree, tvb, offset, (3+tmp),
|
||||
|
@ -260,20 +258,19 @@ dissect_eiss_descriptors(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|||
static void
|
||||
dissect_eiss(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
||||
{
|
||||
guint offset = 0, packet_length, sect_len;
|
||||
proto_item *ti = NULL;
|
||||
proto_item *pi = NULL;
|
||||
proto_tree *eiss_tree = NULL;
|
||||
guint offset = 0, packet_length, sect_len;
|
||||
proto_item *ti;
|
||||
proto_item *pi;
|
||||
proto_tree *eiss_tree;
|
||||
proto_item *items[PACKET_MPEG_SECT_PI__SIZE];
|
||||
gboolean ssi;
|
||||
guint reserved;
|
||||
guint8 reserved2;
|
||||
guint8 sect_num, last_sect_num;
|
||||
gboolean ssi;
|
||||
guint reserved;
|
||||
guint8 reserved2;
|
||||
guint8 sect_num, last_sect_num;
|
||||
|
||||
guint16 eiss_application_type;
|
||||
guint8 platform_id_length;
|
||||
|
||||
col_clear(pinfo->cinfo, COL_PROTOCOL);
|
||||
col_set_str(pinfo->cinfo, COL_PROTOCOL, "EISS");
|
||||
|
||||
ti = proto_tree_add_item(tree, proto_eiss, tvb, offset, -1, ENC_NA);
|
||||
|
@ -329,24 +326,24 @@ dissect_eiss(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
"Invalid section_number (must be <= last_section_number)");
|
||||
}
|
||||
offset++;
|
||||
proto_tree_add_item(eiss_tree, hf_eiss_last_section_number, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_item(eiss_tree, hf_eiss_last_section_number, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
offset++;
|
||||
proto_tree_add_item(eiss_tree, hf_eiss_protocol_version_major, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_item(eiss_tree, hf_eiss_protocol_version_major, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
offset++;
|
||||
proto_tree_add_item(eiss_tree, hf_eiss_protocol_version_minor, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_item(eiss_tree, hf_eiss_protocol_version_minor, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
offset++;
|
||||
|
||||
eiss_application_type = tvb_get_ntohs(tvb, offset);
|
||||
pi = proto_tree_add_item(eiss_tree, hf_eiss_application_type, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
pi = proto_tree_add_item(eiss_tree, hf_eiss_application_type, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
if (8 != eiss_application_type) {
|
||||
PROTO_ITEM_SET_GENERATED(pi);
|
||||
expert_add_info_format(pinfo, pi, PI_MALFORMED, PI_ERROR,
|
||||
"Invalid application_type (must be 0x0008)");
|
||||
}
|
||||
offset += 2;
|
||||
proto_tree_add_item(eiss_tree, hf_eiss_organisation_id, tvb, offset, 4, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_item(eiss_tree, hf_eiss_organisation_id, tvb, offset, 4, ENC_BIG_ENDIAN);
|
||||
offset += 4;
|
||||
proto_tree_add_item(eiss_tree, hf_eiss_application_id, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_item(eiss_tree, hf_eiss_application_id, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
offset += 2;
|
||||
|
||||
platform_id_length = tvb_get_guint8(tvb, offset);
|
||||
|
@ -372,7 +369,7 @@ dissect_eiss(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
}
|
||||
|
||||
if (0 < packet_length) {
|
||||
proto_tree *eiss_desc_tree = NULL;
|
||||
proto_tree *eiss_desc_tree;
|
||||
pi = proto_tree_add_text(eiss_tree, tvb, offset,
|
||||
packet_length-offset,
|
||||
"%s", "EISS Descriptor(s)");
|
||||
|
|
|
@ -80,7 +80,6 @@ enum {
|
|||
|
||||
/* From ETSI EN 301 790 */
|
||||
enum {
|
||||
|
||||
TID_RMT = 0x41, /* Conflict with TID_NIT_OTHER */
|
||||
TID_SCT = 0xA0,
|
||||
TID_FCT,
|
||||
|
@ -153,23 +152,23 @@ static const value_string mpeg_sect_table_id_vals[] = {
|
|||
gint
|
||||
packet_mpeg_sect_mjd_to_utc_time(tvbuff_t *tvb, gint offset, nstime_t *utc_time)
|
||||
{
|
||||
gint bcd_time_offset; /* start offset of the bcd time in the tvbuff */
|
||||
guint8 hour, min, sec;
|
||||
gint bcd_time_offset; /* start offset of the bcd time in the tvbuff */
|
||||
guint8 hour, min, sec;
|
||||
|
||||
if (!utc_time)
|
||||
return -1;
|
||||
if (!utc_time)
|
||||
return -1;
|
||||
|
||||
nstime_set_zero(utc_time);
|
||||
utc_time->secs = (tvb_get_ntohs(tvb, offset) - 40587) * 86400;
|
||||
bcd_time_offset = offset+2;
|
||||
hour = MPEG_SECT_BCD44_TO_DEC(tvb_get_guint8(tvb, bcd_time_offset));
|
||||
min = MPEG_SECT_BCD44_TO_DEC(tvb_get_guint8(tvb, bcd_time_offset+1));
|
||||
sec = MPEG_SECT_BCD44_TO_DEC(tvb_get_guint8(tvb, bcd_time_offset+2));
|
||||
if (hour>23 || min>59 || sec>59)
|
||||
return -1;
|
||||
nstime_set_zero(utc_time);
|
||||
utc_time->secs = (tvb_get_ntohs(tvb, offset) - 40587) * 86400;
|
||||
bcd_time_offset = offset+2;
|
||||
hour = MPEG_SECT_BCD44_TO_DEC(tvb_get_guint8(tvb, bcd_time_offset));
|
||||
min = MPEG_SECT_BCD44_TO_DEC(tvb_get_guint8(tvb, bcd_time_offset+1));
|
||||
sec = MPEG_SECT_BCD44_TO_DEC(tvb_get_guint8(tvb, bcd_time_offset+2));
|
||||
if (hour>23 || min>59 || sec>59)
|
||||
return -1;
|
||||
|
||||
utc_time->secs += hour*3600 + min*60 + sec;
|
||||
return 5;
|
||||
utc_time->secs += hour*3600 + min*60 + sec;
|
||||
return 5;
|
||||
}
|
||||
|
||||
guint
|
||||
|
@ -270,7 +269,7 @@ packet_mpeg_sect_crc(tvbuff_t *tvb, packet_info *pinfo,
|
|||
PI_ERROR, "Invalid CRC" );
|
||||
}
|
||||
|
||||
return 4;
|
||||
return 4;
|
||||
}
|
||||
|
||||
|
||||
|
@ -278,12 +277,12 @@ static void
|
|||
dissect_mpeg_sect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
||||
{
|
||||
gint offset = 0;
|
||||
guint8 table_id = 0;
|
||||
guint section_length = 0;
|
||||
gboolean syntax_indicator = FALSE;
|
||||
guint8 table_id;
|
||||
|
||||
proto_item *ti = NULL;
|
||||
proto_tree *mpeg_sect_tree = NULL;
|
||||
proto_item *ti;
|
||||
proto_tree *mpeg_sect_tree;
|
||||
|
||||
table_id = tvb_get_guint8(tvb, offset);
|
||||
|
||||
|
@ -292,16 +291,16 @@ dissect_mpeg_sect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
return;
|
||||
|
||||
/* If no dissector is registered, use the common one */
|
||||
col_set_str(pinfo->cinfo, COL_PROTOCOL, "MPEG SECT");
|
||||
col_add_fstr(pinfo->cinfo, COL_INFO, "Table ID 0x%02x", table_id);
|
||||
col_set_str(pinfo->cinfo, COL_PROTOCOL, "MPEG SECT");
|
||||
col_add_fstr(pinfo->cinfo, COL_INFO, "Table ID 0x%02x", table_id);
|
||||
|
||||
ti = proto_tree_add_item(tree, proto_mpeg_sect, tvb, offset, -1, ENC_NA);
|
||||
mpeg_sect_tree = proto_item_add_subtree(ti, ett_mpeg_sect);
|
||||
ti = proto_tree_add_item(tree, proto_mpeg_sect, tvb, offset, -1, ENC_NA);
|
||||
mpeg_sect_tree = proto_item_add_subtree(ti, ett_mpeg_sect);
|
||||
|
||||
proto_item_append_text(ti, " Table_ID=0x%02x", table_id);
|
||||
proto_item_append_text(ti, " Table_ID=0x%02x", table_id);
|
||||
|
||||
packet_mpeg_sect_header(tvb, offset, mpeg_sect_tree,
|
||||
§ion_length, &syntax_indicator);
|
||||
packet_mpeg_sect_header(tvb, offset, mpeg_sect_tree,
|
||||
§ion_length, &syntax_indicator);
|
||||
|
||||
if (syntax_indicator)
|
||||
packet_mpeg_sect_crc(tvb, pinfo, mpeg_sect_tree, 0, (section_length-1));
|
||||
|
@ -352,7 +351,7 @@ proto_register_mpeg_sect(void)
|
|||
mpeg_sect_module = prefs_register_protocol(proto_mpeg_sect, NULL);
|
||||
|
||||
prefs_register_bool_preference(mpeg_sect_module,
|
||||
"verify_crc",
|
||||
"verify_crc",
|
||||
"Verify the section CRC",
|
||||
"Whether the section dissector should verify the CRC",
|
||||
&mpeg_sect_check_crc);
|
||||
|
|
Loading…
Reference in New Issue