From 68ec58d385e313d0c85f36cc94e76d73f6d2af2c Mon Sep 17 00:00:00 2001 From: Jakub Zawadzki Date: Wed, 18 Apr 2012 12:35:36 +0000 Subject: Fix some: 'cast discards qualifiers from pointer target type' warnings - Add const qualifier - Remove some strange casts svn path=/trunk/; revision=42131 --- epan/dissectors/packet-cups.c | 2 +- epan/dissectors/packet-dcerpc.c | 4 ++-- epan/dissectors/packet-gsm_rlcmac.c | 6 +++--- epan/dissectors/packet-ip.c | 2 +- epan/dissectors/packet-irc.c | 12 ++++++------ epan/dissectors/packet-megaco.c | 2 +- epan/dissectors/packet-pdcp-lte.c | 4 ++-- epan/dissectors/packet-rohc.c | 4 ++-- epan/dissectors/packet-roofnet.c | 4 ++-- epan/dissectors/packet-sdp.c | 4 ++-- 10 files changed, 22 insertions(+), 22 deletions(-) (limited to 'epan/dissectors') diff --git a/epan/dissectors/packet-cups.c b/epan/dissectors/packet-cups.c index 1a1d2ceb1d..29918aa1e5 100644 --- a/epan/dissectors/packet-cups.c +++ b/epan/dissectors/packet-cups.c @@ -336,7 +336,7 @@ get_unquoted_string(tvbuff_t *tvb, gint offset, gint *next_offset, guint *len) guint l = 0; gint o; - o = tvb_pbrk_guint8(tvb, offset, -1, (const guint8*)" \t\r\n", NULL); + o = tvb_pbrk_guint8(tvb, offset, -1, " \t\r\n", NULL); if (o != -1) { l = o - offset; s = tvb_get_ptr(tvb, offset, l); diff --git a/epan/dissectors/packet-dcerpc.c b/epan/dissectors/packet-dcerpc.c index e577a00d4e..e943d1f121 100644 --- a/epan/dissectors/packet-dcerpc.c +++ b/epan/dissectors/packet-dcerpc.c @@ -4057,13 +4057,13 @@ dissect_dcerpc_cn_rts (tvbuff_t *tvb, gint offset, packet_info *pinfo, switch (addrtype) { case RTS_IPV4: { const guint32 addr4 = tvb_get_ipv4(tvb, offset); - proto_tree_add_text(cn_rts_command_tree, tvb, offset, 4, "%s", (const char *)get_hostname(addr4)); + proto_tree_add_text(cn_rts_command_tree, tvb, offset, 4, "%s", get_hostname(addr4)); offset += 4; } break; case RTS_IPV6: { struct e_in6_addr addr6; tvb_get_ipv6(tvb, offset, &addr6); - proto_tree_add_text(cn_rts_command_tree, tvb, offset, 16, "%s", (const char *)get_hostname6(&addr6)); + proto_tree_add_text(cn_rts_command_tree, tvb, offset, 16, "%s", get_hostname6(&addr6)); offset += 16; } break; } diff --git a/epan/dissectors/packet-gsm_rlcmac.c b/epan/dissectors/packet-gsm_rlcmac.c index 991db7a02c..3b97b059e4 100644 --- a/epan/dissectors/packet-gsm_rlcmac.c +++ b/epan/dissectors/packet-gsm_rlcmac.c @@ -5993,7 +5993,7 @@ CSN_DESCR_END (PSI13_t) -typedef char* MT_Strings_t; +typedef const char* MT_Strings_t; static const MT_Strings_t szMT_Downlink[] = { "Invalid Message Type", /* 0x00 */ @@ -6078,7 +6078,7 @@ static const MT_Strings_t szMT_Uplink[] = { "PACKET_SI_STATUS", /* 0x0D */ }; -static char* +static const char* MT_DL_TextGet(guint8 mt) { if (mt < ElementsOf(szMT_Downlink)) @@ -6091,7 +6091,7 @@ MT_DL_TextGet(guint8 mt) } } -static char* +static const char* MT_UL_TextGet(guint8 mt) { if (mt < ElementsOf(szMT_Uplink)) diff --git a/epan/dissectors/packet-ip.c b/epan/dissectors/packet-ip.c index 74417091e6..51ed6205ad 100644 --- a/epan/dissectors/packet-ip.c +++ b/epan/dissectors/packet-ip.c @@ -1178,7 +1178,7 @@ dissect_ipopt_timestamp(const ip_tcp_opt *optp, tvbuff_t *tvb, proto_tree_add_text(field_tree, tvb, offset + optoffset, 8, "Address = %s, time stamp = %u", ((addr == 0) ? "-" : - (const char *)get_hostname(addr)), ts); + get_hostname(addr)), ts); optoffset += 8; } else { if (optlen < 4) { diff --git a/epan/dissectors/packet-irc.c b/epan/dissectors/packet-irc.c index 341b328da4..cf6efefd53 100644 --- a/epan/dissectors/packet-irc.c +++ b/epan/dissectors/packet-irc.c @@ -134,7 +134,7 @@ dissect_irc_request(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int off if (tvb_get_guint8(tvb, offset) == ':') { /* find the end of the prefix */ - eop_offset = tvb_pbrk_guint8(tvb, offset+1, linelen-1, (const guint8 *)" ", &found_needle); + eop_offset = tvb_pbrk_guint8(tvb, offset+1, linelen-1, " ", &found_needle); if (eop_offset == -1) { expert_add_info_format(pinfo, request_item, PI_MALFORMED, PI_ERROR, "Prefix missing ending "); @@ -157,7 +157,7 @@ dissect_irc_request(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int off return; } - eoc_offset = tvb_pbrk_guint8(tvb, offset, linelen-offset, (const guint8 *)" ", &found_needle); + eoc_offset = tvb_pbrk_guint8(tvb, offset, linelen-offset, " ", &found_needle); if (eoc_offset == -1) { proto_tree_add_item(request_tree, hf_irc_request_command, tvb, offset, linelen-offset, ENC_ASCII|ENC_NA); @@ -211,7 +211,7 @@ dissect_irc_request(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int off while(offset < end_offset) { - eocp_offset = tvb_pbrk_guint8(tvb, offset, linelen-offset, (const guint8 *)" ", &found_needle); + eocp_offset = tvb_pbrk_guint8(tvb, offset, linelen-offset, " ", &found_needle); tag_start_offset = tvb_pbrk_guint8(tvb, offset, linelen-offset, TAG_DELIMITER, &found_tag_needle); /* Create subtree when the first parameter is found */ @@ -302,7 +302,7 @@ dissect_irc_response(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int of if (tvb_get_guint8(tvb, offset) == ':') { /* find the end of the prefix */ - eop_offset = tvb_pbrk_guint8(tvb, offset+1, linelen-1, (const guint8 *)" ", &found_needle); + eop_offset = tvb_pbrk_guint8(tvb, offset+1, linelen-1, " ", &found_needle); if (eop_offset == -1) { expert_add_info_format(pinfo, response_item, PI_MALFORMED, PI_ERROR, "Prefix missing ending "); @@ -325,7 +325,7 @@ dissect_irc_response(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int of return; } - eoc_offset = tvb_pbrk_guint8(tvb, offset, linelen-offset, (const guint8 *)" ", &found_needle); + eoc_offset = tvb_pbrk_guint8(tvb, offset, linelen-offset, " ", &found_needle); if (eoc_offset == -1) { proto_tree_add_item(response_tree, hf_irc_response_command, tvb, offset, linelen-offset, ENC_ASCII|ENC_NA); @@ -383,7 +383,7 @@ dissect_irc_response(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int of while(offset < end_offset) { - eocp_offset = tvb_pbrk_guint8(tvb, offset, linelen-offset, (const guint8 *)" ", &found_needle); + eocp_offset = tvb_pbrk_guint8(tvb, offset, linelen-offset, " ", &found_needle); tag_start_offset = tvb_pbrk_guint8(tvb, offset, linelen-offset, TAG_DELIMITER, &found_tag_needle); /* Create subtree when the first parameter is found */ diff --git a/epan/dissectors/packet-megaco.c b/epan/dissectors/packet-megaco.c index edd374b76b..f05cd1976b 100644 --- a/epan/dissectors/packet-megaco.c +++ b/epan/dissectors/packet-megaco.c @@ -3314,7 +3314,7 @@ static gint megaco_tvb_find_token(tvbuff_t* tvb, gint offset, gint maxlength){ guchar needle; do { - pos = tvb_pbrk_guint8(tvb, pos + 1, maxlength,(guint8*)"{}", &needle); + pos = tvb_pbrk_guint8(tvb, pos + 1, maxlength, "{}", &needle); if(pos == -1) return -1; switch(needle){ diff --git a/epan/dissectors/packet-pdcp-lte.c b/epan/dissectors/packet-pdcp-lte.c index d16f122e02..48c41d9dbf 100644 --- a/epan/dissectors/packet-pdcp-lte.c +++ b/epan/dissectors/packet-pdcp-lte.c @@ -1036,8 +1036,8 @@ static int dissect_pdcp_ir_packet(proto_tree *tree, /* Add summary to root item */ proto_item_append_text(root_ti, " (prot=%s: %s -> %s)", val_to_str_const(protocol, ip_protocol_vals, "Unknown"), - (char*)get_hostname(source), - (char*)get_hostname(dest)); + get_hostname(source), + get_hostname(dest)); } /* UDP static part. TODO: also check protocol from last part!? */ diff --git a/epan/dissectors/packet-rohc.c b/epan/dissectors/packet-rohc.c index 8612dc5685..8401e9e3b8 100644 --- a/epan/dissectors/packet-rohc.c +++ b/epan/dissectors/packet-rohc.c @@ -1151,8 +1151,8 @@ dissect_rohc_ir_rtp_udp_profile_static(tvbuff_t *tvb, proto_tree *tree, packet_i /* Add summary to root item */ proto_item_append_text(ipv4_item, " (prot=%s: %s -> %s)", val_to_str_ext_const(protocol, &ipproto_val_ext, "Unknown"), - (char*)get_hostname(source), - (char*)get_hostname(dest)); + get_hostname(source), + get_hostname(dest)); } break; case 6: diff --git a/epan/dissectors/packet-roofnet.c b/epan/dissectors/packet-roofnet.c index a4db0b1366..56601151ca 100644 --- a/epan/dissectors/packet-roofnet.c +++ b/epan/dissectors/packet-roofnet.c @@ -147,8 +147,8 @@ static void dissect_roofnet_link(proto_tree *tree, tvbuff_t *tvb, guint *offset, it = proto_tree_add_text(tree, tvb, *offset, ROOFNET_LINK_LEN, "link: %u, src: %s, dst: %s", link, - (char*)get_hostname(addr_src), - (char*)get_hostname(addr_dst)); + get_hostname(addr_src), + get_hostname(addr_dst)); subtree= proto_item_add_subtree(it, ett_roofnet_link); proto_tree_add_ipv4(subtree, hf_roofnet_link_src, tvb, *offset, 4, addr_src); diff --git a/epan/dissectors/packet-sdp.c b/epan/dissectors/packet-sdp.c index a11bf0192c..8bb1e260ba 100644 --- a/epan/dissectors/packet-sdp.c +++ b/epan/dissectors/packet-sdp.c @@ -1035,7 +1035,7 @@ static void dissect_sdp_session_attribute(tvbuff_t *tvb, packet_info * pinfo, pr offset = next_offset + 1; if (strcmp((char*)field_name, "ipbcp") == 0) { - offset = tvb_pbrk_guint8(tvb,offset,-1,(guint8 *)"0123456789", NULL); + offset = tvb_pbrk_guint8(tvb,offset,-1,"0123456789", NULL); if (offset == -1) return; @@ -1049,7 +1049,7 @@ static void dissect_sdp_session_attribute(tvbuff_t *tvb, packet_info * pinfo, pr proto_tree_add_item(sdp_session_attribute_tree,hf_ipbcp_version,tvb,offset,tokenlen,ENC_ASCII|ENC_NA); - offset = tvb_pbrk_guint8(tvb,offset,-1,(guint8 *)"ABCDEFGHIJKLMNOPQRSTUVWXYZ", NULL); + offset = tvb_pbrk_guint8(tvb,offset,-1,"ABCDEFGHIJKLMNOPQRSTUVWXYZ", NULL); if (offset == -1) return; -- cgit v1.2.3