From 8fd3ee05600dd7d0e6434e7eb824932c52000ce3 Mon Sep 17 00:00:00 2001 From: Stephen Fisher Date: Wed, 28 Mar 2007 21:55:11 +0000 Subject: Remove almost all of the casts I committed recently and in place of them, add -Wno-pointer-sign to CFLAGS when gcc will accept it. svn path=/trunk/; revision=21253 --- capture_sync.c | 6 +- configure.in | 17 +++++ epan/addr_resolv.c | 2 +- epan/column-utils.c | 2 +- epan/dissectors/packet-3g-a11.c | 4 +- epan/dissectors/packet-afp.c | 8 +-- epan/dissectors/packet-ajp13.c | 4 +- epan/dissectors/packet-bittorrent.c | 12 ++-- epan/dissectors/packet-cops.c | 8 +-- epan/dissectors/packet-dcm.c | 6 +- epan/dissectors/packet-dcom.c | 2 +- epan/dissectors/packet-dhcp-failover.c | 4 +- epan/dissectors/packet-dhcpv6.c | 2 +- epan/dissectors/packet-diameter.c | 4 +- epan/dissectors/packet-distcc.c | 10 +-- epan/dissectors/packet-dns.c | 40 ++++++------ epan/dissectors/packet-dsi.c | 2 +- epan/dissectors/packet-edonkey.c | 2 +- epan/dissectors/packet-extreme.c | 8 +-- epan/dissectors/packet-fcdns.c | 6 +- epan/dissectors/packet-fcswils.c | 8 +-- epan/dissectors/packet-fix.c | 6 +- epan/dissectors/packet-ftp.c | 4 +- epan/dissectors/packet-fw1.c | 2 +- epan/dissectors/packet-gtp.c | 4 +- epan/dissectors/packet-hsrp.c | 2 +- epan/dissectors/packet-iax2.c | 6 +- epan/dissectors/packet-icep.c | 2 +- epan/dissectors/packet-igap.c | 2 +- epan/dissectors/packet-image-gif.c | 2 +- epan/dissectors/packet-image-jfif.c | 6 +- epan/dissectors/packet-ipdc.c | 2 +- epan/dissectors/packet-ipp.c | 10 +-- epan/dissectors/packet-iscsi.c | 6 +- epan/dissectors/packet-jxta.c | 24 +++---- epan/dissectors/packet-kismet.c | 8 +-- epan/dissectors/packet-megaco.c | 10 +-- epan/dissectors/packet-mmse.c | 10 +-- epan/dissectors/packet-mount.c | 10 +-- epan/dissectors/packet-msrp.c | 10 +-- epan/dissectors/packet-rsvp.c | 4 +- epan/dissectors/packet-smb.c | 110 ++++++++++++++++----------------- epan/dissectors/packet-smb2.c | 2 +- epan/dissectors/packet-smtp.c | 8 +-- epan/dissectors/packet-sna.c | 2 +- epan/dissectors/packet-wsp.c | 4 +- epan/dissectors/packet-ymsg.c | 2 +- epan/proto.c | 12 ++-- epan/req_resp_hdrs.c | 8 +-- epan/sigcomp-udvm.c | 4 +- epan/sigcomp_state_hdlr.c | 4 +- epan/stats_tree.c | 30 ++++----- epan/tvbparse.c | 2 +- file.c | 6 +- gtk/find_dlg.c | 4 +- gtk/follow_dlg.c | 2 +- gtk/proto_draw.c | 20 +++--- gtk/recent.c | 4 +- gtk/stats_tree_stat.c | 12 ++-- plugins/agentx/packet-agentx.c | 2 +- plugins/asn1/packet-asn1.c | 68 ++++++++++---------- plugins/irda/packet-irda.c | 14 ++--- plugins/mgcp/packet-mgcp.c | 8 +-- plugins/opsi/packet-opsi.c | 2 +- plugins/sbus/packet-sbus.c | 4 +- plugins/stats_tree/pinfo_stats_tree.c | 24 +++---- print.c | 8 +-- tap-stats_tree.c | 12 ++-- text2pcap.c | 6 +- wiretap/configure.in | 17 +++++ wiretap/iseries.c | 34 +++++----- 71 files changed, 378 insertions(+), 344 deletions(-) diff --git a/capture_sync.c b/capture_sync.c index b6fba3e1a7..4b67d0cd58 100644 --- a/capture_sync.c +++ b/capture_sync.c @@ -562,7 +562,7 @@ pipe_read_block(int pipe, char *indicator, int len, char *msg) { /* read header (indicator and 3-byte length) */ - newly = pipe_read_bytes(pipe, (char*)header, 4); + newly = pipe_read_bytes(pipe, header, 4); if(newly != 4) { g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG, "read %d failed to read header: %u", pipe, newly); @@ -675,10 +675,10 @@ sync_pipe_input_cb(gint source, gpointer user_data) break; case SP_ERROR_MSG: /* convert primary message */ - pipe_convert_header((guchar*)buffer, 4, &indicator, &primary_len); + pipe_convert_header(buffer, 4, &indicator, &primary_len); primary_msg = buffer+4; /* convert secondary message */ - pipe_convert_header((guchar*)primary_msg + primary_len, 4, &indicator, &secondary_len); + pipe_convert_header(primary_msg + primary_len, 4, &indicator, &secondary_len); secondary_msg = primary_msg + primary_len + 4; /* message output */ capture_input_error_message(capture_opts, primary_msg, secondary_msg); diff --git a/configure.in b/configure.in index 70f07c33bc..1aeba1bb27 100644 --- a/configure.in +++ b/configure.in @@ -191,6 +191,23 @@ else fi rm -rf conftest* +AC_MSG_CHECKING(to see if we can add '-Wno-pointer-sign' to CFLAGS) +if test x$GCC == xyes ; then + # some versions of GCC support this directive + rm -rf conftest* + echo "int foo;" >>conftest.c + if $CC -c -o conftest.o conftest.c -Wno-pointer-sign > /dev/null 2>&1 ; then + CFLAGS="$CFLAGS -Wno-pointer-sign" + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + fi +else + # non-gcc compilers do not support this directive + AC_MSG_RESULT(no) +fi +rm -rf conftest* + AC_ARG_WITH(warnings-as-errors, [ --with-warnings-as-errors Treat warnings as errors (if using gcc). [default=no]], [ diff --git a/epan/addr_resolv.c b/epan/addr_resolv.c index 8c1544aced..85d2f02b05 100644 --- a/epan/addr_resolv.c +++ b/epan/addr_resolv.c @@ -553,7 +553,7 @@ static const gchar *solve_address_to_name(address *addr) return get_hostname6(&ipv6_addr); case AT_STRINGZ: - return (gchar*)addr->data; + return addr->data; default: return NULL; diff --git a/epan/column-utils.c b/epan/column-utils.c index cea5fced43..1931fec65c 100644 --- a/epan/column-utils.c +++ b/epan/column-utils.c @@ -930,7 +930,7 @@ col_set_addr(packet_info *pinfo, int col, address *addr, gboolean is_res, /* XXX - should be done in "address_to_str_buf()", but that routine doesn't know COL_MAX_LEN; it should be changed to take the maximum length as an argument. */ - strncpy(pinfo->cinfo->col_buf[col], (gchar*)addr->data, COL_MAX_LEN); + strncpy(pinfo->cinfo->col_buf[col], addr->data, COL_MAX_LEN); pinfo->cinfo->col_buf[col][COL_MAX_LEN - 1] = '\0'; break; diff --git a/epan/dissectors/packet-3g-a11.c b/epan/dissectors/packet-3g-a11.c index ec5623954d..5a86226663 100644 --- a/epan/dissectors/packet-3g-a11.c +++ b/epan/dissectors/packet-3g-a11.c @@ -496,7 +496,7 @@ decode_sse(proto_tree* ext_tree, tvbuff_t* tvb, int offset, size_t ext_len) if(msid_len > A11_MSG_MSID_ELEM_LEN_MAX) { - p_msid = (guint8 *)"MSID is too long"; + p_msid = "MSID is too long"; }else { /* Decode the BCD digits */ @@ -527,7 +527,7 @@ decode_sse(proto_tree* ext_tree, tvbuff_t* tvb, int offset, size_t ext_len) proto_tree_add_string - (ext_tree, hf_a11_ses_msid, tvb, msid_start_offset, msid_len, (gchar *)p_msid); + (ext_tree, hf_a11_ses_msid, tvb, msid_start_offset, msid_len, p_msid); return; } diff --git a/epan/dissectors/packet-afp.c b/epan/dissectors/packet-afp.c index 8fb00ac0fc..a4a9fd4fb1 100644 --- a/epan/dissectors/packet-afp.c +++ b/epan/dissectors/packet-afp.c @@ -1590,7 +1590,7 @@ name_in_bitmap(tvbuff_t *tvb, gint offset, guint16 bitmap, int isdir) tp_ofs = nameoff +org_offset; len = tvb_get_guint8(tvb, tp_ofs); tp_ofs++; - name = (gchar*)tvb_get_ephemeral_string(tvb, tp_ofs, + name = tvb_get_ephemeral_string(tvb, tp_ofs, len); return name; } @@ -1629,7 +1629,7 @@ name_in_bitmap(tvbuff_t *tvb, gint offset, guint16 bitmap, int isdir) tp_ofs = nameoff +org_offset +4; len16 = tvb_get_ntohs(tvb, tp_ofs); tp_ofs += 2; - name = (gchar*)tvb_get_ephemeral_string(tvb, tp_ofs, + name = tvb_get_ephemeral_string(tvb, tp_ofs, len16); return name; } @@ -2393,7 +2393,7 @@ dissect_query_afp_login(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_tree_add_item(tree, hf_afp_AFPVersion, tvb, offset, 1,FALSE); offset += len +1; len_uam = tvb_get_guint8(tvb, offset); - uam = (char*)tvb_get_ptr(tvb, offset +1, len_uam); + uam = tvb_get_ptr(tvb, offset +1, len_uam); proto_tree_add_item(tree, hf_afp_UAM, tvb, offset, 1,FALSE); offset += len_uam +1; @@ -2428,7 +2428,7 @@ dissect_query_afp_login_ext(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *t offset += len +1; len_uam = tvb_get_guint8(tvb, offset); - uam = (char*)tvb_get_ptr(tvb, offset +1, len_uam); + uam = tvb_get_ptr(tvb, offset +1, len_uam); proto_tree_add_item(tree, hf_afp_UAM, tvb, offset, 1,FALSE); offset += len_uam +1; diff --git a/epan/dissectors/packet-ajp13.c b/epan/dissectors/packet-ajp13.c index e5fb99c8e4..bf73b42af5 100644 --- a/epan/dissectors/packet-ajp13.c +++ b/epan/dissectors/packet-ajp13.c @@ -378,7 +378,7 @@ display_rsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ajp13_tree) /* HEADER VALUE */ orig_pos = pos; - hval_len = get_nstring(tvb, pos, (guint8*)hval, sizeof hval); + hval_len = get_nstring(tvb, pos, hval, sizeof hval); pos+=hval_len+2; dp = pos - orig_pos; @@ -629,7 +629,7 @@ display_req_forward(tvbuff_t *tvb, packet_info *pinfo, */ orig_pos = pos; hval=ep_alloc(8192); - hval_len = get_nstring(tvb, pos, (guint8*)hval, 8192); + hval_len = get_nstring(tvb, pos, hval, 8192); pos+=hval_len+2; dp = pos - orig_pos; diff --git a/epan/dissectors/packet-bittorrent.c b/epan/dissectors/packet-bittorrent.c index f4d67158e9..43da881a68 100644 --- a/epan/dissectors/packet-bittorrent.c +++ b/epan/dissectors/packet-bittorrent.c @@ -199,7 +199,7 @@ static guint get_bittorrent_pdu_length(packet_info *pinfo _U_, tvbuff_t *tvb, in guint32 length; if (tvb_get_guint8(tvb, offset) == 19 && - tvb_memeql(tvb, offset + 1, (guint8*)"BitTorrent protocol", 19) == 0) { + tvb_memeql(tvb, offset + 1, "BitTorrent protocol", 19) == 0) { /* Return the length of a Handshake message */ return 1 + /* pstrlen */ 19 + /* pstr */ @@ -540,7 +540,7 @@ static void dissect_bittorrent_message (tvbuff_t *tvb, packet_info *pinfo, proto for ( i=0 ; amp_messages[i].name ; i++ ) { if (strlen(amp_messages[i].name)==typelen && tvb_memeql(tvb, offset + BITTORRENT_HEADER_LENGTH + 4, - (guint8*)amp_messages[i].name, strlen(amp_messages[i].name))==0) { + amp_messages[i].name, strlen(amp_messages[i].name))==0) { prio = tvb_get_guint8(tvb, offset + BITTORRENT_HEADER_LENGTH + 4 + typelen); if (prio==0 || prio==1 || prio==2) { @@ -706,11 +706,11 @@ static void dissect_bittorrent_welcome (tvbuff_t *tvb, packet_info *pinfo _U_, p if(decode_client_information) { for(i = 0; peer_id[i].id[0] != '\0'; ++i) { - if(tvb_memeql(tvb, offset, (guint8*)peer_id[i].id, strlen(peer_id[i].id)) == 0) { + if(tvb_memeql(tvb, offset, peer_id[i].id, strlen(peer_id[i].id)) == 0) { /* The version number is 4 numeric characters for the client ids beginning with '-' and 3 characters for the rest. */ - version = (char*)tvb_get_string(tvb, offset + strlen(peer_id[i].id), + version = tvb_get_string(tvb, offset + strlen(peer_id[i].id), (peer_id[i].id[0] == '-') ? 4 : 3); proto_tree_add_text(tree, tvb, offset, 20, "Client is %s v%s", peer_id[i].name, @@ -739,7 +739,7 @@ static void dissect_bittorrent_tcp_pdu (tvbuff_t *tvb, packet_info *pinfo, proto tree = proto_item_add_subtree(ti, ett_bittorrent); if (tvb_get_guint8(tvb, 0) == 19 && - tvb_memeql(tvb, 1, (guint8*)"BitTorrent protocol", 19) == 0) { + tvb_memeql(tvb, 1, "BitTorrent protocol", 19) == 0) { dissect_bittorrent_welcome(tvb, pinfo, tree); } else { dissect_bittorrent_message(tvb, pinfo, tree); @@ -764,7 +764,7 @@ static gboolean test_bittorrent_packet (tvbuff_t *tvb, packet_info *pinfo, if (tvb_bytes_exist(tvb, 0, 20) && tvb_get_guint8(tvb, 0) == 19 && - tvb_memeql(tvb, 1, (guint8*)"BitTorrent protocol", 19) == 0) { + tvb_memeql(tvb, 1, "BitTorrent protocol", 19) == 0) { conversation = conversation_new (pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0); conversation_set_dissector(conversation, dissector_handle); diff --git a/epan/dissectors/packet-cops.c b/epan/dissectors/packet-cops.c index ac3821f9d7..fe1197406b 100644 --- a/epan/dissectors/packet-cops.c +++ b/epan/dissectors/packet-cops.c @@ -1361,7 +1361,7 @@ static guchar*format_asn_value (struct variable_list *variable, subid_t *variabl variable->type=mib_to_asn_type(subtree->type); if (!sprint_realloc_by_type(&buf, &buf_len, &out_len, FALSE, variable, subtree->enums, subtree->hint, NULL)) - g_snprintf((char*)buf,SPRINT_MAX_LEN,"%s","sprint_realloc_by_type failed"); + g_snprintf(buf,SPRINT_MAX_LEN,"%s","sprint_realloc_by_type failed"); return buf; } @@ -1448,7 +1448,7 @@ static int decode_cops_pr_asn1_data(tvbuff_t *tvb,packet_info *pinfo, guint32 of value = vb_integer_value; variable.val.integer = &value; variable.val_len = vb_length ; - vb_display_string=(gchar*)format_asn_value(&variable, + vb_display_string=format_asn_value(&variable, last_decoded_prid_oid,last_decoded_prid_oid_length,ASN_INTEGER); proto_tree_add_text(tree, tvb, vb_value_start, length, @@ -1475,7 +1475,7 @@ static int decode_cops_pr_asn1_data(tvbuff_t *tvb,packet_info *pinfo, guint32 of variable.val.integer = &value; variable.val_len = vb_length; - vb_display_string=(gchar*)format_asn_value(&variable, + vb_display_string=format_asn_value(&variable, last_decoded_prid_oid,last_decoded_prid_oid_length,ASN_UINTEGER); proto_tree_add_text(tree,tvb, vb_value_start, length, "Value %s: %s",vb_type_name, vb_display_string); @@ -1504,7 +1504,7 @@ static int decode_cops_pr_asn1_data(tvbuff_t *tvb,packet_info *pinfo, guint32 of variable.type = 0; variable.val.string = vb_octet_string; variable.val_len = vb_length; - vb_display_string = (gchar*)format_asn_value(&variable, + vb_display_string = format_asn_value(&variable, last_decoded_prid_oid,last_decoded_prid_oid_length,ASN_OCTET_STR); proto_tree_add_text(tree, tvb, vb_value_start, length, "Value: %s (ASN.1 type from packet: %s)", vb_display_string, vb_type_name); diff --git a/epan/dissectors/packet-dcm.c b/epan/dissectors/packet-dcm.c index 86d1fd6a12..930073e232 100644 --- a/epan/dissectors/packet-dcm.c +++ b/epan/dissectors/packet-dcm.c @@ -529,7 +529,7 @@ dcm_tag2str(guint16 grp, guint16 elm, guint8 syntax, tvbuff_t *tvb, int offset, p+=MIN(MAX_BUF_LEN-(p-buf), g_snprintf(p, MAX_BUF_LEN-(p-buf), "%s", dtag->desc)); if (vr > 0) { - vval = (guint8*)tvb_format_text(tvb, vr, 2); + vval = tvb_format_text(tvb, vr, 2); p+=MIN(MAX_BUF_LEN-(p-buf), g_snprintf(p, MAX_BUF_LEN-(p-buf), " [%s]", vval)); } @@ -537,7 +537,7 @@ dcm_tag2str(guint16 grp, guint16 elm, guint8 syntax, tvbuff_t *tvb, int offset, switch (tr > 0 ? tr : dtag->dtype) { case DCM_TSTR: default: /* try ascii */ - vval = (guint8*)tvb_format_text(tvb, offset, len); + vval = tvb_format_text(tvb, offset, len); p+=MIN(MAX_BUF_LEN-(p-buf), g_snprintf(p, MAX_BUF_LEN-(p-buf), " %s", vval)); break; @@ -639,7 +639,7 @@ dissect_dcm_assoc(dcmState_t *dcm_data, proto_item *ti, tvbuff_t *tvb, int offse proto_tree_add_item(dcm_tree, hf_dcm_pdi_syntax, tvb, offset, len > 65 ? 65 : len, FALSE); if (reply && di && di->valid) { name = tvb_get_ephemeral_string(tvb, offset, len); - dcm_setSyntax(di, (char*)name); + dcm_setSyntax(di, name); } reply = 0; offset += len; diff --git a/epan/dissectors/packet-dcom.c b/epan/dissectors/packet-dcom.c index f5dc920fe8..2320f5b7e6 100644 --- a/epan/dissectors/packet-dcom.c +++ b/epan/dissectors/packet-dcom.c @@ -1971,7 +1971,7 @@ dissect_dcom_OBJREF(tvbuff_t *tvb, gint offset, packet_info *pinfo, /* add interface instance to database (we currently only handle IPv4) */ if(pinfo->net_src.type == AT_IPv4) { dcom_if = dcom_interface_new(pinfo, - (guint8*)ip, + ip, &iid, oxid, oid, &ipid); } } diff --git a/epan/dissectors/packet-dhcp-failover.c b/epan/dissectors/packet-dhcp-failover.c index a37d1dfa6b..c271af9b75 100644 --- a/epan/dissectors/packet-dhcp-failover.c +++ b/epan/dissectors/packet-dhcp-failover.c @@ -584,7 +584,7 @@ dissect_dhcpfo_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) format_text(client_identifier_str, option_length)); proto_tree_add_string(option_tree, hf_dhcpfo_client_identifier, tvb, offset, - option_length, (char*)client_identifier_str); + option_length, client_identifier_str); break; case DHCP_FO_PD_CLIENT_HARDWARE_ADDRESS: @@ -661,7 +661,7 @@ dissect_dhcpfo_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) format_text(vendor_class_str, option_length)); proto_tree_add_string(option_tree, hf_dhcpfo_vendor_class, tvb, offset, - option_length, (char*)vendor_class_str); + option_length, vendor_class_str); break; case DHCP_FO_PD_LEASE_EXPIRATION_TIME: diff --git a/epan/dissectors/packet-dhcpv6.c b/epan/dissectors/packet-dhcpv6.c index 2c021286d5..a942cf5b68 100644 --- a/epan/dissectors/packet-dhcpv6.c +++ b/epan/dissectors/packet-dhcpv6.c @@ -579,7 +579,7 @@ dhcpv6_option(tvbuff_t *tvb, packet_info *pinfo, proto_tree *bp_tree, status_code); if (optlen - 2 > 0) { - status_message = (char*)tvb_get_ephemeral_string(tvb, off + 2, optlen - 2); + status_message = tvb_get_ephemeral_string(tvb, off + 2, optlen - 2); proto_tree_add_text(subtree, tvb, off + 2, optlen - 2, "Status Message: %s", status_message); diff --git a/epan/dissectors/packet-diameter.c b/epan/dissectors/packet-diameter.c index f67e3a5ecd..a302f04f3b 100644 --- a/epan/dissectors/packet-diameter.c +++ b/epan/dissectors/packet-diameter.c @@ -1871,7 +1871,7 @@ static void dissect_avps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *avp_tree data = tvb_get_ptr(tvb, offset, avpDataLength); proto_tree_add_string_format(avpi_tree, hf_diameter_avp_data_string, - tvb, offset, avpDataLength, (char*)data, + tvb, offset, avpDataLength, data, "Identity: %*.*s", (int)avpDataLength, (int)avpDataLength, data); @@ -1883,7 +1883,7 @@ static void dissect_avps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *avp_tree data = tvb_get_ptr(tvb, offset, avpDataLength); proto_tree_add_string_format(avpi_tree, hf_diameter_avp_data_string, - tvb, offset, avpDataLength, (char*)data, + tvb, offset, avpDataLength, data, "UTF8String: %*.*s", (int)avpDataLength, (int)avpDataLength, data); diff --git a/epan/dissectors/packet-distcc.c b/epan/dissectors/packet-distcc.c index d7d854bf7f..f39a5cf89b 100644 --- a/epan/dissectors/packet-distcc.c +++ b/epan/dissectors/packet-distcc.c @@ -158,7 +158,7 @@ dissect_distcc_argv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int argv_len=len>255?255:len; - tvb_memcpy(tvb, (guint8*)argv, offset, argv_len); + tvb_memcpy(tvb, argv, offset, argv_len); argv[argv_len]=0; proto_tree_add_item(tree, hf_distcc_argv, tvb, offset, len, FALSE); @@ -189,7 +189,7 @@ dissect_distcc_serr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int argv_len=len>255?255:len; - tvb_memcpy(tvb, (guint8*)argv, offset, argv_len); + tvb_memcpy(tvb, argv, offset, argv_len); argv[argv_len]=0; proto_tree_add_item(tree, hf_distcc_serr, tvb, offset, len, FALSE); @@ -220,7 +220,7 @@ dissect_distcc_sout(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int argv_len=len>255?255:len; - tvb_memcpy(tvb, (guint8*)argv, offset, argv_len); + tvb_memcpy(tvb, argv, offset, argv_len); argv[argv_len]=0; proto_tree_add_item(tree, hf_distcc_sout, tvb, offset, len, FALSE); @@ -313,11 +313,11 @@ dissect_distcc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) } /* read the token */ - tvb_memcpy(tvb, (guint8*)token, offset, 4); + tvb_memcpy(tvb, token, offset, 4); offset+=4; /* read the parameter */ - sscanf((char*)tvb_get_ptr(tvb, offset, 8), "%08x", ¶meter); + sscanf(tvb_get_ptr(tvb, offset, 8), "%08x", ¶meter); offset+=8; if(!strncmp(token, "DIST", 4)){ diff --git a/epan/dissectors/packet-dns.c b/epan/dissectors/packet-dns.c index fccf85c1db..7f564c6b8a 100644 --- a/epan/dissectors/packet-dns.c +++ b/epan/dissectors/packet-dns.c @@ -820,7 +820,7 @@ dissect_dns_query(tvbuff_t *tvb, int offset, int dns_data_offset, * The name might contain octets that aren't printable characters, * format it for display. */ - name_out = format_text((guchar*)name, strlen(name)); + name_out = format_text(name, strlen(name)); if (cinfo != NULL) { col_append_fstr(cinfo, COL_INFO, " %s %s", type_name, name_out); @@ -1051,7 +1051,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offset, int dns_data_offset, * The name might contain octets that aren't printable characters, * format it for display. */ - name_out = format_text((guchar*)name, strlen(name)); + name_out = format_text(name, strlen(name)); if (type != T_OPT) { trr = proto_tree_add_text(dns_tree, tvb, offset, (data_offset - data_start) + data_len, @@ -1101,7 +1101,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offset, int dns_data_offset, int ns_name_len; ns_name_len = get_dns_name(tvb, cur_offset, dns_data_offset, &ns_name); - name_out = format_text((guchar*)ns_name, strlen(ns_name)); + name_out = format_text(ns_name, strlen(ns_name)); if (cinfo != NULL) col_append_fstr(cinfo, COL_INFO, " %s", name_out); if (dns_tree != NULL) { @@ -1118,7 +1118,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offset, int dns_data_offset, int cname_len; cname_len = get_dns_name(tvb, cur_offset, dns_data_offset, &cname); - name_out = format_text((guchar*)cname, strlen(cname)); + name_out = format_text(cname, strlen(cname)); if (cinfo != NULL) col_append_fstr(cinfo, COL_INFO, " %s", name_out); if (dns_tree != NULL) { @@ -1142,7 +1142,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offset, int dns_data_offset, guint32 minimum; mname_len = get_dns_name(tvb, cur_offset, dns_data_offset, &mname); - name_out = format_text((guchar*)mname, strlen(mname)); + name_out = format_text(mname, strlen(mname)); if (cinfo != NULL) col_append_fstr(cinfo, COL_INFO, " %s", name_out); if (dns_tree != NULL) { @@ -1152,7 +1152,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offset, int dns_data_offset, cur_offset += mname_len; rname_len = get_dns_name(tvb, cur_offset, dns_data_offset, &rname); - name_out = format_text((guchar*)rname, strlen(rname)); + name_out = format_text(rname, strlen(rname)); proto_tree_add_text(rr_tree, tvb, cur_offset, rname_len, "Responsible authority's mailbox: %s", name_out); cur_offset += rname_len; @@ -1190,7 +1190,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offset, int dns_data_offset, int pname_len; pname_len = get_dns_name(tvb, cur_offset, dns_data_offset, &pname); - name_out = format_text((guchar*)pname, strlen(pname)); + name_out = format_text(pname, strlen(pname)); if (cinfo != NULL) col_append_fstr(cinfo, COL_INFO, " %s", name_out); if (dns_tree != NULL) { @@ -1323,7 +1323,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offset, int dns_data_offset, preference = tvb_get_ntohs(tvb, cur_offset); mx_name_len = get_dns_name(tvb, cur_offset + 2, dns_data_offset, &mx_name); - name_out = format_text((guchar*)mx_name, strlen(mx_name)); + name_out = format_text(mx_name, strlen(mx_name)); if (cinfo != NULL) col_append_fstr(cinfo, COL_INFO, " %u %s", preference, name_out); if (dns_tree != NULL) { @@ -1423,7 +1423,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offset, int dns_data_offset, signer_name_len = get_dns_name(tvb, cur_offset, dns_data_offset, &signer_name); proto_tree_add_text(rr_tree, tvb, cur_offset, signer_name_len, "Signer's name: %s", - format_text((guchar*)signer_name, strlen(signer_name))); + format_text(signer_name, strlen(signer_name))); cur_offset += signer_name_len; rr_len -= signer_name_len; @@ -1573,7 +1573,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offset, int dns_data_offset, case 3: gw_name_len = get_dns_name(tvb, cur_offset, dns_data_offset, &gw); proto_tree_add_text(rr_tree, tvb, cur_offset, gw_name_len, - "Gateway: %s", format_text((guchar*)gw, strlen(gw))); + "Gateway: %s", format_text(gw, strlen(gw))); cur_offset += gw_name_len; rr_len -= gw_name_len; @@ -1643,7 +1643,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offset, int dns_data_offset, pname=""; pname_len = 0; } - name_out = format_text((guchar*)pname, strlen(pname)); + name_out = format_text(pname, strlen(pname)); if (cinfo != NULL) { col_append_fstr(cinfo, COL_INFO, " %d %s %s", @@ -1680,7 +1680,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offset, int dns_data_offset, dname_len = get_dns_name(tvb, cur_offset, dns_data_offset, &dname); - name_out = format_text((guchar*)dname, strlen(dname)); + name_out = format_text(dname, strlen(dname)); if (cinfo != NULL) col_append_fstr(cinfo, COL_INFO, " %s", name_out); if (dns_tree != NULL) { @@ -1742,7 +1742,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offset, int dns_data_offset, next_domain_name_len = get_dns_name(tvb, cur_offset, dns_data_offset, &next_domain_name); - name_out = format_text((guchar*)next_domain_name, strlen(next_domain_name)); + name_out = format_text(next_domain_name, strlen(next_domain_name)); if (cinfo != NULL) col_append_fstr(cinfo, COL_INFO, " %s", name_out); if (dns_tree != NULL) { @@ -1790,7 +1790,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offset, int dns_data_offset, next_domain_name_len = get_dns_name(tvb, cur_offset, dns_data_offset, &next_domain_name); - name_out = format_text((guchar*)next_domain_name, strlen(next_domain_name)); + name_out = format_text(next_domain_name, strlen(next_domain_name)); if (cinfo != NULL) col_append_fstr(cinfo, COL_INFO, " %s", name_out); if (dns_tree != NULL) { @@ -1827,7 +1827,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offset, int dns_data_offset, preference = tvb_get_ntohs(tvb, cur_offset); kx_name_len = get_dns_name(tvb, cur_offset + 2, dns_data_offset, &kx_name); - name_out = format_text((guchar*)kx_name, strlen(kx_name)); + name_out = format_text(kx_name, strlen(kx_name)); if (cinfo != NULL) col_append_fstr(cinfo, COL_INFO, " %u %s", preference, name_out); if (dns_tree != NULL) { @@ -1951,7 +1951,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offset, int dns_data_offset, tkey_algname_len = get_dns_name(tvb, cur_offset, dns_data_offset, &tkey_algname); proto_tree_add_text(rr_tree, tvb, cur_offset, tkey_algname_len, "Algorithm name: %s", - format_text((guchar*)tkey_algname, strlen(tkey_algname))); + format_text(tkey_algname, strlen(tkey_algname))); cur_offset += tkey_algname_len; rr_len -= tkey_algname_len; @@ -2074,7 +2074,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offset, int dns_data_offset, if (dns_tree != NULL) { tsig_algname_len = get_dns_name(tvb, cur_offset, dns_data_offset, &tsig_raw_algname); - tsig_algname=format_text((guchar*)tsig_raw_algname, strlen(tsig_raw_algname)); + tsig_algname=format_text(tsig_raw_algname, strlen(tsig_raw_algname)); proto_tree_add_string(rr_tree, hf_dns_tsig_algorithm_name, tvb, cur_offset, tsig_algname_len, tsig_algname); cur_offset += tsig_algname_len; rr_len -= tsig_algname_len; @@ -2262,7 +2262,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offset, int dns_data_offset, rr_len -= 4; dname_len = get_dns_name(tvb, cur_offset, dns_data_offset, &dname); - name_out = format_text((guchar*)dname, strlen(dname)); + name_out = format_text(dname, strlen(dname)); if (cinfo != NULL) col_append_fstr(cinfo, COL_INFO, " %s", name_out); if (dns_tree != NULL) { @@ -2286,7 +2286,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offset, int dns_data_offset, port = tvb_get_ntohs(tvb, cur_offset+4); target_len = get_dns_name(tvb, cur_offset + 6, dns_data_offset, &target); - name_out = format_text((guchar*)target, strlen(target)); + name_out = format_text(target, strlen(target)); if (cinfo != NULL) col_append_fstr(cinfo, COL_INFO, " %u %u %u %s", priority, weight, port, name_out); if (dns_tree != NULL) { @@ -2322,7 +2322,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offset, int dns_data_offset, offset += 2; flags_len = tvb_get_guint8(tvb, offset); offset++; - flags = (gchar*)tvb_get_ephemeral_string(tvb, offset, flags_len); + flags = tvb_get_ephemeral_string(tvb, offset, flags_len); offset += flags_len; service_len = tvb_get_guint8(tvb, offset); offset++; diff --git a/epan/dissectors/packet-dsi.c b/epan/dissectors/packet-dsi.c index e78c27ff89..d95753b532 100644 --- a/epan/dissectors/packet-dsi.c +++ b/epan/dissectors/packet-dsi.c @@ -468,7 +468,7 @@ dissect_dsi_reply_get_status(tvbuff_t *tvb, proto_tree *tree, gint offset) ofs = utf_ofs; ulen = tvb_get_ntohs(tvb, ofs); - tmp = (char*)tvb_get_ephemeral_string(tvb, ofs + 2, ulen); + tmp = tvb_get_ephemeral_string(tvb, ofs + 2, ulen); ti = proto_tree_add_text(tree, tvb, ofs, ulen + 2, "UTF8 server name: %s", tmp); sub_tree = proto_item_add_subtree(ti, ett_dsi_utf8_name); proto_tree_add_uint(sub_tree, hf_dsi_utf8_server_name_len, tvb, ofs, 2, ulen); diff --git a/epan/dissectors/packet-edonkey.c b/epan/dissectors/packet-edonkey.c index 321aa38665..ce171bcc34 100644 --- a/epan/dissectors/packet-edonkey.c +++ b/epan/dissectors/packet-edonkey.c @@ -329,7 +329,7 @@ static guint8 edonkey_metatag_name_get_type(tvbuff_t *tvb, gint start, gint leng if (match_strval(special_tagtype, edonkey_special_tags) == NULL) { gint index; tag_name = tvb_get_ephemeral_string(tvb, start, length); - index = lookup_str_index((gchar*)tag_name, length, edonkey_special_tags); + index = lookup_str_index(tag_name, length, edonkey_special_tags); if (index < 0) return EDONKEY_STAG_UNKNOWN; else return edonkey_special_tags[index].value; diff --git a/epan/dissectors/packet-extreme.c b/epan/dissectors/packet-extreme.c index dd161e7758..f925ce44ef 100644 --- a/epan/dissectors/packet-extreme.c +++ b/epan/dissectors/packet-extreme.c @@ -361,9 +361,9 @@ dissect_display_tlv(tvbuff_t *tvb, packet_info *pinfo, int offset, int length, p display_name = tvb_get_ephemeral_string(tvb, offset, length); proto_item_append_text(display_item, ": \"%s\"", - format_text(display_name, strlen((char*)display_name))); + format_text(display_name, strlen(display_name))); proto_tree_add_string(display_tree, hf_edp_display_string, tvb, offset, length, - (char*)display_name); + display_name); } static void @@ -552,9 +552,9 @@ dissect_vlan_tlv(tvbuff_t *tvb, packet_info *pinfo, int offset, int length, prot vlan_name = tvb_get_ephemeral_string(tvb, offset, length); proto_item_append_text(vlan_item, ", Name \"%s\"", - format_text(vlan_name, strlen((char*)vlan_name))); + format_text(vlan_name, strlen(vlan_name))); proto_tree_add_string(vlan_tree, hf_edp_vlan_name, tvb, offset, length, - (char*)vlan_name); + vlan_name); offset += length; } diff --git a/epan/dissectors/packet-fcdns.c b/epan/dissectors/packet-fcdns.c index a9ba32608e..c7e357804e 100644 --- a/epan/dissectors/packet-fcdns.c +++ b/epan/dissectors/packet-fcdns.c @@ -602,7 +602,7 @@ dissect_fcdns_gspnid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) tvb, offset, 1, 0); proto_tree_add_string (req_tree, hf_fcdns_rply_spname, tvb, offset+1, len, - (char*)tvb_get_ptr (tvb, offset+1, len)); + tvb_get_ptr (tvb, offset+1, len)); } } } @@ -1234,7 +1234,7 @@ dissect_fcdns_zone_mbr (tvbuff_t *tvb, proto_tree *zmbr_tree, int offset) 3))); break; case FC_SWILS_ZONEMBR_ALIAS: - str = (char*)zonenm_to_str (tvb, offset+4); + str = zonenm_to_str (tvb, offset+4); proto_tree_add_string (zmbr_tree, hf_fcdns_zone_mbrid, tvb, offset+4, idlen, str); break; @@ -1452,7 +1452,7 @@ dissect_fcdns_gezn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) proto_tree_add_text (req_tree, tvb, offset, 1, "Name Length: %d", strlen); proto_tree_add_string (req_tree, hf_fcdns_zonenm, tvb, offset+3, - strlen, (char*)tvb_get_ptr (tvb, offset+3, strlen)); + strlen, tvb_get_ptr (tvb, offset+3, strlen)); } } else { diff --git a/epan/dissectors/packet-fcswils.c b/epan/dissectors/packet-fcswils.c index fcea72acab..90b2be19b7 100644 --- a/epan/dissectors/packet-fcswils.c +++ b/epan/dissectors/packet-fcswils.c @@ -1260,7 +1260,7 @@ dissect_swils_zone_mbr (tvbuff_t *tvb, proto_tree *zmbr_tree, int offset) 3))); break; case FC_SWILS_ZONEMBR_ALIAS: - str = (char*)zonenm_to_str (tvb, offset+4); + str = zonenm_to_str (tvb, offset+4); proto_tree_add_string (zmbr_tree, hf_swils_zone_mbrid, tvb, offset+4, idlen, str); break; @@ -1311,7 +1311,7 @@ dissect_swils_zone_obj (tvbuff_t *tvb, proto_tree *zobj_tree, int offset) 1, 0); proto_tree_add_item (zobj_tree, hf_swils_zone_protocol, tvb, offset+1, 1, 0); - str = (char*)zonenm_to_str (tvb, offset+4); + str = zonenm_to_str (tvb, offset+4); proto_tree_add_string (zobj_tree, hf_swils_zone_objname, tvb, offset+4, ZONENAME_LEN (tvb, offset+4), str); @@ -1356,7 +1356,7 @@ dissect_swils_mergereq (tvbuff_t *tvb, proto_tree *mr_tree, guint8 isreq) "Active ZoneSet Length: %u", zonesetlen); if (zonesetlen) { - str = (char*)zonenm_to_str (tvb, offset+4); + str = zonenm_to_str (tvb, offset+4); proto_tree_add_string (mr_tree, hf_swils_zone_activezonenm, tvb, offset+4, ZONENAME_LEN (tvb, offset+4), str); @@ -1503,7 +1503,7 @@ dissect_swils_sfc (tvbuff_t *tvb, proto_tree *sfc_tree, guint8 isreq) "ZoneSet Length: %d", zonesetlen); if (zonesetlen) { - str = (char*)zonenm_to_str (tvb, offset+4); + str = zonenm_to_str (tvb, offset+4); proto_tree_add_string (sfc_tree, hf_swils_sfc_zonenm, tvb, offset+4, ZONENAME_LEN (tvb, offset+4), str); diff --git a/epan/dissectors/packet-fix.c b/epan/dissectors/packet-fix.c index 2607f74d53..d87acce6c7 100644 --- a/epan/dissectors/packet-fix.c +++ b/epan/dissectors/packet-fix.c @@ -913,7 +913,7 @@ dissect_fix(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } if (check_col(pinfo->cinfo, COL_INFO)) { - value = (char*)tvb_get_ephemeral_string(tvb, value_offset, value_len); + value = tvb_get_ephemeral_string(tvb, value_offset, value_len); msg_type = (char *)g_datalist_get_data(&msg_types, value); if(msg_type) { summary_label = g_string_new(msg_type); @@ -972,10 +972,10 @@ dissect_fix(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) packet. */ return TRUE; } - tag_str = (char*)tvb_get_ephemeral_string(tvb, field_offset, tag_len); + tag_str = tvb_get_ephemeral_string(tvb, field_offset, tag_len); tag = atoi(tag_str); - value = (char*)tvb_get_ephemeral_string(tvb, value_offset, value_len); + value = tvb_get_ephemeral_string(tvb, value_offset, value_len); switch(tag) { case 1: /* Field Account */ diff --git a/epan/dissectors/packet-ftp.c b/epan/dissectors/packet-ftp.c index da9e7b597d..ea62b24274 100644 --- a/epan/dissectors/packet-ftp.c +++ b/epan/dissectors/packet-ftp.c @@ -315,7 +315,7 @@ dissect_ftp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) hf_ftp_request_command, tvb, offset, tokenlen, FALSE); } - if (strncmp((char*)line, "PORT", tokenlen) == 0) + if (strncmp(line, "PORT", tokenlen) == 0) is_port_request = TRUE; } } else { @@ -337,7 +337,7 @@ dissect_ftp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * One-line reply, or first or last line * of a multi-line reply. */ - tvb_get_nstringz0(tvb, offset, sizeof(code_str), (guint8*)code_str); + tvb_get_nstringz0(tvb, offset, sizeof(code_str), code_str); code = strtoul(code_str, NULL, 10); if (tree) { diff --git a/epan/dissectors/packet-fw1.c b/epan/dissectors/packet-fw1.c index 1472ce9066..d7f1fe5569 100644 --- a/epan/dissectors/packet-fw1.c +++ b/epan/dissectors/packet-fw1.c @@ -170,7 +170,7 @@ dissect_fw1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) iface_len = 6; interface_name=ep_alloc(iface_len+1); - tvb_get_nstringz0(tvb, 2, iface_len, (guint8*)interface_name); + tvb_get_nstringz0(tvb, 2, iface_len, interface_name); /* Known interface name - if not, remember it */ found=FALSE; diff --git a/epan/dissectors/packet-gtp.c b/epan/dissectors/packet-gtp.c index dfedaff2d8..5bd196fc15 100644 --- a/epan/dissectors/packet-gtp.c +++ b/epan/dissectors/packet-gtp.c @@ -3787,7 +3787,7 @@ decode_qos_umts(tvbuff_t *tvb, int offset, proto_tree *tree, const gchar* qos_st static const gchar* dissect_radius_qos_umts(proto_tree *tree, tvbuff_t *tvb) { decode_qos_umts(tvb, 0, tree, "UMTS GTP QoS Profile", 3); - return (gchar*)tvb_get_ephemeral_string(tvb,0,tvb_length(tvb)); + return tvb_get_ephemeral_string(tvb,0,tvb_length(tvb)); } static void @@ -3810,7 +3810,7 @@ decode_apn(tvbuff_t *tvb, int offset, guint16 length, proto_tree *tree) { } else apn = tvb_get_ephemeral_string(tvb, offset, length); - proto_tree_add_string (tree, hf_gtp_apn, tvb, offset, length, (char*)apn); + proto_tree_add_string (tree, hf_gtp_apn, tvb, offset, length, apn); } } diff --git a/epan/dissectors/packet-hsrp.c b/epan/dissectors/packet-hsrp.c index e88761981c..ace081dd7d 100644 --- a/epan/dissectors/packet-hsrp.c +++ b/epan/dissectors/packet-hsrp.c @@ -230,7 +230,7 @@ dissect_hsrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset++; tvb_memcpy(tvb, auth_buf, offset, 8); auth_buf[sizeof auth_buf - 1] = '\0'; - proto_tree_add_string_format(hsrp_tree, hf_hsrp_auth_data, tvb, offset, 8, (char*)auth_buf, + proto_tree_add_string_format(hsrp_tree, hf_hsrp_auth_data, tvb, offset, 8, auth_buf, "Authentication Data: %sDefault (%s)", (tvb_strneql(tvb, offset, "cisco", strlen("cisco"))) == 0 ? "" : "Non-", auth_buf); diff --git a/epan/dissectors/packet-iax2.c b/epan/dissectors/packet-iax2.c index 7ab70834ac..531b37a0a9 100644 --- a/epan/dissectors/packet-iax2.c +++ b/epan/dissectors/packet-iax2.c @@ -1203,7 +1203,7 @@ static guint32 dissect_ies (tvbuff_t * tvb, guint32 offset, /* we don't understand this ie: add a generic one */ guint32 value; const guint8 *ptr; - const guint8 *ie_name = (guint8*)val_to_str(ies_type, iax_ies_type, "Unknown"); + const guint8 *ie_name = val_to_str(ies_type, iax_ies_type, "Unknown"); switch(ies_len) { case 1: @@ -1234,7 +1234,7 @@ static guint32 dissect_ies (tvbuff_t * tvb, guint32 offset, ptr = tvb_get_ptr(tvb, offset + 2, ies_len); ie_item = proto_tree_add_string_format(ies_tree, hf_IAX_IE_UNKNOWN_BYTES, - tvb, offset+2, ies_len, (char*)ptr, + tvb, offset+2, ies_len, ptr, "%s: %s", ie_name, ptr ); break; } @@ -1258,7 +1258,7 @@ static guint32 dissect_ies (tvbuff_t * tvb, guint32 offset, else { guint8 *ie_val = NULL; ie_val = g_malloc(ITEM_LABEL_LENGTH); - proto_item_fill_label(ie_finfo, (gchar*)ie_val); + proto_item_fill_label(ie_finfo, ie_val); proto_item_set_text(ti, "Information Element: %s", ie_val); g_free(ie_val); diff --git a/epan/dissectors/packet-icep.c b/epan/dissectors/packet-icep.c index aefd307976..4ff5f58e33 100644 --- a/epan/dissectors/packet-icep.c +++ b/epan/dissectors/packet-icep.c @@ -257,7 +257,7 @@ static void dissect_ice_string(proto_tree *tree, int hf_icep, if ( Size != 0 ) { - s = (char*)tvb_get_ephemeral_string(tvb, offset, Size); + s = tvb_get_ephemeral_string(tvb, offset, Size); if (tree && add_hf) proto_tree_add_string(tree, hf_icep, tvb, offset, Size, s); } else { diff --git a/epan/dissectors/packet-igap.c b/epan/dissectors/packet-igap.c index c60f36547d..85b29d7ae0 100644 --- a/epan/dissectors/packet-igap.c +++ b/epan/dissectors/packet-igap.c @@ -200,7 +200,7 @@ dissect_igap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, int off } tvb_memcpy(tvb, account, offset, asize); account[asize] = '\0'; - proto_tree_add_string(tree, hf_account, tvb, offset, asize, (char*)account); + proto_tree_add_string(tree, hf_account, tvb, offset, asize, account); } offset += ACCOUNT_SIZE; diff --git a/epan/dissectors/packet-image-gif.c b/epan/dissectors/packet-image-gif.c index a05984e1ee..aec14d016a 100644 --- a/epan/dissectors/packet-image-gif.c +++ b/epan/dissectors/packet-image-gif.c @@ -163,7 +163,7 @@ dissect_gif(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree) guint8 color_resolution; guint8 image_bpp; guint tvb_len = tvb_reported_length(tvb); - char *str = (char*)tvb_get_ephemeral_string(tvb, 0, 6); + char *str = tvb_get_ephemeral_string(tvb, 0, 6); guint8 version; /* Check whether we're processing a GIF object */ diff --git a/epan/dissectors/packet-image-jfif.c b/epan/dissectors/packet-image-jfif.c index 9eb1229f95..2fbf8fd012 100644 --- a/epan/dissectors/packet-image-jfif.c +++ b/epan/dissectors/packet-image-jfif.c @@ -509,7 +509,7 @@ process_app0_segment(proto_tree *tree, tvbuff_t *tvb, guint32 len, proto_tree_add_item(subtree, hf_len, tvb, 2, 2, FALSE); - str = (char*)tvb_get_ephemeral_stringz(tvb, 4, &str_size); + str = tvb_get_ephemeral_stringz(tvb, 4, &str_size); ti = proto_tree_add_item(subtree, hf_identifier, tvb, 4, str_size, FALSE); if (strcmp(str, "JFIF") == 0) { /* Version */ @@ -603,7 +603,7 @@ process_app1_segment(proto_tree *tree, tvbuff_t *tvb, guint32 len, proto_tree_add_item(subtree, hf_len, tvb, offset, 2, FALSE); offset += 2; - str = (char*)tvb_get_ephemeral_stringz(tvb, offset, &str_size); + str = tvb_get_ephemeral_stringz(tvb, offset, &str_size); ti = proto_tree_add_item(subtree, hf_identifier, tvb, offset, str_size, FALSE); offset += str_size; if (strcmp(str, "Exif") == 0) { @@ -759,7 +759,7 @@ process_app2_segment(proto_tree *tree, tvbuff_t *tvb, guint32 len, proto_tree_add_item(subtree, hf_len, tvb, 2, 2, FALSE); - str = (char*)tvb_get_ephemeral_stringz(tvb, 4, &str_size); + str = tvb_get_ephemeral_stringz(tvb, 4, &str_size); ti = proto_tree_add_item(subtree, hf_identifier, tvb, 4, str_size, FALSE); if (strcmp(str, "FPXR") == 0) { proto_tree_add_text(tree, tvb, 0, -1, "Exif FlashPix APP2 application marker"); diff --git a/epan/dissectors/packet-ipdc.c b/epan/dissectors/packet-ipdc.c index 95ab42894d..23f99cda5a 100644 --- a/epan/dissectors/packet-ipdc.c +++ b/epan/dissectors/packet-ipdc.c @@ -206,7 +206,7 @@ dissect_ipdc_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* simple IPDC_ASCII strings */ case IPDC_ASCII: g_assert(len<=IPDC_STR_LEN); - tvb_memcpy(tvb, (guint8*)tmp_tag_text, offset+2, len); + tvb_memcpy(tvb, tmp_tag_text, offset+2, len); tmp_tag_text[len] = 0; proto_tree_add_text(tag_tree, tvb, offset, len + 2, "0x%2.2x: %s: %s", tag, des, diff --git a/epan/dissectors/packet-ipp.c b/epan/dissectors/packet-ipp.c index 211571a56e..e05ce21309 100644 --- a/epan/dissectors/packet-ipp.c +++ b/epan/dissectors/packet-ipp.c @@ -480,18 +480,18 @@ add_integer_tree(proto_tree *tree, tvbuff_t *tvb, int offset, * ends in '-time' then assume they are timestamps instead * of integers. */ - name_val=(char*)tvb_get_ptr(tvb, offset + 1 + 2, name_length); - if( (name_length > 5) && name_val && !tvb_memeql(tvb, offset + 1 + 2 + name_length - 5, (guint8*)"-time", 5)){ + name_val=tvb_get_ptr(tvb, offset + 1 + 2, name_length); + if( (name_length > 5) && name_val && !tvb_memeql(tvb, offset + 1 + 2 + name_length - 5, "-time", 5)){ ti = proto_tree_add_text(tree, tvb, offset, 1 + 2 + name_length + 2 + value_length, "%s: %s", - format_text((guchar*)name_val, name_length), + format_text(name_val, name_length), abs_time_secs_to_str(tvb_get_ntohl(tvb, offset + 1 + 2 + name_length + 2))); } else { ti = proto_tree_add_text(tree, tvb, offset, 1 + 2 + name_length + 2 + value_length, "%s: %u", - format_text((guchar*)name_val, name_length), + format_text(name_val, name_length), tvb_get_ntohl(tvb, offset + 1 + 2 + name_length + 2)); } } @@ -620,7 +620,7 @@ add_value_head(const gchar *tag_desc, proto_tree *tree, tvbuff_t *tvb, proto_tree_add_text(tree, tvb, offset, name_length, "Name: %s", format_text(nv, name_length)); if(name_val){ - *name_val=(char*)nv; + *name_val=nv; } } offset += name_length; diff --git a/epan/dissectors/packet-iscsi.c b/epan/dissectors/packet-iscsi.c index ca2c8f2842..c5c5dd2cdc 100644 --- a/epan/dissectors/packet-iscsi.c +++ b/epan/dissectors/packet-iscsi.c @@ -1603,11 +1603,11 @@ dissect_iscsi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint off */ cdb_buf=ep_alloc(16+ahs_cdb_length); /* the 16 first bytes of the cdb */ - tvb_memcpy(tvb, (guint8*)cdb_buf, cdb_offset, 16); + tvb_memcpy(tvb, cdb_buf, cdb_offset, 16); /* the remainder of the cdb from the ahs */ - tvb_memcpy(tvb, (guint8*)cdb_buf+16, ahs_cdb_offset, ahs_cdb_length); + tvb_memcpy(tvb, cdb_buf+16, ahs_cdb_offset, ahs_cdb_length); - cdb_tvb = tvb_new_real_data((guint8*)cdb_buf, + cdb_tvb = tvb_new_real_data(cdb_buf, ahs_cdb_length+16, ahs_cdb_length+16); diff --git a/epan/dissectors/packet-jxta.c b/epan/dissectors/packet-jxta.c index 12b2498fc0..19228ef473 100644 --- a/epan/dissectors/packet-jxta.c +++ b/epan/dissectors/packet-jxta.c @@ -441,7 +441,7 @@ static gboolean dissect_jxta_UDP_heur(tvbuff_t * tvb, packet_info * pinfo, proto if (!gUDP_HEUR) return FALSE; - if (tvb_memeql(tvb, 0, (guint8*)JXTA_UDP_SIG, sizeof(JXTA_UDP_SIG)) != 0) { + if (tvb_memeql(tvb, 0, JXTA_UDP_SIG, sizeof(JXTA_UDP_SIG)) != 0) { return FALSE; } @@ -633,7 +633,7 @@ static int dissect_jxta_udp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tr break; } - if (tvb_memeql(tvb, offset, (guint8*)JXTA_UDP_SIG, sizeof(JXTA_UDP_SIG)) != 0) { + if (tvb_memeql(tvb, offset, JXTA_UDP_SIG, sizeof(JXTA_UDP_SIG)) != 0) { /* not ours */ return 0; } @@ -761,7 +761,7 @@ static int dissect_jxta_stream(tvbuff_t * tvb, packet_info * pinfo, proto_tree * goto Common_Exit; } - if (0 == tvb_memeql(tvb, 0, (guint8*)JXTA_WELCOME_MSG_SIG, sizeof(JXTA_WELCOME_MSG_SIG))) { + if (0 == tvb_memeql(tvb, 0, JXTA_WELCOME_MSG_SIG, sizeof(JXTA_WELCOME_MSG_SIG))) { /* The beginning of a JXTA stream connection */ address *welcome_addr; gboolean initiator = FALSE; @@ -1030,7 +1030,7 @@ static int dissect_jxta_welcome(tvbuff_t * tvb, packet_info * pinfo, proto_tree return (gint) (available - sizeof(JXTA_WELCOME_MSG_SIG)); } - if (0 != tvb_memeql(tvb, 0, (guint8*)JXTA_WELCOME_MSG_SIG, sizeof(JXTA_WELCOME_MSG_SIG))) { + if (0 != tvb_memeql(tvb, 0, JXTA_WELCOME_MSG_SIG, sizeof(JXTA_WELCOME_MSG_SIG))) { /* not ours! */ return 0; } @@ -1058,7 +1058,7 @@ static int dissect_jxta_welcome(tvbuff_t * tvb, packet_info * pinfo, proto_tree } { - gchar *welcomeline = (char*)tvb_get_ephemeral_string(tvb, offset, first_linelen); + gchar *welcomeline = tvb_get_ephemeral_string(tvb, offset, first_linelen); gchar **current_token; guint token_offset = offset; proto_item *jxta_welcome_tree_item = NULL; @@ -1134,7 +1134,7 @@ static int dissect_jxta_welcome(tvbuff_t * tvb, packet_info * pinfo, proto_tree found_addr->type = AT_URI; found_addr->len = strlen(*current_token); /* FIXME 20050605 bondolo THIS ALLOCATION IS A MEMORY LEAK! */ - found_addr->data = (guint8*)g_strdup(*current_token); + found_addr->data = g_strdup(*current_token); } token_offset += strlen(*current_token) + 1; @@ -1292,7 +1292,7 @@ static int dissect_jxta_message_framing(tvbuff_t * tvb, packet_info * pinfo, pro if (content_type && (sizeof("content-type") - 1) == headername_len) { if (0 == tvb_strncaseeql(tvb, headername_offset, "content-type", sizeof("content-type") - 1)) { - *content_type = (gchar*)tvb_get_ephemeral_string(tvb, headervalue_offset, headervalue_len); + *content_type = tvb_get_ephemeral_string(tvb, headervalue_offset, headervalue_len); } } @@ -1402,7 +1402,7 @@ static int dissect_jxta_message(tvbuff_t * tvb, packet_info * pinfo, proto_tree break; } - if (tvb_memeql(tvb, offset, (guint8*)JXTA_MSG_SIG, sizeof(JXTA_MSG_SIG)) != 0) { + if (tvb_memeql(tvb, offset, JXTA_MSG_SIG, sizeof(JXTA_MSG_SIG)) != 0) { /* It is not one of ours */ return 0; } @@ -1618,7 +1618,7 @@ static int dissect_jxta_message(tvbuff_t * tvb, packet_info * pinfo, proto_tree for (each_name = 0; each_name < msg_names_count; each_name++) { guint16 name_len = tvb_get_ntohs(tvb, tree_offset); - names_table[2 + each_name] = (gchar*)tvb_get_ephemeral_string(tvb, tree_offset + sizeof(name_len), name_len); + names_table[2 + each_name] = tvb_get_ephemeral_string(tvb, tree_offset + sizeof(name_len), name_len); proto_tree_add_item(jxta_msg_tree, hf_jxta_message_names_name, tvb, tree_offset, sizeof(name_len), FALSE); tree_offset += sizeof(name_len) + name_len; } @@ -1689,7 +1689,7 @@ static int dissect_jxta_message_element_1(tvbuff_t * tvb, packet_info * pinfo, p needed = (gint) (sizeof(JXTA_MSGELEM_SIG) - available); } - if (tvb_memeql(tvb, offset, (guint8*)JXTA_MSGELEM_SIG, sizeof(JXTA_MSGELEM_SIG)) != 0) { + if (tvb_memeql(tvb, offset, JXTA_MSGELEM_SIG, sizeof(JXTA_MSGELEM_SIG)) != 0) { /* It is not one of ours */ return 0; } @@ -1873,7 +1873,7 @@ static int dissect_jxta_message_element_1(tvbuff_t * tvb, packet_info * pinfo, p proto_tree_add_item(jxta_elem_tree, hf_jxta_element_type, tvb, tree_offset, sizeof(guint16), FALSE); tree_offset += sizeof(guint16); - mediatype = (gchar*)tvb_get_ephemeral_string(tvb, tree_offset, type_len); + mediatype = tvb_get_ephemeral_string(tvb, tree_offset, type_len); /* remove any params */ { @@ -1990,7 +1990,7 @@ static int dissect_jxta_message_element_2(tvbuff_t * tvb, packet_info * pinfo, p needed = (gint) (sizeof(JXTA_MSGELEM_SIG) - available); } - if (tvb_memeql(tvb, offset, (guint8*)JXTA_MSGELEM_SIG, sizeof(JXTA_MSGELEM_SIG)) != 0) { + if (tvb_memeql(tvb, offset, JXTA_MSGELEM_SIG, sizeof(JXTA_MSGELEM_SIG)) != 0) { /* It is not one of ours */ return 0; } diff --git a/epan/dissectors/packet-kismet.c b/epan/dissectors/packet-kismet.c index b6aa11f8c2..80439657e6 100644 --- a/epan/dissectors/packet-kismet.c +++ b/epan/dissectors/packet-kismet.c @@ -183,7 +183,7 @@ dissect_kismet(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) * *KISMET: {Version} {Start time} \001{Server name}\001 {Build Revision} * two fields left undocumented: {???} {?ExtendedVersion?} */ - if (!strncmp((char*)reqresp, "*KISMET", 7)) { + if (!strncmp(reqresp, "*KISMET", 7)) { offset += next_token - line; linelen -= next_token - line; line = next_token; @@ -236,7 +236,7 @@ dissect_kismet(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) /* * *TIME: {Time} */ - if (!strncmp((char*)reqresp, "*TIME", 5)) { + if (!strncmp(reqresp, "*TIME", 5)) { time_t t; char *ptr; @@ -278,10 +278,10 @@ dissect_kismet(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) static gboolean response_is_continuation(const guchar * data) { - if (!strncmp((char*)data, "*", 1)) + if (!strncmp(data, "*", 1)) return FALSE; - if (!strncmp((char*)data, "!", 1)) + if (!strncmp(data, "!", 1)) return FALSE; return TRUE; diff --git a/epan/dissectors/packet-megaco.c b/epan/dissectors/packet-megaco.c index e86ae3917e..24f1aadd07 100644 --- a/epan/dissectors/packet-megaco.c +++ b/epan/dissectors/packet-megaco.c @@ -361,7 +361,7 @@ dissect_megaco_text(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * tvb_offset = tvb_find_guint8(tvb, tvb_offset, 5, 'M'); */ if(!tvb_get_nstringz0(tvb,tvb_offset,sizeof(word),word)) return; - if (strncasecmp((gchar*)word, "MEGACO", 6) != 0 && (gchar)tvb_get_guint8(tvb, tvb_offset ) != '!'){ + if (strncasecmp(word, "MEGACO", 6) != 0 && tvb_get_guint8(tvb, tvb_offset ) != '!'){ call_dissector(h248_handle,tvb,pinfo,tree); return; } @@ -1169,7 +1169,7 @@ nextcontext: /*** TERM ***/ my_proto_tree_add_string(megaco_tree_command_line, hf_megaco_termid, tvb, tvb_offset, tokenlen, - (gchar*)TermID); + TermID); break; case '*': @@ -2312,7 +2312,7 @@ dissect_megaco_servicechangedescriptor(tvbuff_t *tvb, proto_tree *megaco_tree, break; tvb_get_nstringz0(tvb,tvb_current_offset,4,ServiceChangeReason_str); - reason = atoi((gchar*)ServiceChangeReason_str); + reason = atoi(ServiceChangeReason_str); proto_item_append_text(item,"[ %s ]", val_to_str(reason, MEGACO_ServiceChangeReasons_vals,"Unknown (%u)")); break; @@ -2792,7 +2792,7 @@ dissect_megaco_errordescriptor(tvbuff_t *tvb, proto_tree *megaco_tree_command_li tvb_current_offset = tvb_find_guint8(tvb, tvb_previous_offset , tvb_RBRKT, '='); tvb_current_offset = tvb_skip_wsp(tvb, tvb_current_offset +1); tvb_get_nstringz0(tvb,tvb_current_offset,4,error); - error_code = atoi((gchar*)error); + error_code = atoi(error); proto_tree_add_string_hidden(megaco_tree_command_line, hf_megaco_error_descriptor, tvb, tvb_current_offset, 3, tvb_format_text(tvb, tvb_current_offset, @@ -3160,7 +3160,7 @@ dissect_megaco_LocalControldescriptor(tvbuff_t *tvb, proto_tree *megaco_mediades tokenlen)); tvb_get_nstringz0(tvb,tvb_current_offset,3,code_str); - proto_item_append_text(item,"[ %s ]", val_to_str(strtoul((gchar*)code_str,NULL,16), dscp_vals,"Unknown (%u)")); + proto_item_append_text(item,"[ %s ]", val_to_str(strtoul(code_str,NULL,16), dscp_vals,"Unknown (%u)")); tvb_current_offset = tvb_skip_wsp(tvb, tvb_offset +1); break; diff --git a/epan/dissectors/packet-mmse.c b/epan/dissectors/packet-mmse.c index aa350dc9be..03a7b6eecc 100644 --- a/epan/dissectors/packet-mmse.c +++ b/epan/dissectors/packet-mmse.c @@ -1180,7 +1180,7 @@ dissect_mmse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 pdut, hf_mmse_prev_sent_by, tvb, offset - 1, 1 + count + length, strval, "%s (Forwarded-count=%u)", - format_text((guchar*)strval, strlen(strval)), + format_text(strval, strlen(strval)), fwd_count); subtree = proto_item_add_subtree(ti, ett_mmse_hdr_details); @@ -1217,7 +1217,7 @@ dissect_mmse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 pdut, hf_mmse_prev_sent_date, tvb, offset - 1, 1 + count + length, strval, "%s (Forwarded-count=%u)", - format_text((guchar*)strval, strlen(strval)), + format_text(strval, strlen(strval)), fwd_count); subtree = proto_item_add_subtree(ti, ett_mmse_hdr_details); @@ -1256,7 +1256,7 @@ dissect_mmse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 pdut, proto_tree_add_text(mmse_tree, tvb, offset - 1, length + 1, "%s: %s (Not decoded)", hdr_name, - format_text((guchar*)strval, strlen(strval))); + format_text(strval, strlen(strval))); } } else { /* General form with length */ if (peek == 0x1F) { /* Value length in guintvar */ @@ -1292,8 +1292,8 @@ dissect_mmse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 pdut, (const char *) tvb_get_ptr( tvb, offset, length + length2), "%s: %s", - format_text((guchar*)strval, strlen(strval)), - format_text((guchar*)strval2, strlen(strval2))); + format_text(strval, strlen(strval)), + format_text(strval2, strlen(strval2))); } offset += length + length2; } diff --git a/epan/dissectors/packet-mount.c b/epan/dissectors/packet-mount.c index cc8003bfab..5866c63152 100644 --- a/epan/dissectors/packet-mount.c +++ b/epan/dissectors/packet-mount.c @@ -172,7 +172,7 @@ dissect_mount_dirpath_call(tvbuff_t *tvb, int offset, packet_info *pinfo, unsigned const char *dir; int len; - host=(unsigned char*)ip_to_str(pinfo->dst.data); + host=ip_to_str(pinfo->dst.data); len=tvb_get_ntohl(tvb, offset); if (len >= ITEM_LABEL_LENGTH) THROW(ReportedBoundsError); @@ -180,16 +180,16 @@ dissect_mount_dirpath_call(tvbuff_t *tvb, int offset, packet_info *pinfo, dir=tvb_get_ptr(tvb, offset+4, len); if(dir){ unsigned char *ptr; - name=(unsigned char*)g_malloc(strlen(host)+1+len+1+200); + name=g_malloc(strlen(host)+1+len+1+200); ptr=name; - memcpy(ptr, host, strlen((char*)host)); - ptr+=strlen((char*)host); + memcpy(ptr, host, strlen(host)); + ptr+=strlen(host); *ptr++=':'; memcpy(ptr, dir, len); ptr+=len; *ptr=0; - nfs_name_snoop_add_name(civ->xid, tvb, -1, strlen((char*)name), 0, 0, name); + nfs_name_snoop_add_name(civ->xid, tvb, -1, strlen(name), 0, 0, name); } } } diff --git a/epan/dissectors/packet-msrp.c b/epan/dissectors/packet-msrp.c index 794c8f14fd..e7c759ca66 100644 --- a/epan/dissectors/packet-msrp.c +++ b/epan/dissectors/packet-msrp.c @@ -513,7 +513,7 @@ dissect_msrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) token_2_len = space_offset - token_2_start; /* Transaction ID found store it for later use */ - transaction_id_str = (char*)tvb_get_ephemeral_string(tvb, token_2_start, token_2_len); + transaction_id_str = tvb_get_ephemeral_string(tvb, token_2_start, token_2_len); /* Look for another space in this line to indicate a 4th token */ token_3_start = space_offset + 1; @@ -590,7 +590,7 @@ dissect_msrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) reqresp_tree = proto_item_add_subtree(th, ett_msrp_reqresp); proto_tree_add_item(reqresp_tree,hf_msrp_transactionID,tvb,token_2_start,token_2_len,FALSE); proto_tree_add_uint(reqresp_tree,hf_msrp_status_code,tvb,token_3_start,token_3_len, - atoi((char*)tvb_get_string(tvb, token_3_start, token_3_len))); + atoi(tvb_get_string(tvb, token_3_start, token_3_len))); }else{ th = proto_tree_add_item(msrp_tree,hf_msrp_request_line,tvb,0,linelen,FALSE); @@ -654,7 +654,7 @@ dissect_msrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * Fetch the value. */ value_len = line_end_offset - value_offset; - value = (char*)tvb_get_ephemeral_string(tvb, value_offset, + value = tvb_get_ephemeral_string(tvb, value_offset, value_len); /* @@ -684,10 +684,10 @@ dissect_msrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) parameter_offset++; content_type_len = semi_colon_offset - value_offset; content_type_parameter_str_len = line_end_offset - parameter_offset; - content_type_parameter_str = (char*)tvb_get_ephemeral_string(tvb, + content_type_parameter_str = tvb_get_ephemeral_string(tvb, parameter_offset, content_type_parameter_str_len); } - media_type_str = (char*)tvb_get_ephemeral_string(tvb, value_offset, content_type_len); + media_type_str = tvb_get_ephemeral_string(tvb, value_offset, content_type_len); #if GLIB_MAJOR_VERSION < 2 media_type_str_lower_case = g_strdup(media_type_str); g_strdown(media_type_str_lower_case); diff --git a/epan/dissectors/packet-rsvp.c b/epan/dissectors/packet-rsvp.c index 0f4a5d79e6..c7cc5d07b0 100644 --- a/epan/dissectors/packet-rsvp.c +++ b/epan/dissectors/packet-rsvp.c @@ -4617,12 +4617,12 @@ dissect_rsvp_call_id (proto_tree *ti, proto_tree *rsvp_object_tree, "C-type: 2 (globally unique)"); proto_tree_add_text(rsvp_object_tree, tvb, offset2, 1, "Address type: %s", val_to_str(type, address_type_vals, "Unknown (%u)")); - str = (char*)tvb_get_ephemeral_string (tvb, offset2 + 1, 3); + str = tvb_get_ephemeral_string (tvb, offset2 + 1, 3); proto_tree_add_text(rsvp_object_tree, tvb, offset2 + 1, 3, "International Segment: %s", str); proto_item_append_text(ti, "Globally-Unique. Addr Type: %s. Intl Segment: %s. ", val_to_str(type, address_type_vals, "Unknown (%u)"), str); - str = (char*)tvb_get_ephemeral_string (tvb, offset2 + 4, 12); + str = tvb_get_ephemeral_string (tvb, offset2 + 4, 12); proto_tree_add_text(rsvp_object_tree, tvb, offset2 + 4, 12, "National Segment: %s", str); proto_item_append_text(ti, "Natl Segment: %s. ", str); diff --git a/epan/dissectors/packet-smb.c b/epan/dissectors/packet-smb.c index 65ebf68afe..2e3621bf3d 100644 --- a/epan/dissectors/packet-smb.c +++ b/epan/dissectors/packet-smb.c @@ -2082,7 +2082,7 @@ dissect_negprot_request(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, /*Dialect Name */ CHECK_BYTE_COUNT(len); proto_tree_add_string(dtr, hf_smb_dialect_name, tvb, offset, - len, (char*)str); + len, str); COUNT_BYTES(len); } @@ -2429,7 +2429,7 @@ dissect_old_dir_request(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, if (check_col(pinfo->cinfo, COL_INFO)) { col_append_fstr(pinfo->cinfo, COL_INFO, ", Directory: %s", - format_text(dn, strlen((guchar*)dn))); + format_text(dn, strlen(dn))); } END_OF_SMB @@ -2534,7 +2534,7 @@ dissect_tree_connect_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree if (check_col(pinfo->cinfo, COL_INFO)) { col_append_fstr(pinfo->cinfo, COL_INFO, ", Path: %s", - format_text(an, strlen((guchar*)an))); + format_text(an, strlen(an))); } /* buffer format */ @@ -2813,12 +2813,12 @@ dissect_move_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int of if (fn == NULL) goto endofcommand; proto_tree_add_string_format(tree, hf_smb_file_name, tvb, offset, - fn_len, fn, "Old File Name: %s", format_text(fn, strlen((guchar*)fn))); + fn_len, fn, "Old File Name: %s", format_text(fn, strlen(fn))); COUNT_BYTES(fn_len); if (check_col(pinfo->cinfo, COL_INFO)) { col_append_fstr(pinfo->cinfo, COL_INFO, ", Old Name: %s", - format_text(fn, strlen((guchar*)fn))); + format_text(fn, strlen(fn))); } /* buffer format */ @@ -2832,12 +2832,12 @@ dissect_move_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int of if (fn == NULL) goto endofcommand; proto_tree_add_string_format(tree, hf_smb_file_name, tvb, offset, - fn_len, fn, "New File Name: %s", format_text(fn, strlen((guchar*)fn))); + fn_len, fn, "New File Name: %s", format_text(fn, strlen(fn))); COUNT_BYTES(fn_len); if (check_col(pinfo->cinfo, COL_INFO)) { col_append_fstr(pinfo->cinfo, COL_INFO, ", New Name: %s", - format_text(fn, strlen((guchar*)fn))); + format_text(fn, strlen(fn))); } END_OF_SMB @@ -2882,12 +2882,12 @@ dissect_copy_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int of if (fn == NULL) goto endofcommand; proto_tree_add_string_format(tree, hf_smb_file_name, tvb, offset, - fn_len, fn, "Source File Name: %s", format_text(fn, strlen((guchar*)fn))); + fn_len, fn, "Source File Name: %s", format_text(fn, strlen(fn))); COUNT_BYTES(fn_len); if (check_col(pinfo->cinfo, COL_INFO)) { col_append_fstr(pinfo->cinfo, COL_INFO, ", Source Name: %s", - format_text(fn, strlen((guchar*)fn))); + format_text(fn, strlen(fn))); } /* buffer format */ @@ -2902,11 +2902,11 @@ dissect_copy_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int of goto endofcommand; proto_tree_add_string_format(tree, hf_smb_file_name, tvb, offset, fn_len, fn, "Destination File Name: %s", - format_text(fn, strlen((guchar*)fn))); + format_text(fn, strlen(fn))); COUNT_BYTES(fn_len); if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_fstr(pinfo->cinfo, COL_INFO, ", Destination Name: %s", format_text(fn, strlen((guchar*)fn))); + col_append_fstr(pinfo->cinfo, COL_INFO, ", Destination Name: %s", format_text(fn, strlen(fn))); } END_OF_SMB @@ -2989,7 +2989,7 @@ dissect_open_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, i if (check_col(pinfo->cinfo, COL_INFO)) { col_append_fstr(pinfo->cinfo, COL_INFO, ", Path: %s", - format_text(fn, strlen((guchar*)fn))); + format_text(fn, strlen(fn))); } END_OF_SMB @@ -3253,7 +3253,7 @@ dissect_create_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if (check_col(pinfo->cinfo, COL_INFO)) { col_append_fstr(pinfo->cinfo, COL_INFO, ", Path: %s", - format_text(fn, strlen((guchar*)fn))); + format_text(fn, strlen(fn))); } END_OF_SMB @@ -3318,7 +3318,7 @@ dissect_delete_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if (check_col(pinfo->cinfo, COL_INFO)) { col_append_fstr(pinfo->cinfo, COL_INFO, ", Path: %s", - format_text(fn, strlen((guchar*)fn))); + format_text(fn, strlen(fn))); } END_OF_SMB @@ -3360,7 +3360,7 @@ dissect_rename_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if (check_col(pinfo->cinfo, COL_INFO)) { col_append_fstr(pinfo->cinfo, COL_INFO, ", Old Name: %s", - format_text(fn, strlen((guchar*)fn))); + format_text(fn, strlen(fn))); } /* buffer format */ @@ -3379,7 +3379,7 @@ dissect_rename_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if (check_col(pinfo->cinfo, COL_INFO)) { col_append_fstr(pinfo->cinfo, COL_INFO, ", New Name: %s", - format_text(fn, strlen((guchar*)fn))); + format_text(fn, strlen(fn))); } END_OF_SMB @@ -3427,7 +3427,7 @@ dissect_nt_rename_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr if (check_col(pinfo->cinfo, COL_INFO)) { col_append_fstr(pinfo->cinfo, COL_INFO, ", Old Name: %s", - format_text(fn, strlen((guchar*)fn))); + format_text(fn, strlen(fn))); } /* buffer format */ @@ -3446,7 +3446,7 @@ dissect_nt_rename_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr if (check_col(pinfo->cinfo, COL_INFO)) { col_append_fstr(pinfo->cinfo, COL_INFO, ", New Name: %s", - format_text(fn, strlen((guchar*)fn))); + format_text(fn, strlen(fn))); } END_OF_SMB @@ -3486,7 +3486,7 @@ dissect_query_information_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree if (check_col(pinfo->cinfo, COL_INFO)) { col_append_fstr(pinfo->cinfo, COL_INFO, ", Path: %s", - format_text(fn, strlen((guchar*)fn))); + format_text(fn, strlen(fn))); } END_OF_SMB @@ -3564,7 +3564,7 @@ dissect_set_information_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t if (check_col(pinfo->cinfo, COL_INFO)) { col_append_fstr(pinfo->cinfo, COL_INFO, ", Path: %s", - format_text(fn, strlen((guchar*)fn))); + format_text(fn, strlen(fn))); } END_OF_SMB @@ -3933,7 +3933,7 @@ dissect_create_temporary_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree * if (check_col(pinfo->cinfo, COL_INFO)) { col_append_fstr(pinfo->cinfo, COL_INFO, ", Path: %s", - format_text(fn, strlen((guchar*)fn))); + format_text(fn, strlen(fn))); } END_OF_SMB @@ -4777,7 +4777,7 @@ dissect_search_find_request(tvbuff_t *tvb, packet_info *pinfo, if (check_col(pinfo->cinfo, COL_INFO)) { col_append_fstr(pinfo->cinfo, COL_INFO, ", File: %s", - format_text(fn, strlen((guchar*)fn))); + format_text(fn, strlen(fn))); } /* buffer format */ @@ -5395,7 +5395,7 @@ dissect_open_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, i if (check_col(pinfo->cinfo, COL_INFO)) { col_append_fstr(pinfo->cinfo, COL_INFO, ", Path: %s", - format_text(fn, strlen((guchar*)fn))); + format_text(fn, strlen(fn))); } END_OF_SMB @@ -6318,8 +6318,8 @@ dissect_session_setup_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree else col_append_fstr(pinfo->cinfo, COL_INFO, "%s\\%s", - format_text(dn, strlen((guchar*)dn)), - format_text(an, strlen((guchar*)an))); + format_text(dn, strlen(dn)), + format_text(an, strlen(an))); } /* OS */ @@ -6656,7 +6656,7 @@ dissect_tree_connect_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree if (check_col(pinfo->cinfo, COL_INFO)) { col_append_fstr(pinfo->cinfo, COL_INFO, ", Path: %s", - format_text(an, strlen((guchar*)an))); + format_text(an, strlen(an))); } /* @@ -6669,7 +6669,7 @@ dissect_tree_connect_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree /* XXX - what if this runs past bc? */ an_len = tvb_strsize(tvb, offset); CHECK_BYTE_COUNT(an_len); - an = (char*)tvb_get_ptr(tvb, offset, an_len); + an = tvb_get_ptr(tvb, offset, an_len); proto_tree_add_string(tree, hf_smb_service, tvb, offset, an_len, an); COUNT_BYTES(an_len); @@ -6769,7 +6769,7 @@ dissect_tree_connect_andx_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree /* XXX - what if this runs past bc? */ an_len = tvb_strsize(tvb, offset); CHECK_BYTE_COUNT(an_len); - an = (char*)tvb_get_ptr(tvb, offset, an_len); + an = tvb_get_ptr(tvb, offset, an_len); proto_tree_add_string(tree, hf_smb_service, tvb, offset, an_len, an); COUNT_BYTES(an_len); @@ -7909,7 +7909,7 @@ dissect_nt_trans_param_request(tvbuff_t *tvb, packet_info *pinfo, int offset, pr bc -= 1; /* file name */ - fn = (char*)get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, TRUE, TRUE, &bc); + fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, TRUE, TRUE, &bc); if (fn != NULL) { proto_tree_add_string(tree, hf_smb_file_name, tvb, offset, fn_len, fn); @@ -8507,7 +8507,7 @@ dissect_nt_trans_param_response(tvbuff_t *tvb, packet_info *pinfo, if(len<0)break; /* file name */ - fn = (char*)get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, TRUE, TRUE, &bc); + fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, TRUE, TRUE, &bc); if (fn == NULL) break; proto_tree_add_string(tree, hf_smb_file_name, tvb, offset, fn_len, @@ -9348,7 +9348,7 @@ dissect_nt_create_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr if (check_col(pinfo->cinfo, COL_INFO)) { col_append_fstr(pinfo->cinfo, COL_INFO, ", Path: %s", - format_text(fn, strlen((guchar*)fn))); + format_text(fn, strlen(fn))); } END_OF_SMB @@ -9978,7 +9978,7 @@ dissect_transaction2_request_parameters(tvbuff_t *tvb, packet_info *pinfo, if (check_col(pinfo->cinfo, COL_INFO)) { col_append_fstr(pinfo->cinfo, COL_INFO, ", Path: %s", - format_text(fn, strlen((guchar*)fn))); + format_text(fn, strlen(fn))); } break; case 0x01: /*TRANS2_FIND_FIRST2*/ @@ -10019,7 +10019,7 @@ dissect_transaction2_request_parameters(tvbuff_t *tvb, packet_info *pinfo, if (check_col(pinfo->cinfo, COL_INFO)) { col_append_fstr(pinfo->cinfo, COL_INFO, ", Pattern: %s", - format_text(fn, strlen((guchar*)fn))); + format_text(fn, strlen(fn))); } break; @@ -10061,7 +10061,7 @@ dissect_transaction2_request_parameters(tvbuff_t *tvb, packet_info *pinfo, if (check_col(pinfo->cinfo, COL_INFO)) { col_append_fstr(pinfo->cinfo, COL_INFO, ", Continue: %s", - format_text(fn, strlen((guchar*)fn))); + format_text(fn, strlen(fn))); } break; @@ -10110,7 +10110,7 @@ dissect_transaction2_request_parameters(tvbuff_t *tvb, packet_info *pinfo, if (check_col(pinfo->cinfo, COL_INFO)) { col_append_fstr(pinfo->cinfo, COL_INFO, ", Path: %s", - format_text(fn, strlen((guchar*)fn))); + format_text(fn, strlen(fn))); } break; @@ -10137,7 +10137,7 @@ dissect_transaction2_request_parameters(tvbuff_t *tvb, packet_info *pinfo, if (check_col(pinfo->cinfo, COL_INFO)) { col_append_fstr(pinfo->cinfo, COL_INFO, ", Path: %s", - format_text(fn, strlen((guchar*)fn))); + format_text(fn, strlen(fn))); } break; @@ -10267,7 +10267,7 @@ dissect_transaction2_request_parameters(tvbuff_t *tvb, packet_info *pinfo, if (check_col(pinfo->cinfo, COL_INFO)) { col_append_fstr(pinfo->cinfo, COL_INFO, ", Path: %s", - format_text(fn, strlen((guchar*)fn))); + format_text(fn, strlen(fn))); } break; @@ -10301,7 +10301,7 @@ dissect_transaction2_request_parameters(tvbuff_t *tvb, packet_info *pinfo, if (check_col(pinfo->cinfo, COL_INFO)) { col_append_fstr(pinfo->cinfo, COL_INFO, ", Dir: %s", - format_text(fn, strlen((guchar*)fn))); + format_text(fn, strlen(fn))); } break; case 0x0e: /*TRANS2_SESSION_SETUP*/ @@ -10322,7 +10322,7 @@ dissect_transaction2_request_parameters(tvbuff_t *tvb, packet_info *pinfo, if (check_col(pinfo->cinfo, COL_INFO)) { col_append_fstr(pinfo->cinfo, COL_INFO, ", File: %s", - format_text(fn, strlen((guchar*)fn))); + format_text(fn, strlen(fn))); } break; @@ -10336,7 +10336,7 @@ dissect_transaction2_request_parameters(tvbuff_t *tvb, packet_info *pinfo, if (check_col(pinfo->cinfo, COL_INFO)) { col_append_fstr(pinfo->cinfo, COL_INFO, ", File: %s", - format_text(fn, strlen((guchar*)fn))); + format_text(fn, strlen(fn))); } break; @@ -10845,7 +10845,7 @@ dissect_4_2_16_2(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, /* EA name */ name = tvb_get_ephemeral_string(tvb, offset, name_len); - proto_item_append_text(item, ": %s", format_text(name, strlen((guchar*)name))); + proto_item_append_text(item, ": %s", format_text(name, strlen(name))); CHECK_BYTE_COUNT_SUBR(name_len + 1); proto_tree_add_item( @@ -11158,7 +11158,7 @@ dissect_qfi_SMB_FILE_ALL_INFO(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre /* file name */ CHECK_BYTE_COUNT_SUBR(fn_len); - fn = (char*)get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, TRUE, TRUE, bcp); + fn = get_unicode_or_ascii_string(tvb, &offset, si->unicode, &fn_len, TRUE, TRUE, bcp); if (fn != NULL) { proto_tree_add_string(tree, hf_smb_file_name, tvb, offset, fn_len, fn); @@ -11229,7 +11229,7 @@ dissect_qfi_SMB_FILE_STREAM_INFO(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tr fn); COUNT_BYTES_SUBR(fn_len); - proto_item_append_text(item, ": %s", format_text(fn, strlen((guchar*)fn))); + proto_item_append_text(item, ": %s", format_text(fn, strlen(fn))); proto_item_set_len(item, offset-old_offset); if (neo == 0) @@ -12595,10 +12595,10 @@ dissect_4_3_4_1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, if (check_col(pinfo->cinfo, COL_INFO)) { col_append_fstr(pinfo->cinfo, COL_INFO, " %s", - format_text(fn, strlen((guchar*)fn))); + format_text(fn, strlen(fn))); } - proto_item_append_text(item, " File: %s", format_text(fn, strlen((guchar*)fn))); + proto_item_append_text(item, " File: %s", format_text(fn, strlen(fn))); proto_item_set_len(item, offset-old_offset); *trunc = FALSE; @@ -12701,10 +12701,10 @@ dissect_4_3_4_2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, if (check_col(pinfo->cinfo, COL_INFO)) { col_append_fstr(pinfo->cinfo, COL_INFO, " %s", - format_text(fn, strlen((guchar*)fn))); + format_text(fn, strlen(fn))); } - proto_item_append_text(item, " File: %s", format_text(fn, strlen((guchar*)fn))); + proto_item_append_text(item, " File: %s", format_text(fn, strlen(fn))); proto_item_set_len(item, offset-old_offset); *trunc = FALSE; @@ -12785,7 +12785,7 @@ dissect_4_3_4_4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, if (check_col(pinfo->cinfo, COL_INFO)) { col_append_fstr(pinfo->cinfo, COL_INFO, " %s", - format_text(fn, strlen((guchar*)fn))); + format_text(fn, strlen(fn))); } /* skip to next structure */ @@ -12803,7 +12803,7 @@ dissect_4_3_4_4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, } } - proto_item_append_text(item, " File: %s", format_text(fn, strlen((guchar*)fn))); + proto_item_append_text(item, " File: %s", format_text(fn, strlen(fn))); proto_item_set_len(item, offset-old_offset); *trunc = FALSE; @@ -12890,7 +12890,7 @@ dissect_4_3_4_5(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, if (check_col(pinfo->cinfo, COL_INFO)) { col_append_fstr(pinfo->cinfo, COL_INFO, " %s", - format_text(fn, strlen((guchar*)fn))); + format_text(fn, strlen(fn))); } /* skip to next structure */ @@ -12908,7 +12908,7 @@ dissect_4_3_4_5(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, } } - proto_item_append_text(item, " File: %s", format_text(fn, strlen((guchar*)fn))); + proto_item_append_text(item, " File: %s", format_text(fn, strlen(fn))); proto_item_set_len(item, offset-old_offset); *trunc = FALSE; @@ -13021,7 +13021,7 @@ dissect_4_3_4_6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, if (check_col(pinfo->cinfo, COL_INFO)) { col_append_fstr(pinfo->cinfo, COL_INFO, " %s", - format_text(fn, strlen((guchar*)fn))); + format_text(fn, strlen(fn))); } /* skip to next structure */ @@ -13039,7 +13039,7 @@ dissect_4_3_4_6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, } } - proto_item_append_text(item, " File: %s", format_text(fn, strlen((guchar*)fn))); + proto_item_append_text(item, " File: %s", format_text(fn, strlen(fn))); proto_item_set_len(item, offset-old_offset); *trunc = FALSE; @@ -13100,7 +13100,7 @@ dissect_4_3_4_7(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, if (check_col(pinfo->cinfo, COL_INFO)) { col_append_fstr(pinfo->cinfo, COL_INFO, " %s", - format_text(fn, strlen((guchar*)fn))); + format_text(fn, strlen(fn))); } /* skip to next structure */ @@ -13118,7 +13118,7 @@ dissect_4_3_4_7(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, } } - proto_item_append_text(item, " File: %s", format_text(fn, strlen((guchar*)fn))); + proto_item_append_text(item, " File: %s", format_text(fn, strlen(fn))); proto_item_set_len(item, offset-old_offset); *trunc = FALSE; diff --git a/epan/dissectors/packet-smb2.c b/epan/dissectors/packet-smb2.c index f1ac5454da..5dbdc4556d 100644 --- a/epan/dissectors/packet-smb2.c +++ b/epan/dissectors/packet-smb2.c @@ -1711,7 +1711,7 @@ static void dissect_smb2_secblob(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, smb2_info_t *si _U_) { if( (tvb_length(tvb)>=7) - && (!tvb_memeql(tvb, 0, (guint8*)"NTLMSSP", 7))){ + && (!tvb_memeql(tvb, 0, "NTLMSSP", 7))){ call_dissector(ntlmssp_handle, tvb, pinfo, tree); } else { call_dissector(gssapi_handle, tvb, pinfo, tree); diff --git a/epan/dissectors/packet-smtp.c b/epan/dissectors/packet-smtp.c index ddc7126c87..fe3f05ee35 100644 --- a/epan/dissectors/packet-smtp.c +++ b/epan/dissectors/packet-smtp.c @@ -262,7 +262,7 @@ dissect_smtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (linelen >= 4 && ISALPHA(line[0]) && ISALPHA(line[1]) && ISALPHA(line[2]) && ISALPHA(line[3]) && (linelen == 4 || line[4] == ' ')) { - if (strncasecmp((char*)line, "DATA", 4) == 0) { + if (strncasecmp(line, "DATA", 4) == 0) { /* * DATA command. @@ -281,9 +281,9 @@ dissect_smtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } } else { - if ((linelen >= 7) && line[0] == 'X' && ( (strncasecmp((char*)line, "X-EXPS ", 7) == 0) || - ((linelen >=13) && (strncasecmp((char*)line, "X-LINK2STATE ", 13) == 0)) || - ((linelen >= 8) && (strncasecmp((char*)line, "XEXCH50 ", 8) == 0)) )) + if ((linelen >= 7) && line[0] == 'X' && ( (strncasecmp(line, "X-EXPS ", 7) == 0) || + ((linelen >=13) && (strncasecmp(line, "X-LINK2STATE ", 13) == 0)) || + ((linelen >= 8) && (strncasecmp(line, "XEXCH50 ", 8) == 0)) )) frame_data->pdu_type = SMTP_PDU_CMD; else /* diff --git a/epan/dissectors/packet-sna.c b/epan/dissectors/packet-sna.c index a89a1c79be..8835870694 100644 --- a/epan/dissectors/packet-sna.c +++ b/epan/dissectors/packet-sna.c @@ -2424,7 +2424,7 @@ dissect_control_0e(tvbuff_t *tvb, proto_tree *tree) buf = tvb_get_ephemeral_string(tvb, 3, len); EBCDIC_to_ASCII(buf, len); - proto_tree_add_string(tree, hf_sna_control_0e_value, tvb, 3, len, (char*)buf); + proto_tree_add_string(tree, hf_sna_control_0e_value, tvb, 3, len, buf); } static void diff --git a/epan/dissectors/packet-wsp.c b/epan/dissectors/packet-wsp.c index 9bdfa61bfc..15c07a204d 100644 --- a/epan/dissectors/packet-wsp.c +++ b/epan/dissectors/packet-wsp.c @@ -5910,7 +5910,7 @@ add_post_variable (proto_tree *tree, tvbuff_t *tvb, guint variableStart, guint v char *variableBuffer; char *valueBuffer; - variableBuffer = (char*)tvb_get_ephemeral_string(tvb, variableStart, variableLength); + variableBuffer = tvb_get_ephemeral_string(tvb, variableStart, variableLength); if (valueEnd < valueStart) { @@ -5923,7 +5923,7 @@ add_post_variable (proto_tree *tree, tvbuff_t *tvb, guint variableStart, guint v valueLength = valueEnd-valueStart; /* XXX - if this throws an exception, "variableBuffer" is leaked */ - valueBuffer = (char*)tvb_get_ephemeral_string(tvb, valueStart, valueLength); + valueBuffer = tvb_get_ephemeral_string(tvb, valueStart, valueLength); } /* Check for variables with no value */ diff --git a/epan/dissectors/packet-ymsg.c b/epan/dissectors/packet-ymsg.c index 4005508aca..1c2420b926 100644 --- a/epan/dissectors/packet-ymsg.c +++ b/epan/dissectors/packet-ymsg.c @@ -337,7 +337,7 @@ static gboolean dissect_ymsg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - if (tvb_memeql(tvb, 0, (guint8*)"YMSG", 4) == -1) { + if (tvb_memeql(tvb, 0, "YMSG", 4) == -1) { /* Not a Yahoo Messenger packet. */ return FALSE; } diff --git a/epan/proto.c b/epan/proto.c index f90fa183c6..b8fe50d426 100644 --- a/epan/proto.c +++ b/epan/proto.c @@ -943,7 +943,7 @@ proto_tree_new_item(field_info *new_fi, proto_tree *tree, int hfindex, string = ep_alloc(length); - tvb_memcpy(tvb, (guint8*)string, start, length); + tvb_memcpy(tvb, string, start, length); } else if (length == 0) { string = "[Empty]"; } else { @@ -978,7 +978,7 @@ proto_tree_new_item(field_info *new_fi, proto_tree *tree, int hfindex, * we made string values counted * rather than null-terminated.) */ - string = (gchar*)tvb_get_ephemeral_string(tvb, + string = tvb_get_ephemeral_string(tvb, start, length); } @@ -1965,7 +1965,7 @@ proto_tree_set_string_tvb(field_info *fi, tvbuff_t *tvb, gint start, gint length length = tvb_ensure_length_remaining(tvb, start); } - string = (gchar*)tvb_get_ephemeral_string(tvb, start, length); + string = tvb_get_ephemeral_string(tvb, start, length); proto_tree_set_string(fi, string); } @@ -3872,14 +3872,14 @@ proto_item_fill_label(field_info *fi, gchar *label_str) case FT_STRINGZ: case FT_UINT_STRING: bytes = fvalue_get(&fi->value); - if(strlen((char*)bytes) > ITEM_LABEL_LENGTH) { + if(strlen(bytes) > ITEM_LABEL_LENGTH) { ret = g_snprintf(label_str, ITEM_LABEL_LENGTH, "%s [truncated]: %s", hfinfo->name, - format_text(bytes, strlen((char*)bytes))); + format_text(bytes, strlen(bytes))); } else { ret = g_snprintf(label_str, ITEM_LABEL_LENGTH, "%s: %s", hfinfo->name, - format_text(bytes, strlen((char*)bytes))); + format_text(bytes, strlen(bytes))); } if ((ret == -1) || (ret >= ITEM_LABEL_LENGTH)) label_str[ITEM_LABEL_LENGTH - 1] = '\0'; diff --git a/epan/req_resp_hdrs.c b/epan/req_resp_hdrs.c index 078b2bab3f..6947c47052 100644 --- a/epan/req_resp_hdrs.c +++ b/epan/req_resp_hdrs.c @@ -148,7 +148,7 @@ req_resp_hdrs_do_reassembly(tvbuff_t *tvb, int offset, packet_info *pinfo, */ if (tvb_strncaseeql(tvb, next_offset_sav, "Content-Length:", 15) == 0) { - header_val = (gchar*)tvb_get_ephemeral_string(tvb, + header_val = tvb_get_ephemeral_string(tvb, next_offset_sav + 15, linelen - 15); if (sscanf(header_val, @@ -161,7 +161,7 @@ req_resp_hdrs_do_reassembly(tvbuff_t *tvb, int offset, packet_info *pinfo, } else if (tvb_strncaseeql(tvb, next_offset_sav, "Connection:", 11) == 0) { /* Check for keep-alive */ - header_val = (gchar*)tvb_get_ephemeral_string(tvb, + header_val = tvb_get_ephemeral_string(tvb, next_offset_sav + 11, linelen - 11); if(header_val){ @@ -184,7 +184,7 @@ req_resp_hdrs_do_reassembly(tvbuff_t *tvb, int offset, packet_info *pinfo, gchar *p; gint len; - header_val = (gchar*)tvb_get_ephemeral_string(tvb, + header_val = tvb_get_ephemeral_string(tvb, next_offset_sav + 18, linelen - 18); p = header_val; len = strlen(header_val); @@ -282,7 +282,7 @@ req_resp_hdrs_do_reassembly(tvbuff_t *tvb, int offset, packet_info *pinfo, } /* We have a line with the chunk size in it.*/ - chunk_string = (gchar*)tvb_get_ephemeral_string(tvb, next_offset, + chunk_string = tvb_get_ephemeral_string(tvb, next_offset, linelen); c = chunk_string; diff --git a/epan/sigcomp-udvm.c b/epan/sigcomp-udvm.c index 910529d565..d1d0259e59 100644 --- a/epan/sigcomp-udvm.c +++ b/epan/sigcomp-udvm.c @@ -2463,7 +2463,7 @@ execute_next_instruction: if (print_level_3 ){ proto_tree_add_text(udvm_tree, bytecode_tvb, 0, -1, " Addr: %5u State value: %u (0x%x) ASCII(%s)", - k,buff[k],buff[k],format_text((guchar*)string, 1)); + k,buff[k],buff[k],format_text(string, 1)); } k = ( k + 1 ) & 0xffff; n++; @@ -2584,7 +2584,7 @@ execute_next_instruction: if (print_level_3 ){ proto_tree_add_text(udvm_tree, bytecode_tvb, 0, -1, " Output value: %u (0x%x) ASCII(%s) from Addr: %u ,output to dispatcher position %u", - buff[k],buff[k],format_text((guchar*)string,1), k,output_address); + buff[k],buff[k],format_text(string,1), k,output_address); } k = ( k + 1 ) & 0xffff; output_address ++; diff --git a/epan/sigcomp_state_hdlr.c b/epan/sigcomp_state_hdlr.c index 623b5859bd..26e01f4e10 100644 --- a/epan/sigcomp_state_hdlr.c +++ b/epan/sigcomp_state_hdlr.c @@ -467,7 +467,7 @@ int udvm_state_access(tvbuff_t *tvb, proto_tree *tree,guint8 *buff,guint16 p_id_ partial_state[n] = buff[p_id_start + n]; n++; } - partial_state_str = bytes_to_str((guint8*)partial_state, p_id_length); + partial_state_str = bytes_to_str(partial_state, p_id_length); proto_tree_add_text(tree,tvb, 0, -1,"### Accessing state ###"); proto_tree_add_string(tree,hf_id, tvb, 0, 0, partial_state_str); @@ -581,7 +581,7 @@ void udvm_state_create(guint8 *state_buff,guint8 *state_identifier,guint16 p_id_ partial_state[i] = state_identifier[i]; i++; } - partial_state_str = bytes_to_str((guint8*)partial_state, p_id_length); + partial_state_str = bytes_to_str(partial_state, p_id_length); dummy_buff = g_hash_table_lookup(state_buffer_table, partial_state_str); if ( dummy_buff == NULL ){ diff --git a/epan/stats_tree.c b/epan/stats_tree.c index d63cb0f970..ec533ca7f0 100644 --- a/epan/stats_tree.c +++ b/epan/stats_tree.c @@ -48,13 +48,13 @@ static GHashTable* registry = NULL; extern void stats_tree_get_strs_from_node(const stat_node* node, guint8* value, guint8* rate, guint8* percent) { float f; - if (value) g_snprintf((char*)value,NUM_BUF_SIZE,"%u",node->counter); + if (value) g_snprintf(value,NUM_BUF_SIZE,"%u",node->counter); if (rate) { *rate = '\0'; if (node->st->elapsed > 0.0) { f = ((float)node->counter) / (float)node->st->elapsed; - g_snprintf((gchar*)rate,NUM_BUF_SIZE,"%f",f); + g_snprintf(rate,NUM_BUF_SIZE,"%f",f); } } @@ -62,7 +62,7 @@ extern void stats_tree_get_strs_from_node(const stat_node* node, guint8* value, *percent = '\0'; if (node->parent->counter > 0) { f = (float)(((float)node->counter * 100.0) / node->parent->counter); - g_snprintf((gchar*)percent,NUM_BUF_SIZE,"%.2f%%",f); + g_snprintf(percent,NUM_BUF_SIZE,"%.2f%%",f); } } } @@ -73,10 +73,10 @@ if buffer is NULL returns a newly allocated string */ extern guint8* stats_tree_node_to_str(const stat_node* node, guint8* buffer, guint len) { if (buffer) { - g_snprintf((gchar*)buffer,len,"%s: %i",node->name, node->counter); + g_snprintf(buffer,len,"%s: %i",node->name, node->counter); return buffer; } else { - return (guint8*)g_strdup_printf("%s: %i",node->name, node->counter); + return g_strdup_printf("%s: %i",node->name, node->counter); } } @@ -117,7 +117,7 @@ extern void stats_tree_branch_to_str(const stat_node* node, GString* s, guint in format = g_strdup_printf(" %%s%%-%us%%12s %%12s %%12s\n",stats_tree_branch_max_namelen(node,0)); } - stats_tree_get_strs_from_node(node, (guint8*)value, (guint8*)rate, (guint8*)percent); + stats_tree_get_strs_from_node(node, value, rate, percent); indent = indent > INDENT_MAX ? INDENT_MAX : indent; @@ -256,9 +256,9 @@ extern void stats_tree_register(const guint8* tapname, /* at the very least the abbrev and the packet function should be given */ g_assert( tapname && abbr && packet ); - cfg->tapname = (guint8*)g_strdup((gchar*)tapname); - cfg->abbr = (guint8*)g_strdup((gchar*)abbr); - cfg->name = name ? (guint8*)g_strdup((gchar*)name) : (guint8*)g_strdup((gchar*)abbr); + cfg->tapname = g_strdup(tapname); + cfg->abbr = g_strdup(abbr); + cfg->name = name ? g_strdup(name) : g_strdup(abbr); cfg->packet = packet; cfg->init = init; @@ -294,7 +294,7 @@ extern stats_tree* stats_tree_new(stats_tree_cfg* cfg, tree_pres* pr,char* filte st->elapsed = 0.0; st->root.counter = 0; - st->root.name = g_strdup((gchar*)cfg->name); + st->root.name = g_strdup(cfg->name); st->root.st = st; st->root.parent = NULL; st->root.children = NULL; @@ -494,7 +494,7 @@ extern int stats_tree_manip_node(manip_node_mode mode, stats_tree* st, const gui } if ( node == NULL ) - node = new_stat_node(st,(gchar*)name,parent_id,with_hash,with_hash); + node = new_stat_node(st,name,parent_id,with_hash,with_hash); switch (mode) { case MN_INCREASE: node->counter += value; break; @@ -518,7 +518,7 @@ extern guint8* stats_tree_get_abbr(const guint8* optarg) { for (i=0; optarg[i] && optarg[i] != ','; i++); if (optarg[i] == ',') { - return (guint8*)g_strndup((gchar*)optarg,i); + return g_strndup(optarg,i); } else { return NULL; } @@ -593,7 +593,7 @@ extern int stats_tree_create_range_node(stats_tree* st, va_start( list, parent_id ); while (( curr_range = va_arg(list, guint8*) )) { - range_node = new_stat_node(st, (gchar*)curr_range, rng_root->id, FALSE, FALSE); + range_node = new_stat_node(st, curr_range, rng_root->id, FALSE, FALSE); range_node->rng = get_range(curr_range); } va_end( list ); @@ -624,7 +624,7 @@ extern int stats_tree_range_node_with_pname(stats_tree* st, va_start( list, parent_name ); while (( curr_range = va_arg(list, guint8*) )) { - range_node = new_stat_node(st, (gchar*)curr_range, rng_root->id, FALSE, FALSE); + range_node = new_stat_node(st, curr_range, rng_root->id, FALSE, FALSE); range_node->rng = get_range(curr_range); } va_end( list ); @@ -703,7 +703,7 @@ extern int stats_tree_tick_pivot(stats_tree* st, stat_node* parent = g_ptr_array_index(st->parents,pivot_id); parent->counter++; - stats_tree_manip_node( MN_INCREASE, st, (guint8*)pivot_value, pivot_id, FALSE, 1); + stats_tree_manip_node( MN_INCREASE, st, pivot_value, pivot_id, FALSE, 1); return pivot_id; } diff --git a/epan/tvbparse.c b/epan/tvbparse.c index f37f103cc6..7b0114ddba 100644 --- a/epan/tvbparse.c +++ b/epan/tvbparse.c @@ -512,7 +512,7 @@ static int cond_hash(tvbparse_t* tt, int offset, const tvbparse_wanted_t* wanted if (key_len < 0) return -1; - key = (gchar*)tvb_get_ephemeral_string(key_elem->tvb,key_elem->offset,key_elem->len); + key = tvb_get_ephemeral_string(key_elem->tvb,key_elem->offset,key_elem->len); #ifdef TVBPARSE_DEBUG if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_HASH) g_warning("cond_hash: got key='%s'",key); #endif diff --git a/file.c b/file.c index cae3f8c5d5..1e739f4e0c 100644 --- a/file.c +++ b/file.c @@ -2741,7 +2741,7 @@ static gboolean match_ascii_and_unicode(capture_file *cf, frame_data *fdata, void *criterion) { cbs_t *info = criterion; - const char *ascii_text = (char*)info->data; + const char *ascii_text = info->data; size_t textlen = info->data_len; gboolean frame_matched; guint32 buf_len; @@ -2775,7 +2775,7 @@ static gboolean match_ascii(capture_file *cf, frame_data *fdata, void *criterion) { cbs_t *info = criterion; - const char *ascii_text = (char*)info->data; + const char *ascii_text = info->data; size_t textlen = info->data_len; gboolean frame_matched; guint32 buf_len; @@ -2807,7 +2807,7 @@ static gboolean match_unicode(capture_file *cf, frame_data *fdata, void *criterion) { cbs_t *info = criterion; - const char *ascii_text = (char*)info->data; + const char *ascii_text = info->data; size_t textlen = info->data_len; gboolean frame_matched; guint32 buf_len; diff --git a/gtk/find_dlg.c b/gtk/find_dlg.c index c4becfd534..53eb2a759d 100644 --- a/gtk/find_dlg.c +++ b/gtk/find_dlg.c @@ -677,7 +677,7 @@ find_frame_ok_cb(GtkWidget *ok_bt _U_, gpointer parent_w) } else { /* The raw packet data */ if(string){ - found_packet = cf_find_packet_data(&cfile, (guint8*)string, strlen(string)); + found_packet = cf_find_packet_data(&cfile, string, strlen(string)); g_free(string); } if (!found_packet) { @@ -751,7 +751,7 @@ find_previous_next(GtkWidget *w, gpointer d, gboolean sens) cf_find_packet_summary_line(&cfile, string); } else { /* The raw packet data */ - cf_find_packet_data(&cfile, (guint8*)string, strlen(string)); + cf_find_packet_data(&cfile, string, strlen(string)); } g_free(string); } else { diff --git a/gtk/follow_dlg.c b/gtk/follow_dlg.c index 343c578a2d..2ca7e6ff7b 100644 --- a/gtk/follow_dlg.c +++ b/gtk/follow_dlg.c @@ -694,7 +694,7 @@ follow_read_stream(follow_info_t *follow_info, case SHOW_EBCDIC: /* If our native arch is ASCII, call: */ - EBCDIC_to_ASCII((guint8*)buffer, nchars); + EBCDIC_to_ASCII(buffer, nchars); if (!(*print_line) (buffer, nchars, is_server, arg)) goto print_error; break; diff --git a/gtk/proto_draw.c b/gtk/proto_draw.c index ecd3be31b4..6840fb6e24 100644 --- a/gtk/proto_draw.c +++ b/gtk/proto_draw.c @@ -1458,7 +1458,7 @@ packet_hex_print_common(GtkWidget *bv, const guint8 *pd, int len, int bstart, else revstyle = "bold"; - gtk_text_buffer_insert_with_tags_by_name(buf, &iter, (gchar*)line, -1, + gtk_text_buffer_insert_with_tags_by_name(buf, &iter, line, -1, "plain", NULL); /* Do we start in reverse? */ reverse = i >= bstart && i < bend; @@ -1477,7 +1477,7 @@ packet_hex_print_common(GtkWidget *bv, const guint8 *pd, int len, int bstart, newreverse = i >= bstart && i < bend; /* Have we gone from reverse to plain? */ if (reverse && (reverse != newreverse)) { - gtk_text_buffer_insert_with_tags_by_name(buf, &iter, (gchar*)line, cur, + gtk_text_buffer_insert_with_tags_by_name(buf, &iter, line, cur, revstyle, NULL); cur = 0; } @@ -1491,7 +1491,7 @@ packet_hex_print_common(GtkWidget *bv, const guint8 *pd, int len, int bstart, } /* Have we gone from plain to reversed? */ if (!reverse && (reverse != newreverse)) { - gtk_text_buffer_insert_with_tags_by_name(buf, &iter, (gchar*)line, cur, + gtk_text_buffer_insert_with_tags_by_name(buf, &iter, line, cur, "plain", NULL); mark = gtk_text_buffer_create_mark(buf, NULL, &iter, TRUE); cur = 0; @@ -1499,13 +1499,13 @@ packet_hex_print_common(GtkWidget *bv, const guint8 *pd, int len, int bstart, reverse = newreverse; } /* Print remaining part of line */ - gtk_text_buffer_insert_with_tags_by_name(buf, &iter, (gchar*)line, cur, + gtk_text_buffer_insert_with_tags_by_name(buf, &iter, line, cur, reverse ? revstyle : "plain", NULL); cur = 0; /* Print some space at the end of the line */ line[cur++] = ' '; line[cur++] = ' '; line[cur++] = ' '; - gtk_text_buffer_insert_with_tags_by_name(buf, &iter, (gchar*)line, cur, + gtk_text_buffer_insert_with_tags_by_name(buf, &iter, line, cur, "plain", NULL); cur = 0; @@ -1532,7 +1532,7 @@ packet_hex_print_common(GtkWidget *bv, const guint8 *pd, int len, int bstart, newreverse = i >= bstart && i < bend; /* Have we gone from reverse to plain? */ if (reverse && (reverse != newreverse)) { - convline = g_locale_to_utf8((gchar*)line, cur, NULL, &newsize, NULL); + convline = g_locale_to_utf8(line, cur, NULL, &newsize, NULL); gtk_text_buffer_insert_with_tags_by_name(buf, &iter, convline, newsize, revstyle, NULL); g_free( (gpointer) convline); @@ -1546,7 +1546,7 @@ packet_hex_print_common(GtkWidget *bv, const guint8 *pd, int len, int bstart, } /* Have we gone from plain to reversed? */ if (!reverse && (reverse != newreverse)) { - convline = g_locale_to_utf8((gchar*)line, cur, NULL, &newsize, NULL); + convline = g_locale_to_utf8(line, cur, NULL, &newsize, NULL); gtk_text_buffer_insert_with_tags_by_name(buf, &iter, convline, newsize, "plain", NULL); g_free( (gpointer) convline); @@ -1555,14 +1555,14 @@ packet_hex_print_common(GtkWidget *bv, const guint8 *pd, int len, int bstart, reverse = newreverse; } /* Print remaining part of line */ - convline = g_locale_to_utf8((gchar*)line, cur, NULL, &newsize, NULL); + convline = g_locale_to_utf8(line, cur, NULL, &newsize, NULL); gtk_text_buffer_insert_with_tags_by_name(buf, &iter, convline, newsize, reverse ? revstyle : "plain", NULL); g_free( (gpointer) convline); cur = 0; line[cur++] = '\n'; - gtk_text_buffer_insert_with_tags_by_name(buf, &iter, (gchar*)line, cur, + gtk_text_buffer_insert_with_tags_by_name(buf, &iter, line, cur, "plain", NULL); #endif } @@ -1993,7 +1993,7 @@ tree_view_follow_link(field_info *fi) cf_goto_frame(&cfile, fi->value.value.uinteger); } if(FI_GET_FLAG(fi, FI_URL) && IS_FT_STRING(fi->hfinfo->type)) { - url = g_strndup((gchar*)tvb_get_ptr(fi->ds_tvb, fi->start, fi->length), fi->length); + url = g_strndup(tvb_get_ptr(fi->ds_tvb, fi->start, fi->length), fi->length); browser_open_url(url); g_free(url); } diff --git a/gtk/recent.c b/gtk/recent.c index 95c81379a8..929c65558b 100644 --- a/gtk/recent.c +++ b/gtk/recent.c @@ -489,7 +489,7 @@ recent_set_arg(char *prefarg) guchar *p, *colonp; int ret; - colonp = (guchar*)strchr(prefarg, ':'); + colonp = strchr(prefarg, ':'); if (colonp == NULL) return PREFS_SET_SYNTAX_ERR; @@ -513,7 +513,7 @@ recent_set_arg(char *prefarg) return PREFS_SET_SYNTAX_ERR; } - ret = read_set_recent_pair_static(prefarg, (gchar*)p, NULL); + ret = read_set_recent_pair_static(prefarg, p, NULL); *colonp = ':'; /* put the colon back */ return ret; } diff --git a/gtk/stats_tree_stat.c b/gtk/stats_tree_stat.c index a9b5340e40..e2caf8c9d3 100644 --- a/gtk/stats_tree_stat.c +++ b/gtk/stats_tree_stat.c @@ -131,8 +131,8 @@ static void draw_gtk_node(stat_node* node) { static gchar percent[NUM_BUF_SIZE]; stat_node* child; - stats_tree_get_strs_from_node(node, (guint8*)value, (guint8*)rate, - (guint8*)percent); + stats_tree_get_strs_from_node(node, value, rate, + percent); #if GTK_MAJOR_VERSION >= 2 if (node->st->pr->store && node->pr->iter) { @@ -230,7 +230,7 @@ static void reset_tap(void* p) { /* initializes the stats_tree window */ static void init_gtk_tree(const char* optarg, void *userdata _U_) { - guint8* abbr = stats_tree_get_abbr((guint8*)optarg); + guint8* abbr = stats_tree_get_abbr(optarg); stats_tree* st = NULL; stats_tree_cfg* cfg = NULL; tree_pres* pr = g_malloc(sizeof(tree_pres)); @@ -269,7 +269,7 @@ static void init_gtk_tree(const char* optarg, void *userdata _U_) { if (init_strlen == strlen(optarg)) { st = stats_tree_new(cfg,pr,NULL); } else { - st = stats_tree_new(cfg,pr,((gchar*)optarg)+init_strlen+1); + st = stats_tree_new(cfg,pr,(char*)optarg+init_strlen+1); } } else { @@ -371,7 +371,7 @@ static void init_gtk_tree(const char* optarg, void *userdata _U_) { gtk_container_add( GTK_CONTAINER(main_vb), scr_win); - error_string = register_tap_listener( (char*)cfg->tapname, + error_string = register_tap_listener( cfg->tapname, st, st->filter, reset_tap, @@ -419,7 +419,7 @@ static void register_gtk_stats_tree_tap (gpointer k _U_, gpointer v, gpointer p cfg->pr->stat_dlg->tap_init_cb = init_gtk_tree; cfg->pr->stat_dlg->index = -1; - register_dfilter_stat(cfg->pr->stat_dlg, (char*)cfg->name, + register_dfilter_stat(cfg->pr->stat_dlg, cfg->name, REGISTER_STAT_GROUP_NONE); } diff --git a/plugins/agentx/packet-agentx.c b/plugins/agentx/packet-agentx.c index 0c1a79dc36..f7b6b2c49c 100644 --- a/plugins/agentx/packet-agentx.c +++ b/plugins/agentx/packet-agentx.c @@ -306,7 +306,7 @@ static int dissect_octet_string(tvbuff_t *tvb, proto_tree *tree, int offset, cha p_noct = PADDING(n_oct); if (n_oct >= 1024) THROW(ReportedBoundsError); - tvb_get_nstringz(tvb, offset + 4, n_oct, (guint8*)context); + tvb_get_nstringz(tvb, offset + 4, n_oct, context); context[n_oct]='\0'; proto_tree_add_uint(tree,hf_ostring_len,tvb,offset,4,n_oct); diff --git a/plugins/asn1/packet-asn1.c b/plugins/asn1/packet-asn1.c index 6748292c4e..213ce4361e 100644 --- a/plugins/asn1/packet-asn1.c +++ b/plugins/asn1/packet-asn1.c @@ -580,12 +580,12 @@ showoctets(guchar *octets, guint len, guint hexlen) /* if len <= hexlen, always p += sprintf(p, "%2.2X", octets[i]); } *p++ = ' '; /* insert space */ - strncpy(p, (gchar *)octets, len); + strncpy(p, octets, len); p[len] = 0; } else { /* g_strdup_printf("%*s%s", len, octets, endstr) does not work ?? */ str = g_malloc(len+5); - strncpy(str, (gchar *)octets, len); + strncpy(str, octets, len); strcpy(&str[len], endstr); } } @@ -757,7 +757,7 @@ dissect_asn1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { asn1_header_decode(&asn1, &cls, &con, &tag, &def, &len); - asn1_close(&asn1, (gint *)&offset); + asn1_close(&asn1, &offset); PDUreset(pcount, 0); /* arguments are just for debugging */ getPDUprops(&props, boffset, cls, tag, con); @@ -822,7 +822,7 @@ dissect_asn1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { /* open BER decoding */ asn1_open(&asn1, tvb, offset); asn1_header_decode(&asn1, &cls, &con, &tag, &def, &len); - asn1_close(&asn1, (gint *)&offset); + asn1_close(&asn1, &offset); PDUreset(pcount, i+1); getPDUprops(&props, boffset, cls, tag, con); @@ -964,7 +964,7 @@ decode_asn1_sequence(tvbuff_t *tvb, guint offset, guint tlen, proto_tree *pt, in boffset = offset; asn1_open(&asn1, tvb, offset); ret = asn1_header_decode(&asn1, &cls, &con, &tag, &def, &len); - asn1_close(&asn1, (gint *)&offset); /* mark current position */ + asn1_close(&asn1, &offset); /* mark current position */ if (ret != ASN1_ERR_NOERROR) { proto_tree_add_text(pt, tvb, offset, 1, "ASN1 ERROR: %s", asn1_err_to_str(ret) ); break; @@ -1021,8 +1021,8 @@ decode_asn1_sequence(tvbuff_t *tvb, guint offset, guint tlen, proto_tree *pt, in case BER_CLASS_UNI: /* fprintf(stderr, "Universal\n"); */ switch(tag) { case BER_UNI_TAG_INTEGER: - ret = asn1_int32_value_decode(&asn1, len, (gint32 *)&value); /* read value */ - asn1_close(&asn1, (gint *)&offset); /* mark where we are now */ + ret = asn1_int32_value_decode(&asn1, len, &value); /* read value */ + asn1_close(&asn1, &offset); /* mark where we are now */ if (asn1_debug) { if ( (props.value_id == -1) || (tbl_types_wireshark[props.type] != FT_UINT32) ) @@ -1059,8 +1059,8 @@ decode_asn1_sequence(tvbuff_t *tvb, guint offset, guint tlen, proto_tree *pt, in break; case BER_UNI_TAG_ENUMERATED: - ret = asn1_int32_value_decode(&asn1, len, (gint32 *)&value); /* read value */ - asn1_close(&asn1, (gint *)&offset); /* mark where we are now */ + ret = asn1_int32_value_decode(&asn1, len, &value); /* read value */ + asn1_close(&asn1, &offset); /* mark where we are now */ ename = getPDUenum(&props, boffset, cls, tag, value); if (asn1_debug) { if ( (props.value_id == -1) || @@ -1159,12 +1159,12 @@ decode_asn1_sequence(tvbuff_t *tvb, guint offset, guint tlen, proto_tree *pt, in tname, name, ename, empty); else { proto_tree_add_string_format(pt, props.value_id, tvb, boffset, - offset - boffset, (gchar *)octets, /* \0 termnated */ + offset - boffset, octets, /* \0 termnated */ textfmt_s, boffset, clsstr, constr, tagstr, tname, name, ename, matchind); if (props.type_id != -1) proto_tree_add_string_hidden(pt, props.type_id, tvb, - boffset, offset - boffset, (gchar *)octets); + boffset, offset - boffset, octets); } } else { if ( (props.value_id == -1) || @@ -1175,11 +1175,11 @@ decode_asn1_sequence(tvbuff_t *tvb, guint offset, guint tlen, proto_tree *pt, in "(%s)%s: %s", tname, name, ename); else { proto_tree_add_string_format(pt, props.value_id, tvb, boffset, - offset - boffset, (gchar *)octets, /* \0 terminated */ + offset - boffset, octets, /* \0 terminated */ "(%s)%s: %s ~", tname, name, ename); if (props.type_id != -1) proto_tree_add_string_hidden(pt, props.type_id, tvb, - boffset, offset - boffset, (gchar *)octets); + boffset, offset - boffset, octets); } } g_free(octets); @@ -1188,7 +1188,7 @@ decode_asn1_sequence(tvbuff_t *tvb, guint offset, guint tlen, proto_tree *pt, in case BER_UNI_TAG_BITSTRING: ret = asn1_bits_decode(&asn1, len, &bits, &con, &unused); /* read value */ - asn1_close(&asn1, (gint *)&offset); /* mark where we are now */ + asn1_close(&asn1, &offset); /* mark where we are now */ ename = showbitnames(bits, (con*8)-unused, &props, offset); if (asn1_debug) { if ( (props.value_id == -1) || @@ -1312,11 +1312,11 @@ decode_asn1_sequence(tvbuff_t *tvb, guint offset, guint tlen, proto_tree *pt, in ename, empty); else { proto_tree_add_bytes_format(pt, props.value_id, tvb, boffset, - offset - boffset, (guint8 *)ename,/* XXX length?*/ + offset - boffset, ename,/* XXX length?*/ "(%s)%s: %s ~", tname, name, ename); if (props.type_id != -1) proto_tree_add_bytes_hidden(pt, props.type_id, tvb, - boffset, offset - boffset, (guint8 *)ename); + boffset, offset - boffset, ename); } } else { if ( (props.value_id == -1) || @@ -1327,11 +1327,11 @@ decode_asn1_sequence(tvbuff_t *tvb, guint offset, guint tlen, proto_tree *pt, in "(%s)%s: %s", tname, name, ename); else { proto_tree_add_bytes_format(pt, props.value_id, tvb, boffset, - offset - boffset, (guint8 *)ename, /* XXX length ? */ + offset - boffset, ename, /* XXX length ? */ "(%s)%s: %s ~", tname, name, ename); if (props.type_id != -1) proto_tree_add_bytes_hidden(pt, props.type_id, tvb, - boffset, offset - boffset, (guint8 *)ename); + boffset, offset - boffset, ename); } } g_free(oid); @@ -1384,7 +1384,7 @@ decode_asn1_sequence(tvbuff_t *tvb, guint offset, guint tlen, proto_tree *pt, in if (len > 4) goto dostring; ret = asn1_int32_value_decode(&asn1, len, (gint32 *)&value); /* read value */ - asn1_close(&asn1, (gint *)&offset); /* mark where we are now */ + asn1_close(&asn1, &offset); /* mark where we are now */ if (asn1_debug) { if ( (props.value_id == -1) || (tbl_types_wireshark[props.type] != FT_UINT32) ) @@ -1423,8 +1423,8 @@ decode_asn1_sequence(tvbuff_t *tvb, guint offset, guint tlen, proto_tree *pt, in case TBL_ENUMERATED: if (len > 4) goto dostring; - ret = asn1_int32_value_decode(&asn1, len, (gint32 *)&value); /* read value */ - asn1_close(&asn1, (gint *)&offset); /* mark where we are now */ + ret = asn1_int32_value_decode(&asn1, len, &value); /* read value */ + asn1_close(&asn1, &offset); /* mark where we are now */ ename = getPDUenum(&props, boffset, cls, tag, value); if (asn1_debug) { if ( (props.value_id == -1) || @@ -1759,7 +1759,7 @@ parse_tt3(tvbuff_t *tvb, guint offset, guint size, guint level, GNode *ptr) case BER_UNI_TAG_BOOLEAN: ret = asn1_bool_decode(&asn1, len, (gboolean *)&value); /* read value */ - asn1_close(&asn1, (gint *)&offset); /* mark where we are */ + asn1_close(&asn1, &offset); /* mark where we are */ break; case BER_UNI_TAG_OCTETSTRING: @@ -1771,13 +1771,13 @@ parse_tt3(tvbuff_t *tvb, guint offset, guint size, guint level, GNode *ptr) case BER_UNI_TAG_UTCTime: case BER_UNI_TAG_GeneralizedTime: ret = asn1_string_value_decode(&asn1, len, &octets); /* read value */ - asn1_close(&asn1, (gint *)&offset); /* mark where we are */ + asn1_close(&asn1, &offset); /* mark where we are */ g_free(octets); break; case BER_UNI_TAG_BITSTRING: ret = asn1_bits_decode(&asn1, len, &bits, &con, &unused); - asn1_close(&asn1, (gint *)&offset); /* mark where we are */ + asn1_close(&asn1, &offset); /* mark where we are */ g_free(bits); break; @@ -1794,7 +1794,7 @@ parse_tt3(tvbuff_t *tvb, guint offset, guint size, guint level, GNode *ptr) case BER_UNI_TAG_OID: ret = asn1_oid_value_decode(&asn1, len, &oid, &con); - asn1_close(&asn1, (gint *)&offset); /* mark where we are */ + asn1_close(&asn1, &offset); /* mark where we are */ g_free(oid); break; @@ -1822,7 +1822,7 @@ parse_tt3(tvbuff_t *tvb, guint offset, guint size, guint level, GNode *ptr) if (def && !con) { /* defined length, not constructed, must be a string.... */ asn1_string_value_decode(&asn1, len, &octets); /* read value */ - asn1_close(&asn1, (gint *)&offset); /* mark where we are */ + asn1_close(&asn1, &offset); /* mark where we are */ g_free(octets); } else { /* indefinite length or constructed.... must be a sequence .... */ @@ -2386,7 +2386,7 @@ is_typedef(GNode *node, gpointer data) if (d == 0) return FALSE; if (d->type != TBLTYPE_TypeDef) return FALSE; - if (strcmp(s->key, (gchar *)d->typeName) == 0) { + if (strcmp(s->key, d->typeName) == 0) { s->here = node; return TRUE; } @@ -2433,7 +2433,7 @@ is_named(GNode *node, gpointer data) if (num->value > n->used) /* track max used value, there may be holes... */ n->used = num->value; - n->info[num->value].name = (gchar *)num->name; + n->info[num->value].name = num->name; return FALSE; } @@ -2460,7 +2460,7 @@ index_typedef(GNode *node, gpointer data) n->used = d->typeDefId; t = &(n->info[d->typeDefId]); - t->name = (gchar *)d->typeName; + t->name = d->typeName; t->type = node; t->refs = g_ptr_array_new(); /* collect references here */ node = g_node_first_child(node); /* the real type */ @@ -2635,7 +2635,7 @@ showGNode(GNode *p, int n) case TBLTYPE_Type: { TBLType *t = (TBLType *)p->data; if (t->fieldName) - s = (gchar *)t->fieldName; + s = t->fieldName; /* typeId is a value from enum TBLTypeId */ fn = TBLTYPE(t->typeId); if (asn1_verbose) g_message("%*stype %d[%s]%s [%s]", n, empty, t->typeId, fn, @@ -2962,7 +2962,7 @@ tbl_typeref(guint n, GNode *pdu, GNode *tree, guint fullindex) p = g_malloc0(sizeof(PDUinfo)); nvals++; p->type = TBL_ENUMERATED; - p->name = (gchar *) (((TBLNamedNumber *)q->data)->name); + p->name = (((TBLNamedNumber *)q->data)->name); p->tag = (((TBLNamedNumber *)q->data)->value); p->flags = PDU_NAMEDNUM; if (asn1_verbose) g_message("%*s %3d %s", n*2, empty, p->tag, p->name); @@ -3071,9 +3071,9 @@ tbl_type(guint n, GNode *pdu, GNode *list, guint fullindex) /* indent, pdu, sour if (((TBLType *)list->data)->fieldName == 0) { /* no name assigned */ /* assign an anonymous name [XXX refer to parent typename...] */ ((TBLType *)list->data)->fieldName = - (guint8 *)g_strdup_printf("anon%d", anonCount++); + g_strdup_printf("anon%d", anonCount++); } - p->name = (gchar *)((TBLType *)list->data)->fieldName; + p->name = ((TBLType *)list->data)->fieldName; ni = fullindex; ni += g_snprintf(&fieldname[ni], sizeof(fieldname) - ni, ".%s", p->name); @@ -4950,7 +4950,7 @@ proto_register_asn1(void) { prefs_register_enum_preference(asn1_module, "type_recursion", "Eliminate references to level", "Allow this recursion level for eliminated type references", - (gint *)&type_recursion_level, + &type_recursion_level, type_recursion_opts, FALSE); prefs_register_bool_preference(asn1_module, "debug", "ASN.1 debug mode", diff --git a/plugins/irda/packet-irda.c b/plugins/irda/packet-irda.c index 5e71f883c4..92ee1f7e11 100644 --- a/plugins/irda/packet-irda.c +++ b/plugins/irda/packet-irda.c @@ -588,9 +588,9 @@ static void dissect_iap_request(tvbuff_t* tvb, packet_info* pinfo, proto_tree* r iap_conv->iap_query_frame = pinfo->fd->num; iap_conv->pattr_dissector = NULL; - tvb_memcpy(tvb, (guint8*)class_name, offset + 1 + 1, clen); + tvb_memcpy(tvb, class_name, offset + 1 + 1, clen); class_name[clen] = 0; - tvb_memcpy(tvb, (guint8*)attr_name, offset + 1 + 1 + clen + 1, alen); + tvb_memcpy(tvb, attr_name, offset + 1 + 1 + clen + 1, alen); attr_name[alen] = 0; /* Find the attribute dissector */ @@ -614,9 +614,9 @@ static void dissect_iap_request(tvbuff_t* tvb, packet_info* pinfo, proto_tree* r col_add_str(pinfo->cinfo, COL_INFO, "GetValueByClass: \""); - tvb_memcpy(tvb, (guint8*)buf, offset + 1 + 1, clen); + tvb_memcpy(tvb, buf, offset + 1 + 1, clen); memcpy(&buf[clen], "\" \"", 3); - tvb_memcpy(tvb, (guint8*)buf + clen + 3, offset + 1 + 1 + clen + 1, alen); + tvb_memcpy(tvb, buf + clen + 3, offset + 1 + 1 + clen + 1, alen); buf[clen + 3 + alen] = '\"'; buf[clen + 3 + alen + 1] = 0; col_append_str(pinfo->cinfo, COL_INFO, buf); @@ -762,7 +762,7 @@ static void dissect_iap_result(tvbuff_t* tvb, packet_info* pinfo, proto_tree* ro case IAS_STRING: strcpy(buf, ", \""); n = tvb_get_guint8(tvb, offset + 8); - tvb_memcpy(tvb, (guint8*)buf + 3, offset + 9, n); + tvb_memcpy(tvb, buf + 3, offset + 9, n); strcpy(buf + 3 + n, "\""); break; } @@ -1643,7 +1643,7 @@ static void dissect_xid(tvbuff_t* tvb, packet_info* pinfo, proto_tree* root, pro if (name_len > 22) name_len = 22; - tvb_memcpy(tvb, (guint8*)buf, offset, name_len); + tvb_memcpy(tvb, buf, offset, name_len); buf[name_len] = 0; col_append_str(pinfo->cinfo, COL_INFO, ", \""); col_append_str(pinfo->cinfo, COL_INFO, buf); @@ -1690,7 +1690,7 @@ static void dissect_log(tvbuff_t* tvb, packet_info* pinfo, proto_tree* root) length = tvb_length(tvb); if (length > sizeof(buf)-1) length = sizeof(buf)-1; - tvb_memcpy(tvb, (guint8*)buf, 0, length); + tvb_memcpy(tvb, buf, 0, length); buf[length] = 0; if (buf[length-1] == '\n') buf[length-1] = 0; diff --git a/plugins/mgcp/packet-mgcp.c b/plugins/mgcp/packet-mgcp.c index 4858ea70f2..870e0d6e30 100644 --- a/plugins/mgcp/packet-mgcp.c +++ b/plugins/mgcp/packet-mgcp.c @@ -958,7 +958,7 @@ static gboolean is_mgcp_verb(tvbuff_t *tvb, gint offset, gint maxlength, const g gchar word[5]; /* Read the string into 'word' and see if it looks like the start of a verb */ - if ((maxlength >= 4) && tvb_get_nstringz0(tvb, offset, sizeof(word), (guint8*)word)) + if ((maxlength >= 4) && tvb_get_nstringz0(tvb, offset, sizeof(word), word)) { if (((strncasecmp(word, "EPCF", 4) == 0) && (*verb_name = "EndpointConfiguration")) || ((strncasecmp(word, "CRCX", 4) == 0) && (*verb_name = "CreateConnection")) || @@ -1332,7 +1332,7 @@ static gint tvb_parse_param(tvbuff_t* tvb, gint offset, gint len, int** hf) /* set the observedEvents or signalReq used in Voip Calls analysis */ if (buf != NULL) { - *buf = (gchar*)tvb_get_ephemeral_string(tvb, tvb_current_offset, (len - tvb_current_offset + offset)); + *buf = tvb_get_ephemeral_string(tvb, tvb_current_offset, (len - tvb_current_offset + offset)); } } } @@ -1841,7 +1841,7 @@ dissect_mgcp_connectionparams(proto_tree *parent_tree, tvbuff_t *tvb, gint offse /* The P: line */ offset += param_type_len; /* skip the P: */ - tokenline = (gchar*)tvb_get_ephemeral_string(tvb, offset, param_val_len); + tokenline = tvb_get_ephemeral_string(tvb, offset, param_val_len); /* Split into type=value pairs separated by comma */ tokens = ep_strsplit(tokenline, ",", -1); @@ -1953,7 +1953,7 @@ dissect_mgcp_localconnectionoptions(proto_tree *parent_tree, tvbuff_t *tvb, gint /* The L: line */ offset += param_type_len; /* skip the L: */ - tokenline = (gchar*)tvb_get_ephemeral_string(tvb, offset, param_val_len); + tokenline = tvb_get_ephemeral_string(tvb, offset, param_val_len); /* Split into type=value pairs separated by comma */ tokens = ep_strsplit(tokenline, ",", -1); diff --git a/plugins/opsi/packet-opsi.c b/plugins/opsi/packet-opsi.c index 1ee5ec9336..e5cb0fdb8f 100644 --- a/plugins/opsi/packet-opsi.c +++ b/plugins/opsi/packet-opsi.c @@ -339,7 +339,7 @@ void decode_string_attribute(tvbuff_t *tvb, proto_tree *tree, int* hfValue, int } pbuffer=tvb_get_string(tvb, offset+4, length-4); - proto_tree_add_string(tree, *hfValue, tvb, offset+4, length-4, (char*)pbuffer); + proto_tree_add_string(tree, *hfValue, tvb, offset+4, length-4, pbuffer); g_free(pbuffer); } diff --git a/plugins/sbus/packet-sbus.c b/plugins/sbus/packet-sbus.c index 62cb38c90e..a761143c58 100644 --- a/plugins/sbus/packet-sbus.c +++ b/plugins/sbus/packet-sbus.c @@ -1098,13 +1098,13 @@ dissect_sbus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Response: Firmware version */ case SBUS_RD_PROGRAM_VERSION: /*PCD type*/ - tmp_string = (char*)tvb_get_string(tvb, offset, 5); + tmp_string = tvb_get_string(tvb, offset, 5); proto_tree_add_string(sbus_tree, hf_sbus_cpu_type, tvb, offset, 5, tmp_string); offset += 5; g_free(tmp_string); /*FW version*/ - tmp_string = (char*)tvb_get_string(tvb , offset, 3); + tmp_string = tvb_get_string(tvb , offset, 3); proto_tree_add_string(sbus_tree, hf_sbus_fw_version, tvb, offset, 3, tmp_string); offset += 4; diff --git a/plugins/stats_tree/pinfo_stats_tree.c b/plugins/stats_tree/pinfo_stats_tree.c index 023fd674c1..4706c77609 100644 --- a/plugins/stats_tree/pinfo_stats_tree.c +++ b/plugins/stats_tree/pinfo_stats_tree.c @@ -60,12 +60,12 @@ static void ip_hosts_stats_tree_init(stats_tree* st) { static int ip_hosts_stats_tree_packet(stats_tree *st , packet_info *pinfo, epan_dissect_t *edt _U_, const void *p _U_) { static guint8 str[128]; - tick_stat_node(st, (guint8*)st_str_ip, 0, FALSE); + tick_stat_node(st, st_str_ip, 0, FALSE); - g_snprintf((char*)str, sizeof(str),"%s",address_to_str(&pinfo->net_src)); + g_snprintf(str, sizeof(str),"%s",address_to_str(&pinfo->net_src)); tick_stat_node(st, str, st_node_ip, FALSE); - g_snprintf((char*)str, sizeof(str),"%s",address_to_str(&pinfo->net_dst)); + g_snprintf(str, sizeof(str),"%s",address_to_str(&pinfo->net_dst)); tick_stat_node(st, str, st_node_ip, FALSE); return 1; @@ -98,7 +98,7 @@ static void plen_stats_tree_init(stats_tree* st) { } static int plen_stats_tree_packet(stats_tree* st, packet_info* pinfo, epan_dissect_t *edt _U_, const void *p _U_) { - tick_stat_node(st, (guint8*)st_str_plen, 0, FALSE); + tick_stat_node(st, st_str_plen, 0, FALSE); stats_tree_tick_range(st, st_str_plen, 0, pinfo->fd->pkt_len); return 1; @@ -122,14 +122,14 @@ static int dsts_stats_tree_packet(stats_tree* st, packet_info* pinfo, epan_disse int ip_dst_node; int proto_node; - tick_stat_node(st, (guint8*)st_str_dsts, 0, FALSE); + tick_stat_node(st, st_str_dsts, 0, FALSE); - g_snprintf((char*)str, sizeof(str),"%s",address_to_str(&pinfo->net_src)); + g_snprintf(str, sizeof(str),"%s",address_to_str(&pinfo->net_src)); ip_dst_node = tick_stat_node(st, str, st_node_dsts, TRUE); - proto_node = tick_stat_node(st,(guint8*)port_type_to_str(pinfo->ptype),ip_dst_node,TRUE); + proto_node = tick_stat_node(st,port_type_to_str(pinfo->ptype),ip_dst_node,TRUE); - g_snprintf((char*)str, sizeof(str),"%u",pinfo->destport); + g_snprintf(str, sizeof(str),"%u",pinfo->destport); tick_stat_node(st,str,proto_node,TRUE); return 1; @@ -137,9 +137,9 @@ static int dsts_stats_tree_packet(stats_tree* st, packet_info* pinfo, epan_disse /* register all pinfo trees */ void register_pinfo_stat_trees(void) { - stats_tree_register((guint8*)"ip",(guint8*)"ip_hosts",(guint8*)st_str_ip, ip_hosts_stats_tree_packet, ip_hosts_stats_tree_init, NULL ); - stats_tree_register((guint8*)"ip",(guint8*)"ptype",(guint8*)st_str_ptype, ptype_stats_tree_packet, ptype_stats_tree_init, NULL ); - stats_tree_register((guint8*)"frame",(guint8*)"plen",(guint8*)st_str_plen, plen_stats_tree_packet, plen_stats_tree_init, NULL ); - stats_tree_register((guint8*)"ip",(guint8*)"dests",(guint8*)st_str_dsts, dsts_stats_tree_packet, dsts_stats_tree_init, NULL ); + stats_tree_register("ip","ip_hosts",st_str_ip, ip_hosts_stats_tree_packet, ip_hosts_stats_tree_init, NULL ); + stats_tree_register("ip","ptype",st_str_ptype, ptype_stats_tree_packet, ptype_stats_tree_init, NULL ); + stats_tree_register("frame","plen",st_str_plen, plen_stats_tree_packet, plen_stats_tree_init, NULL ); + stats_tree_register("ip","dests",st_str_dsts, dsts_stats_tree_packet, dsts_stats_tree_init, NULL ); } diff --git a/print.c b/print.c index 530932616a..9b39dd07e9 100644 --- a/print.c +++ b/print.c @@ -829,7 +829,7 @@ print_hex_data_buffer(print_stream_t *stream, const guchar *cp, * and advance the offset. */ line[k] = '\0'; - if (!print_line(stream, 0, (char*)line)) + if (!print_line(stream, 0, line)) return FALSE; ad += 16; } @@ -1040,7 +1040,7 @@ print_preamble_ps(print_stream_t *self, gchar *filename) fputs("/Courier findfont 10 scalefont setfont\n", output->fh); fputs("\n", output->fh); fputs("%% the page title\n", output->fh); - ps_clean_string(psbuffer, (guchar*)filename, MAX_PS_LINE_LENGTH); + ps_clean_string(psbuffer, filename, MAX_PS_LINE_LENGTH); fprintf(output->fh, "/eth_pagetitle (%s - Wireshark) def\n", psbuffer); fputs("\n", output->fh); return !ferror(output->fh); @@ -1052,7 +1052,7 @@ print_line_ps(print_stream_t *self, int indent, const char *line) output_ps *output = self->data; unsigned char psbuffer[MAX_PS_LINE_LENGTH]; /* static sized buffer! */ - ps_clean_string(psbuffer, (guchar*)line, MAX_PS_LINE_LENGTH); + ps_clean_string(psbuffer, line, MAX_PS_LINE_LENGTH); fprintf(output->fh, "%d (%s) putline\n", indent, psbuffer); return !ferror(output->fh); } @@ -1076,7 +1076,7 @@ print_bookmark_ps(print_stream_t *self, const gchar *name, const gchar *title) * * The "/DEST" creates the destination. */ - ps_clean_string(psbuffer, (guchar*)title, MAX_PS_LINE_LENGTH); + ps_clean_string(psbuffer, title, MAX_PS_LINE_LENGTH); fprintf(output->fh, "[/Dest /%s /Title (%s) /OUT pdfmark\n", name, psbuffer); fputs("[/View [/XYZ -4 currentpoint matrix currentmatrix matrix defaultmatrix\n", diff --git a/tap-stats_tree.c b/tap-stats_tree.c index 08845acb84..da4244b0a1 100644 --- a/tap-stats_tree.c +++ b/tap-stats_tree.c @@ -70,7 +70,7 @@ static void draw_stats_tree(void *psp) { } static void init_stats_tree(const char *optarg,void* userdata _U_) { - guint8* abbr = stats_tree_get_abbr((guint8*)optarg); + guint8* abbr = stats_tree_get_abbr(optarg); GString *error_string; stats_tree_cfg *cfg = NULL; stats_tree* st = NULL; @@ -79,8 +79,8 @@ static void init_stats_tree(const char *optarg,void* userdata _U_) { cfg = stats_tree_get_cfg_by_abbr(abbr); if (cfg != NULL) { - if (strncmp (optarg, (char*)cfg->pr->init_string, strlen((char*)cfg->pr->init_string)) == 0){ - st = stats_tree_new(cfg,NULL,(char*)(optarg)+strlen((char*)cfg->pr->init_string)); + if (strncmp (optarg, cfg->pr->init_string, strlen(cfg->pr->init_string)) == 0){ + st = stats_tree_new(cfg,NULL,(char*)(optarg)+strlen(cfg->pr->init_string)); } else { report_failure("Wrong stats_tree (%s) found when looking at ->init_string",abbr); return; @@ -97,7 +97,7 @@ static void init_stats_tree(const char *optarg,void* userdata _U_) { return; } - error_string = register_tap_listener((char*)st->cfg->tapname, + error_string = register_tap_listener(st->cfg->tapname, st, st->filter, stats_tree_reset, @@ -117,9 +117,9 @@ void register_stats_tree_tap (gpointer k _U_, gpointer v, gpointer p _U_) { stats_tree_cfg* cfg = v; cfg->pr = g_malloc(sizeof(tree_cfg_pres)); - cfg->pr->init_string = (guint8*)g_strdup_printf("%s,tree",cfg->abbr); + cfg->pr->init_string = g_strdup_printf("%s,tree",cfg->abbr); - register_stat_cmd_arg((char*)cfg->pr->init_string, init_stats_tree, NULL); + register_stat_cmd_arg(cfg->pr->init_string, init_stats_tree, NULL); } diff --git a/text2pcap.c b/text2pcap.c index 4459da1fbf..ea058f2249 100644 --- a/text2pcap.c +++ b/text2pcap.c @@ -696,7 +696,7 @@ append_to_preamble(char *str) if (toklen != 0) { if (packet_preamble_len + toklen > PACKET_PREAMBLE_MAX_LEN) return; /* no room to add the token to the preamble */ - strcpy((char*)&packet_preamble[packet_preamble_len], str); + strcpy(&packet_preamble[packet_preamble_len], str); packet_preamble_len += toklen; } } @@ -731,7 +731,7 @@ parse_preamble (void) /* Ensure preamble has more than two chars before atempting to parse. * This should cover line breaks etc that get counted. */ - if ( strlen((char*)packet_preamble) > 2 ) { + if ( strlen(packet_preamble) > 2 ) { /* * Initialize to the Epoch, just in case not all fields * of the date and time are specified. @@ -747,7 +747,7 @@ parse_preamble (void) timecode.tm_isdst = -1; /* Get Time leaving subseconds */ - subsecs = strptime( (char*)packet_preamble, ts_fmt, &timecode ); + subsecs = strptime( packet_preamble, ts_fmt, &timecode ); if (subsecs != NULL) { /* Get the long time from the tm structure */ ts_sec = (gint32)mktime( &timecode ); diff --git a/wiretap/configure.in b/wiretap/configure.in index 6b66777d94..18fb0fff81 100644 --- a/wiretap/configure.in +++ b/wiretap/configure.in @@ -66,6 +66,23 @@ else fi rm -rf conftest* +AC_MSG_CHECKING(to see if we can add '-Wno-pointer-sign' to CFLAGS) +if test x$GCC == xyes ; then + # some versions of GCC support this directive + rm -rf conftest* + echo "int foo;" >>conftest.c + if $CC -c -o conftest.o conftest.c -Wno-pointer-sign > /dev/null 2>&1 ; then + CFLAGS="$CFLAGS -Wno-pointer-sign" + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + fi +else + # non-gcc compilers do not support this directive + AC_MSG_RESULT(no) +fi +rm -rf conftest* + AC_ARG_WITH(warnings-as-errors, [ --with-warnings-as-errors Treat warnings as errors (if using gcc). [default=no]], [ diff --git a/wiretap/iseries.c b/wiretap/iseries.c index f4ff2dd2b3..19554e3822 100644 --- a/wiretap/iseries.c +++ b/wiretap/iseries.c @@ -273,7 +273,7 @@ iseries_check_file_type (wtap * wth, int *err, int format) */ if (wth->capture.iseries->format == ISERIES_FORMAT_UNICODE) { - iseries_UNICODE_to_ASCII ((guint8*)buf, ISERIES_LINE_LENGTH); + iseries_UNICODE_to_ASCII (buf, ISERIES_LINE_LENGTH); } num_items_scanned = sscanf (buf, " Object protocol . . . . . . : %8s", @@ -384,7 +384,7 @@ iseries_seek_next_packet (wtap * wth, int *err) if (wth->capture.iseries->format == ISERIES_FORMAT_UNICODE) { /* buflen is #bytes to 1st 0x0A */ - buflen = iseries_UNICODE_to_ASCII ((guint8*)buf, ISERIES_LINE_LENGTH); + buflen = iseries_UNICODE_to_ASCII (buf, ISERIES_LINE_LENGTH); } else { @@ -502,7 +502,7 @@ iseries_parse_packet (wtap * wth, FILE_T fh, /* Convert UNICODE data to ASCII */ if (wth->capture.iseries->format == ISERIES_FORMAT_UNICODE) { - iseries_UNICODE_to_ASCII ((guint8*)data, ISERIES_LINE_LENGTH); + iseries_UNICODE_to_ASCII (data, ISERIES_LINE_LENGTH); } /* look for packet header */ num_items_scanned = @@ -543,7 +543,7 @@ iseries_parse_packet (wtap * wth, FILE_T fh, if (wth->capture.iseries->sdate) { num_items_scanned = - sscanf ((char*)wth->capture.iseries->sdate, "%d/%d/%d", &month, &day, &year); + sscanf (wth->capture.iseries->sdate, "%d/%d/%d", &month, &day, &year); tm.tm_year = 100 + year; tm.tm_mon = month - 1; tm.tm_mday = day; @@ -578,9 +578,9 @@ iseries_parse_packet (wtap * wth, FILE_T fh, * Allocate 2 work buffers to handle concatentation of the hex data block */ tcpdatabuf = g_malloc (ISERIES_PKT_ALLOC_SIZE); - g_snprintf ((gchar*)tcpdatabuf, 1, "%s", ""); + g_snprintf (tcpdatabuf, 1, "%s", ""); workbuf = g_malloc (ISERIES_PKT_ALLOC_SIZE); - g_snprintf ((gchar*)workbuf, 1, "%s", ""); + g_snprintf (workbuf, 1, "%s", ""); /* loop through packet lines and breakout when the next packet header is read */ pktline = 0; while (isCurrentPacket) @@ -607,7 +607,7 @@ iseries_parse_packet (wtap * wth, FILE_T fh, /* Convert UNICODE data to ASCII and determine line length */ if (wth->capture.iseries->format == ISERIES_FORMAT_UNICODE) { - buflen = iseries_UNICODE_to_ASCII ((guint8*)data, ISERIES_LINE_LENGTH); + buflen = iseries_UNICODE_to_ASCII (data, ISERIES_LINE_LENGTH); } else { @@ -649,19 +649,19 @@ iseries_parse_packet (wtap * wth, FILE_T fh, switch (num_items_scanned) { case 1: - g_snprintf ((gchar*)workbuf, ISERIES_PKT_ALLOC_SIZE, "%s%s", tcpdatabuf, + g_snprintf (workbuf, ISERIES_PKT_ALLOC_SIZE, "%s%s", tcpdatabuf, hex1); break; case 2: - g_snprintf ((gchar*)workbuf, ISERIES_PKT_ALLOC_SIZE, "%s%s%s", + g_snprintf (workbuf, ISERIES_PKT_ALLOC_SIZE, "%s%s%s", tcpdatabuf, hex1, hex2); break; case 3: - g_snprintf ((gchar*)workbuf, ISERIES_PKT_ALLOC_SIZE, "%s%s%s%s", + g_snprintf (workbuf, ISERIES_PKT_ALLOC_SIZE, "%s%s%s%s", tcpdatabuf, hex1, hex2, hex3); break; default: - g_snprintf ((gchar*)workbuf, ISERIES_PKT_ALLOC_SIZE, "%s%s%s%s%s", + g_snprintf (workbuf, ISERIES_PKT_ALLOC_SIZE, "%s%s%s%s%s", tcpdatabuf, hex1, hex2, hex3, hex4); } memcpy (tcpdatabuf, workbuf, ISERIES_PKT_ALLOC_SIZE); @@ -720,20 +720,20 @@ iseries_parse_packet (wtap * wth, FILE_T fh, if (wth->capture.iseries->tcp_formatted) { /* build string for formatted fields */ - g_snprintf ((gchar*)asciibuf, ISERIES_PKT_ALLOC_SIZE, "%s%s%s%s%s%s", + g_snprintf (asciibuf, ISERIES_PKT_ALLOC_SIZE, "%s%s%s%s%s%s", destmac, srcmac, type, ipheader, tcpheader, tcpdatabuf); } else { /* build string for unformatted data fields */ - g_snprintf ((gchar*)asciibuf, ISERIES_PKT_ALLOC_SIZE, "%s%s%s%s", destmac, + g_snprintf (asciibuf, ISERIES_PKT_ALLOC_SIZE, "%s%s%s%s", destmac, srcmac, type, tcpdatabuf); } } else { /* No data in the packet */ - g_snprintf ((gchar*)asciibuf, ISERIES_PKT_ALLOC_SIZE, "%s%s%s%s%s", destmac, + g_snprintf (asciibuf, ISERIES_PKT_ALLOC_SIZE, "%s%s%s%s%s", destmac, srcmac, type, ipheader, tcpheader); } @@ -741,7 +741,7 @@ iseries_parse_packet (wtap * wth, FILE_T fh, * Extract the packet length from the actual IP header, this may differ from the capture length * reported by the formatted trace */ - num_items_scanned = sscanf ((gchar*)asciibuf + 32, "%4x", &pkt_len); + num_items_scanned = sscanf (asciibuf + 32, "%4x", &pkt_len); wth->phdr.len = pkt_len + 14; /* Make sure we have enough room for the packet, only create buffer if none supplied */ @@ -750,12 +750,12 @@ iseries_parse_packet (wtap * wth, FILE_T fh, buffer_assure_space (wth->frame_buffer, ISERIES_MAX_PACKET_LEN); buf = buffer_start_ptr (wth->frame_buffer); /* Convert ascii data to binary and return in the frame buffer */ - iseries_parse_hex_string (asciibuf, buf, strlen ((gchar*)asciibuf)); + iseries_parse_hex_string (asciibuf, buf, strlen (asciibuf)); } else { /* Convert ascii data to binary and return in the frame buffer */ - iseries_parse_hex_string (asciibuf, pd, strlen ((gchar*)asciibuf)); + iseries_parse_hex_string (asciibuf, pd, strlen (asciibuf)); } /* free buffers allocs and return */ -- cgit v1.2.3