aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors
diff options
context:
space:
mode:
authorAnders Broman <anders.broman@ericsson.com>2007-10-11 21:23:14 +0000
committerAnders Broman <anders.broman@ericsson.com>2007-10-11 21:23:14 +0000
commit0b4529008d9051686bc942630c852404aeb3147b (patch)
tree86251ed1df6fc00c14dc668435a9192c1e4c9109 /epan/dissectors
parentc1484a08dfaa778cc070cad795fbc76b60d3417b (diff)
Implement some of the minor possible speed improvment patches.
svn path=/trunk/; revision=23150
Diffstat (limited to 'epan/dissectors')
-rw-r--r--epan/dissectors/packet-gprs-llc.c4
-rw-r--r--epan/dissectors/packet-h263.c2
-rw-r--r--epan/dissectors/packet-isup.c2
-rw-r--r--epan/dissectors/packet-megaco.c28
-rw-r--r--epan/dissectors/packet-sip.c19
-rw-r--r--epan/dissectors/packet-tpkt.c4
-rw-r--r--epan/dissectors/packet-uma.c4
7 files changed, 32 insertions, 31 deletions
diff --git a/epan/dissectors/packet-gprs-llc.c b/epan/dissectors/packet-gprs-llc.c
index e07aec756e..cf35ffca69 100644
--- a/epan/dissectors/packet-gprs-llc.c
+++ b/epan/dissectors/packet-gprs-llc.c
@@ -344,7 +344,7 @@ dissect_llcgprs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
if (check_col(pinfo->cinfo,COL_INFO))
{
- col_add_str(pinfo->cinfo,COL_INFO,"Invalid packet - Protocol Discriminator bit is set to 1");
+ col_set_str(pinfo->cinfo,COL_INFO,"Invalid packet - Protocol Discriminator bit is set to 1");
}
return;
}
@@ -358,7 +358,7 @@ dissect_llcgprs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
length = tvb_reported_length(tvb);
- if (tvb_bytes_exist(tvb, 0, length) && length >= 3)
+ if (tvb_length(tvb) >= length && length >= 3)
{
/*
* We have all the packet data, including the full FCS,
diff --git a/epan/dissectors/packet-h263.c b/epan/dissectors/packet-h263.c
index c6d4c558a9..8f39e5b630 100644
--- a/epan/dissectors/packet-h263.c
+++ b/epan/dissectors/packet-h263.c
@@ -482,7 +482,7 @@ dissect_h263_picture_layer( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
/* Bit 9: Picture Coding Type, "0" INTRA (I-picture), "1" INTER (P-picture). */
proto_tree_add_bits_ret_val( tree, hf_h263_payload_picture_coding_type, tvb, offset_in_bits, 1, &picture_coding_type, FALSE);
if ( check_col( pinfo->cinfo, COL_INFO) )
- col_append_fstr(pinfo->cinfo, COL_INFO, val_to_str((guint32)picture_coding_type, picture_coding_type_vals, "Unknown (%u)"));
+ col_append_str(pinfo->cinfo, COL_INFO, val_to_str((guint32)picture_coding_type, picture_coding_type_vals, "Unknown (%u)"));
offset_in_bits++;
/* Bit 10: Optional Unrestricted Motion Vector mode (see Annex D), "0" off, "1" on. */
proto_tree_add_bits_item( tree, hf_h263_opt_unres_motion_vector_mode, tvb, offset_in_bits, 1, FALSE);
diff --git a/epan/dissectors/packet-isup.c b/epan/dissectors/packet-isup.c
index 5879de05e7..95e2fa9a52 100644
--- a/epan/dissectors/packet-isup.c
+++ b/epan/dissectors/packet-isup.c
@@ -3593,7 +3593,7 @@ dissect_isup_application_transport_parameter(tvbuff_t *parameter_tvb, packet_inf
" (Message Reassembled)");
} else { /* Not last packet of reassembled Short Message */
if (check_col(pinfo->cinfo, COL_INFO))
- col_append_fstr(pinfo->cinfo, COL_INFO,
+ col_append_str(pinfo->cinfo, COL_INFO,
" (Message fragment )");
}
diff --git a/epan/dissectors/packet-megaco.c b/epan/dissectors/packet-megaco.c
index d99c6bdaf2..39ed98585c 100644
--- a/epan/dissectors/packet-megaco.c
+++ b/epan/dissectors/packet-megaco.c
@@ -388,7 +388,7 @@ dissect_megaco_text(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* Display MEGACO in protocol column */
if (check_col(pinfo->cinfo, COL_PROTOCOL))
- col_add_str(pinfo->cinfo, COL_PROTOCOL, "MEGACO");
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, "MEGACO");
/* Build the info tree if we've been given a root */
/* Create megaco subtree */
@@ -514,7 +514,7 @@ dissect_megaco_text(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* errorDescriptor */
case ERRORTOKEN:
if (check_col(pinfo->cinfo, COL_INFO) )
- col_add_fstr(pinfo->cinfo, COL_INFO, "Error ");
+ col_set_str(pinfo->cinfo, COL_INFO, "Error ");
tvb_current_offset = tvb_find_guint8(tvb, tvb_offset+1, tvb_len, '}');
@@ -727,7 +727,7 @@ nextcontext:
tvb_previous_offset, 1,
"Choose one");
if (check_col(pinfo->cinfo, COL_INFO) )
- col_append_fstr(pinfo->cinfo, COL_INFO, " |=Choose one");
+ col_append_str(pinfo->cinfo, COL_INFO, " |=Choose one");
break;
case '*':
ctx_id = ALL_CONTEXTS;
@@ -735,13 +735,13 @@ nextcontext:
tvb_previous_offset, 1,
"All");
if (check_col(pinfo->cinfo, COL_INFO) )
- col_append_fstr(pinfo->cinfo, COL_INFO, " |=All");
+ col_append_str(pinfo->cinfo, COL_INFO, " |=All");
break;
case '-':
ctx_id = NULL_CONTEXT;
proto_tree_add_text(megaco_context_tree, tvb, tvb_previous_offset, tokenlen, "Context: NULL" );
if (check_col(pinfo->cinfo, COL_INFO) )
- col_append_fstr(pinfo->cinfo, COL_INFO, " |=NULL");
+ col_append_str(pinfo->cinfo, COL_INFO, " |=NULL");
break;
default:
my_proto_tree_add_string(megaco_context_tree, hf_megaco_Context, tvb,
@@ -924,7 +924,7 @@ nextcontext:
tvb_command_start_offset, tokenlen,
"AuditValue");
if (check_col(pinfo->cinfo, COL_INFO) )
- col_append_fstr(pinfo->cinfo, COL_INFO, " AuditValue");
+ col_append_str(pinfo->cinfo, COL_INFO, " AuditValue");
break;
case 'C':
@@ -937,7 +937,7 @@ nextcontext:
tvb_command_start_offset, tokenlen,
"AuditCapability");
if (check_col(pinfo->cinfo, COL_INFO) )
- col_append_fstr(pinfo->cinfo, COL_INFO, " AuditCapability");
+ col_append_str(pinfo->cinfo, COL_INFO, " AuditCapability");
break;
default:
@@ -951,7 +951,7 @@ nextcontext:
tvb_command_start_offset, tokenlen,
"Add");
if (check_col(pinfo->cinfo, COL_INFO) )
- col_append_fstr(pinfo->cinfo, COL_INFO, " Add");
+ col_append_str(pinfo->cinfo, COL_INFO, " Add");
break;
}
break;
@@ -967,7 +967,7 @@ nextcontext:
tvb_command_start_offset, tokenlen,
"Notify");
if (check_col(pinfo->cinfo, COL_INFO) )
- col_append_fstr(pinfo->cinfo, COL_INFO, " Notify");
+ col_append_str(pinfo->cinfo, COL_INFO, " Notify");
break;
case 'M':
@@ -988,7 +988,7 @@ nextcontext:
tvb_command_start_offset, tokenlen,
"Modify");
if (check_col(pinfo->cinfo, COL_INFO) )
- col_append_fstr(pinfo->cinfo, COL_INFO, " Modify");
+ col_append_str(pinfo->cinfo, COL_INFO, " Modify");
break;
case 'V':
@@ -1001,7 +1001,7 @@ nextcontext:
tvb_command_start_offset, tokenlen,
"Move");
if (check_col(pinfo->cinfo, COL_INFO) )
- col_append_fstr(pinfo->cinfo, COL_INFO, " Move");
+ col_append_str(pinfo->cinfo, COL_INFO, " Move");
break;
}
break;
@@ -1070,7 +1070,7 @@ nextcontext:
tvb_command_start_offset, tokenlen,
"Subtract");
if (check_col(pinfo->cinfo, COL_INFO) )
- col_append_fstr(pinfo->cinfo, COL_INFO, " Subtract");
+ col_append_str(pinfo->cinfo, COL_INFO, " Subtract");
break;
}
break;
@@ -1214,7 +1214,7 @@ nextcontext:
tvb_offset, tokenlen,
"WildCard all");
if (check_col(pinfo->cinfo, COL_INFO) )
- col_append_fstr(pinfo->cinfo, COL_INFO, "=*");
+ col_append_str(pinfo->cinfo, COL_INFO, "=*");
break;
case '$':
@@ -1229,7 +1229,7 @@ nextcontext:
tvb_offset, tokenlen,
"WildCard any");
if (check_col(pinfo->cinfo, COL_INFO) )
- col_append_fstr(pinfo->cinfo, COL_INFO, "=$");
+ col_append_str(pinfo->cinfo, COL_INFO, "=$");
break;
default:
diff --git a/epan/dissectors/packet-sip.c b/epan/dissectors/packet-sip.c
index eaf4cf8bec..63424d409b 100644
--- a/epan/dissectors/packet-sip.c
+++ b/epan/dissectors/packet-sip.c
@@ -1562,15 +1562,6 @@ dissect_sip_common(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tr
guint resend_for_packet = 0;
int strlen_to_copy;
- /* Initialise stat info for passing to tap */
- stat_info = ep_alloc(sizeof(sip_info_value_t));
- stat_info->response_code = 0;
- stat_info->request_method = NULL;
- stat_info->reason_phrase = NULL;
- stat_info->resend = 0;
- stat_info->tap_call_id = NULL;
- stat_info->tap_from_addr = NULL;
- stat_info->tap_to_addr = NULL;
/*
* Note that "tvb_find_line_end()" will return a value that
@@ -1623,6 +1614,16 @@ dissect_sip_common(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tr
}
}
+ /* Initialise stat info for passing to tap */
+ stat_info = ep_alloc(sizeof(sip_info_value_t));
+ stat_info->response_code = 0;
+ stat_info->request_method = NULL;
+ stat_info->reason_phrase = NULL;
+ stat_info->resend = 0;
+ stat_info->tap_call_id = NULL;
+ stat_info->tap_from_addr = NULL;
+ stat_info->tap_to_addr = NULL;
+
if (check_col(pinfo->cinfo, COL_PROTOCOL))
col_set_str(pinfo->cinfo, COL_PROTOCOL, "SIP");
diff --git a/epan/dissectors/packet-tpkt.c b/epan/dissectors/packet-tpkt.c
index b53902a45b..fcd63f8f40 100644
--- a/epan/dissectors/packet-tpkt.c
+++ b/epan/dissectors/packet-tpkt.c
@@ -82,7 +82,7 @@ is_tpkt(tvbuff_t *tvb, int min_len)
return -1;
/* There should at least be 4 bytes left in the frame */
- if (!tvb_bytes_exist(tvb, 0, 4))
+ if (tvb_length(tvb) < 4)
return -1; /* there aren't */
/*
@@ -134,7 +134,7 @@ dissect_tpkt_encap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
* anyway.
*/
if (desegment && check_col(pinfo->cinfo, COL_INFO))
- col_add_str(pinfo->cinfo, COL_INFO, "");
+ col_set_str(pinfo->cinfo, COL_INFO, "");
while (tvb_reported_length_remaining(tvb, offset) != 0) {
/*
diff --git a/epan/dissectors/packet-uma.c b/epan/dissectors/packet-uma.c
index dd87d078c9..a1466ad148 100644
--- a/epan/dissectors/packet-uma.c
+++ b/epan/dissectors/packet-uma.c
@@ -1488,7 +1488,7 @@ dissect_uma(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
octet = tvb_get_guint8(tvb,offset);
proto_tree_add_item(uma_tree, hf_uma_urr_msg_type, tvb, offset, 1, FALSE);
if (check_col(pinfo->cinfo, COL_INFO))
- col_add_fstr(pinfo->cinfo, COL_INFO, "%s",val_to_str(octet, uma_urr_msg_type_vals, "Unknown URR (%u)"));
+ col_add_str(pinfo->cinfo, COL_INFO, val_to_str(octet, uma_urr_msg_type_vals, "Unknown URR (%u)"));
while ((msg_len + 1) > offset ){
offset++;
offset = dissect_uma_IE(tvb, pinfo, uma_tree, offset);
@@ -1500,7 +1500,7 @@ dissect_uma(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
octet = tvb_get_guint8(tvb,offset);
proto_tree_add_item(uma_tree, hf_uma_urlc_msg_type, tvb, offset, 1, FALSE);
if (check_col(pinfo->cinfo, COL_INFO)){
- col_add_fstr(pinfo->cinfo, COL_INFO, "%s ",val_to_str(octet, uma_urlc_msg_type_vals, "Unknown URLC (%u)"));
+ col_add_str(pinfo->cinfo, COL_INFO, val_to_str(octet, uma_urlc_msg_type_vals, "Unknown URLC (%u)"));
col_set_fence(pinfo->cinfo,COL_INFO);
}
offset++;