aboutsummaryrefslogtreecommitdiffstats
path: root/asn1
diff options
context:
space:
mode:
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2005-06-26 19:56:52 +0000
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2005-06-26 19:56:52 +0000
commit1d0038e8c0b97f22ca359184defde2cc98a6fa48 (patch)
tree82a95df0652f9df59634fd7a7f8dd36026fa4ea7 /asn1
parent3f18d499f8ca5c32014c4762604ebf7a22caf4b9 (diff)
Get rid of the private "my_match_strval()" routine in many dissectors;
add a "match_strval_idx()" routine that does the same thing, and have "match_strval()" call it. Make those routines, and "val_to_str()", return a "const" pointer. Update dissectors as necessary to squelch compiler warnings produced by that. Use "val_to_str()" rather than using "match_strval()" and then, if the result is null, substituting a specific string. Clean up some other "match_strval()"/"val_to_str()" usages. Add a null pointer check in the NDPS dissector's "attribute_value()" routine, as it's not clear that "global_attribute_name" won't be null at that point. Make some global variables in the AFS4INT dissector local. Make some routines not used outside the module they're in static. Make some tables "static const". Clean up white space. Fix Gerald's address in some files. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@14786 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'asn1')
-rw-r--r--asn1/gsmmap/packet-gsm_map-template.c52
-rw-r--r--asn1/h245/packet-h245-template.c2
2 files changed, 15 insertions, 39 deletions
diff --git a/asn1/gsmmap/packet-gsm_map-template.c b/asn1/gsmmap/packet-gsm_map-template.c
index 5052f3dd41..2c5d9a86a8 100644
--- a/asn1/gsmmap/packet-gsm_map-template.c
+++ b/asn1/gsmmap/packet-gsm_map-template.c
@@ -151,27 +151,6 @@ unpack_digits(tvbuff_t *tvb, int offset){
#include "packet-gsm_map-fn.c"
-/* Stuff included from the "old" packet-gsm_map.c for tapping purposes */
-static gchar *
-my_match_strval(guint32 val, const value_string *vs, gint *idx)
-{
- gint i = 0;
-
- while (vs[i].strptr) {
- if (vs[i].value == val)
- {
- *idx = i;
- return(vs[i].strptr);
- }
-
- i++;
- }
-
- *idx = -1;
- return(NULL);
-}
-/* End includes from old" packet-gsm_map.c */
-
const value_string gsm_map_opr_code_strings[] = {
{ 2, "updateLocation" },
{ 3, "cancelLocation" },
@@ -1053,10 +1032,9 @@ dissect_gsm_map(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
{
proto_item *item=NULL;
proto_tree *tree=NULL;
- /* Used for gsm_map TAP */
- static gsm_map_tap_rec_t tap_rec;
- gint op_idx;
- gchar *str = NULL;
+ /* Used for gsm_map TAP */
+ static gsm_map_tap_rec_t tap_rec;
+ gint op_idx;
if (check_col(pinfo->cinfo, COL_PROTOCOL))
@@ -1064,26 +1042,24 @@ dissect_gsm_map(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
col_set_str(pinfo->cinfo, COL_PROTOCOL, "GSM MAP");
}
- top_tree = parent_tree;
- dissector_add("tcap.itu_ssn",pinfo->match_port, map_handle);
+ top_tree = parent_tree;
+ dissector_add("tcap.itu_ssn",pinfo->match_port, map_handle);
/* create display subtree for the protocol */
if(parent_tree){
- item = proto_tree_add_item(parent_tree, proto_gsm_map, tvb, 0, -1, FALSE);
- tree = proto_item_add_subtree(item, ett_gsm_map);
+ item = proto_tree_add_item(parent_tree, proto_gsm_map, tvb, 0, -1, FALSE);
+ tree = proto_item_add_subtree(item, ett_gsm_map);
}
dissect_gsm_map_GSMMAPPDU(FALSE, tvb, 0, pinfo, tree, -1);
- str = my_match_strval(opcode, gsm_map_opr_code_strings, &op_idx);
-
- tap_rec.invoke = FALSE;
- if ( gsmmap_pdu_type == 1 )
- tap_rec.invoke = TRUE;
- tap_rec.opr_code_idx = op_idx;
- tap_rec.size = gsm_map_pdu_size;
-
- tap_queue_packet(gsm_map_tap, pinfo, &tap_rec);
+ match_strval_idx(opcode, gsm_map_opr_code_strings, &op_idx);
+ tap_rec.invoke = FALSE;
+ if ( gsmmap_pdu_type == 1 )
+ tap_rec.invoke = TRUE;
+ tap_rec.opr_code_idx = op_idx;
+ tap_rec.size = gsm_map_pdu_size;
+ tap_queue_packet(gsm_map_tap, pinfo, &tap_rec);
}
static const value_string ssCode_vals[] = {
diff --git a/asn1/h245/packet-h245-template.c b/asn1/h245/packet-h245-template.c
index 66212567c8..ddb6b77ea7 100644
--- a/asn1/h245/packet-h245-template.c
+++ b/asn1/h245/packet-h245-template.c
@@ -200,7 +200,7 @@ static const value_string h245_AudioCapability_short_vals[] = {
/* To put the codec type only in COL_INFO when
an OLC is read */
-char* codec_type = NULL;
+const char* codec_type = NULL;
static char standard_oid_str[256];
static guint32 ipv4_address;
static guint32 ipv4_port;