Fix some: 'cast discards qualifiers from pointer target type' warnings

- Add const qualifier
- Remove some strange casts

svn path=/trunk/; revision=42131
This commit is contained in:
Jakub Zawadzki 2012-04-18 12:35:36 +00:00
parent 658fc3cb04
commit 68ec58d385
14 changed files with 27 additions and 28 deletions

View File

@ -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);

View File

@ -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;
}

View File

@ -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))

View File

@ -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) {

View File

@ -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 <space>");
@ -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 <space>");
@ -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 */

View File

@ -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){

View File

@ -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!? */

View File

@ -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:

View File

@ -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);

View File

@ -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;

View File

@ -2835,7 +2835,7 @@ tvb_find_line_end(tvbuff_t *tvb, const gint offset, int len, gint *next_offset,
/*
* Look either for a CR or an LF.
*/
eol_offset = tvb_pbrk_guint8(tvb, offset, len, (const guint8 *)"\r\n", &found_needle);
eol_offset = tvb_pbrk_guint8(tvb, offset, len, "\r\n", &found_needle);
if (eol_offset == -1) {
/*
* No CR or LF - line is presumably continued in next packet.
@ -2964,8 +2964,7 @@ tvb_find_line_end_unquoted(tvbuff_t *tvb, const gint offset, int len, gint *next
/*
* Look either for a CR, an LF, or a '"'.
*/
char_offset = tvb_pbrk_guint8(tvb, cur_offset, len,
(const guint8 *)"\r\n\"", &c);
char_offset = tvb_pbrk_guint8(tvb, cur_offset, len, "\r\n\"", &c);
}
if (char_offset == -1) {
/*

View File

@ -350,7 +350,7 @@ airpcap_get_validation_type(const gchar* name)
* Function used to retrieve the string name given an AirpcapValidationType,
* or NULL in case of error
*/
gchar*
const gchar*
airpcap_get_validation_name(AirpcapValidationType vt)
{
if(vt == AIRPCAP_VT_ACCEPT_EVERYTHING)

View File

@ -92,7 +92,7 @@ airpcap_get_validation_type(const gchar* name);
/*
* Function used to retrieve the string name given an AirpcapValidationType.
*/
gchar*
const gchar*
airpcap_get_validation_name(AirpcapValidationType vt);
/*

View File

@ -97,7 +97,7 @@ add_string_to_table(GtkWidget *list, guint *row, const gchar *title, const gchar
static void
add_string_to_list(GtkWidget *list, gchar *title, gchar *captured, gchar *displayed, gchar *marked)
add_string_to_list(GtkWidget *list, const gchar *title, gchar *captured, gchar *displayed, gchar *marked)
{
simple_list_append(list, 0, title, 1, captured, 2, displayed, 3, marked, -1);
}