diff options
author | Guy Harris <guy@alum.mit.edu> | 2014-01-14 03:16:27 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2014-01-14 03:16:27 +0000 |
commit | 60f06e558a9226e6faa659d16eb589320ac206d2 (patch) | |
tree | 49fbc4bff3a12b308bf3e9260d6f0f46e3477328 /epan/dissectors/packet-bt-dht.c | |
parent | 3decdd5d9841eed596ba5b79cfd8afda8f2e3513 (diff) |
Don't cast away constness when you don't have to.
svn path=/trunk/; revision=54756
Diffstat (limited to 'epan/dissectors/packet-bt-dht.c')
-rw-r--r-- | epan/dissectors/packet-bt-dht.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/epan/dissectors/packet-bt-dht.c b/epan/dissectors/packet-bt-dht.c index 95de9c28bf..a2c08eec75 100644 --- a/epan/dissectors/packet-bt-dht.c +++ b/epan/dissectors/packet-bt-dht.c @@ -345,7 +345,8 @@ dissect_bencoded_dict_entry(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *ti; proto_tree *sub_tree; gboolean tohex; - char *key, *val; + const char *key; + const char *val; guint orig_offset = offset; key = NULL; @@ -362,7 +363,7 @@ dissect_bencoded_dict_entry(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, { case 'd': offset = dissect_bencoded_dict( tvb, pinfo, sub_tree, offset, "Value" ); - val = (char*)dict_str; + val = dict_str; break; case 'l': if( strcmp(key,"e")==0 ) @@ -373,7 +374,7 @@ dissect_bencoded_dict_entry(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, else { offset = dissect_bencoded_list( tvb, pinfo, sub_tree, offset, "Value" ); - val = (char*)list_str; + val = list_str; } break; case 'i': @@ -399,7 +400,7 @@ dissect_bencoded_dict_entry(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if(len == 4) { proto_tree_add_item(sub_tree, hf_ip, tvb, offset, len, ENC_BIG_ENDIAN); - val = (char*)tvb_ip_to_str(tvb, offset); + val = tvb_ip_to_str(tvb, offset); offset += len; } else { @@ -417,9 +418,9 @@ dissect_bencoded_dict_entry(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } if( strlen(key)==1 ) - key = (char*)val_to_str_const( key[0], short_key_name_value_string, key ); + key = val_to_str_const( key[0], short_key_name_value_string, key ); if( strlen(val)==1 ) - val = (char*)val_to_str_const( val[0], short_val_name_value_string, val ); + val = val_to_str_const( val[0], short_val_name_value_string, val ); proto_item_set_text( ti, "%s: %s", key, val ); proto_item_set_len( ti, offset-orig_offset ); |