tvb_reported_length_remaining() can return -1;

Remove a few lines of not really req'd code;
Minor whitespace cleanup.

svn path=/trunk/; revision=37744
This commit is contained in:
Bill Meier 2011-06-22 04:20:46 +00:00
parent 19bc84f3b0
commit 83b642557a
1 changed files with 33 additions and 39 deletions

View File

@ -367,9 +367,6 @@ static const value_string dvbci_apdu_tag[] = {
#define BCD44_TO_DEC(x) (((x&0xf0) >> 4) * 10 + (x&0x0f)) #define BCD44_TO_DEC(x) (((x&0xf0) >> 4) * 10 + (x&0x0f))
void proto_reg_handoff_dvbci(void);
static int proto_dvbci = -1; static int proto_dvbci = -1;
static gint ett_dvbci = -1; static gint ett_dvbci = -1;
@ -909,7 +906,7 @@ dissect_dvbci_payload_rm(guint32 tag, gint len_field,
return; return;
} }
while (tvb_reported_length_remaining(tvb, offset) != 0) { while (tvb_reported_length_remaining(tvb, offset) > 0) {
res_id = tvb_get_ntohl(tvb, offset); res_id = tvb_get_ntohl(tvb, offset);
dissect_dvbci_res_id(tvb, offset, pinfo, tree, res_id, FALSE); dissect_dvbci_res_id(tvb, offset, pinfo, tree, res_id, FALSE);
offset += RES_ID_LEN; offset += RES_ID_LEN;
@ -977,7 +974,7 @@ dissect_dvbci_payload_ca(guint32 tag, gint len_field,
return; return;
} }
while (tvb_reported_length_remaining(tvb, offset) != 0) { while (tvb_reported_length_remaining(tvb, offset) > 0) {
proto_tree_add_item( proto_tree_add_item(
tree, hf_dvbci_ca_sys_id, tvb, offset, 2, ENC_BIG_ENDIAN); tree, hf_dvbci_ca_sys_id, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2; offset += 2;
@ -1246,7 +1243,7 @@ dissect_dvbci_payload_mmi(guint32 tag, gint len_field,
} }
else if (disp_rep_id == DISP_REP_ID_DISP_CHAR_TBL || else if (disp_rep_id == DISP_REP_ID_DISP_CHAR_TBL ||
disp_rep_id == DISP_REP_ID_DISP_CHAR_TBL) { disp_rep_id == DISP_REP_ID_DISP_CHAR_TBL) {
while (tvb_reported_length_remaining(tvb, offset) != 0) { while (tvb_reported_length_remaining(tvb, offset) > 0) {
proto_tree_add_item(tree, hf_dvbci_char_tbl, proto_tree_add_item(tree, hf_dvbci_char_tbl,
tvb, offset, 1, ENC_NA); tvb, offset, 1, ENC_NA);
offset++; offset++;
@ -1308,7 +1305,7 @@ dissect_dvbci_payload_mmi(guint32 tag, gint len_field,
offset += text_len; offset += text_len;
text_len = dissect_dvbci_text("Bottom line", tvb, offset, pinfo, tree); text_len = dissect_dvbci_text("Bottom line", tvb, offset, pinfo, tree);
offset += text_len; offset += text_len;
while (tvb_reported_length_remaining(tvb, offset)) { while (tvb_reported_length_remaining(tvb, offset) > 0) {
text_len = dissect_dvbci_text("Item", tvb, offset, pinfo, tree); text_len = dissect_dvbci_text("Item", tvb, offset, pinfo, tree);
/* minimum is apdu tag + 1 byte len field */ /* minimum is apdu tag + 1 byte len field */
if (text_len<APDU_TAG_SIZE+1) { if (text_len<APDU_TAG_SIZE+1) {
@ -1957,7 +1954,7 @@ dissect_dvbci_cis(tvbuff_t *tvb, gint offset,
} }
} }
offset += tpl_len; offset += tpl_len;
} while (tvb_reported_length_remaining(tvb, offset) && tpl_code!=CISTPL_END); } while ((tvb_reported_length_remaining(tvb, offset) > 0) && (tpl_code != CISTPL_END));
if (ti_main) if (ti_main)
proto_item_set_len(ti_main, offset-offset_start); proto_item_set_len(ti_main, offset-offset_start);
@ -2260,16 +2257,13 @@ proto_register_dvbci(void)
}; };
spdu_table = g_hash_table_new(g_direct_hash, g_direct_equal); spdu_table = g_hash_table_new(g_direct_hash, g_direct_equal);
if (!spdu_table)
return;
for(i=0; i<array_length(spdu_info); i++) { for(i=0; i<array_length(spdu_info); i++) {
g_hash_table_insert(spdu_table, g_hash_table_insert(spdu_table,
GUINT_TO_POINTER((guint)spdu_info[i].tag), GUINT_TO_POINTER((guint)spdu_info[i].tag),
(gpointer)(&spdu_info[i])); (gpointer)(&spdu_info[i]));
} }
apdu_table = g_hash_table_new(g_direct_hash, g_direct_equal); apdu_table = g_hash_table_new(g_direct_hash, g_direct_equal);
if (!apdu_table)
return;
for(i=0; i<array_length(apdu_info); i++) { for(i=0; i<array_length(apdu_info); i++) {
g_hash_table_insert(apdu_table, g_hash_table_insert(apdu_table,
GUINT_TO_POINTER((guint)apdu_info[i].tag), GUINT_TO_POINTER((guint)apdu_info[i].tag),