Fix some const/ not const warnings.

svn path=/trunk/; revision=54114
This commit is contained in:
Jakub Zawadzki 2013-12-15 12:35:00 +00:00
parent db1b70f168
commit 2c015bb386
20 changed files with 41 additions and 43 deletions

View File

@ -1451,7 +1451,7 @@ build_simple_avp(const avp_type_t *type, guint32 code, const diam_vnd_t *vendor,
while (vs[i].strptr) {
i++;
}
vs_ext = value_string_ext_new((value_string *)vs, i+1, wmem_strdup_printf(wmem_epan_scope(), "%s_vals_ext",name));
vs_ext = value_string_ext_new(vs, i+1, wmem_strdup_printf(wmem_epan_scope(), "%s_vals_ext",name));
base = (field_display_e)(base|BASE_EXT_STRING);
}

View File

@ -1370,14 +1370,14 @@ static gboolean dmp_dec_xbyte_sic (guint64 bin, gchar *sic,
static guint dmp_id_hash (gconstpointer k)
{
dmp_id_key *dmpx=(dmp_id_key *)k;
const dmp_id_key *dmpx=(const dmp_id_key *)k;
return dmpx->id;
}
static gint dmp_id_hash_equal (gconstpointer k1, gconstpointer k2)
{
dmp_id_key *dmp1=(dmp_id_key *)k1;
dmp_id_key *dmp2=(dmp_id_key *)k2;
const dmp_id_key *dmp1=(const dmp_id_key *)k1;
const dmp_id_key *dmp2=(const dmp_id_key *)k2;
if (dmp1->id != dmp2->id)
return 0;

View File

@ -442,8 +442,8 @@ static gboolean ositp_decode_var_part(tvbuff_t *tvb, int offset, int vp_length,
}
checksum_ok = check_atn_ec_16(tvb, tpdu_len , offset,
offset_iso8073_checksum,
pinfo->dst.len, (guint8 *)pinfo->dst.data,
pinfo->src.len, (guint8 *)pinfo->src.data);
pinfo->dst.len, (const guint8 *)pinfo->dst.data,
pinfo->src.len, (const guint8 *)pinfo->src.data);
proto_tree_add_text(tree, tvb, offset, length,
"ATN extended checksum : 0x%04x (%s)",
tvb_get_ntohs(tvb, offset),
@ -475,8 +475,8 @@ static gboolean ositp_decode_var_part(tvbuff_t *tvb, int offset, int vp_length,
}
checksum_ok = check_atn_ec_32(tvb, tpdu_len , offset,
offset_iso8073_checksum,
pinfo->dst.len, (guint8 *)pinfo->dst.data,
pinfo->src.len, (guint8 *)pinfo->src.data);
pinfo->dst.len, (const guint8 *)pinfo->dst.data,
pinfo->src.len, (const guint8 *)pinfo->src.data);
proto_tree_add_text(tree, tvb, offset, length,
"ATN extended checksum : 0x%08x (%s)",
tvb_get_ntohl(tvb, offset),

View File

@ -1204,9 +1204,9 @@ dissect_ospf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
and a prepended IPv6 pseudo-header. */
/* Set up the fields of the pseudo-header. */
cksum_vec[0].ptr = (guint8 *)pinfo->src.data;
cksum_vec[0].ptr = (const guint8 *)pinfo->src.data;
cksum_vec[0].len = pinfo->src.len;
cksum_vec[1].ptr = (guint8 *)pinfo->dst.data;
cksum_vec[1].ptr = (const guint8 *)pinfo->dst.data;
cksum_vec[1].len = pinfo->dst.len;
cksum_vec[2].ptr = (const guint8 *)&phdr;
phdr[0] = g_htonl(ospflen);

View File

@ -762,9 +762,9 @@ dissect_pim(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
break;
case AT_IPv6:
/* Set up the fields of the pseudo-header. */
cksum_vec[0].ptr = (guint8 *)pinfo->src.data;
cksum_vec[0].ptr = (const guint8 *)pinfo->src.data;
cksum_vec[0].len = pinfo->src.len;
cksum_vec[1].ptr = (guint8 *)pinfo->dst.data;
cksum_vec[1].ptr = (const guint8 *)pinfo->dst.data;
cksum_vec[1].len = pinfo->dst.len;
cksum_vec[2].ptr = (const guint8 *)&phdr;
phdr[0] = g_htonl(pim_length);

View File

@ -140,7 +140,7 @@ static guint num_uat_key_records = 0;
static void* uat_key_record_copy_cb(void* n, const void* o, size_t siz _U_) {
uat_key_record_t* new_key = (uat_key_record_t *)n;
const uat_key_record_t* old_key = (uat_key_record_t *)o;
const uat_key_record_t* old_key = (const uat_key_record_t *)o;
if (old_key->string) {
new_key->string = g_strdup(old_key->string);

View File

@ -82,7 +82,7 @@ ResolveWin32UUID(e_guid_t if_id, char *uuid_name, int uuid_name_max_len)
/* store a guid to name mapping */
void
guids_add_guid(e_guid_t *guid, const gchar *name)
guids_add_guid(const e_guid_t *guid, const gchar *name)
{
wmem_tree_key_t guidkey[2];
guint32 g[4];
@ -119,7 +119,7 @@ guids_add_guid(e_guid_t *guid, const gchar *name)
/* retrieve the registered name for this GUID */
const gchar *
guids_get_guid_name(e_guid_t *guid)
guids_get_guid_name(const e_guid_t *guid)
{
wmem_tree_key_t guidkey[2];
guint32 g[4];
@ -184,7 +184,7 @@ guids_init(void)
Formats uuid number and returns the resulting string, if name is unknown.
(derived from val_to_str) */
const gchar *
guids_resolve_guid_to_str(e_guid_t *guid)
guids_resolve_guid_to_str(const e_guid_t *guid)
{
const gchar *name;

View File

@ -43,14 +43,14 @@ typedef struct _e_guid_t {
WS_DLL_PUBLIC void guids_init(void);
/* add a GUID */
WS_DLL_PUBLIC void guids_add_guid(e_guid_t *guid, const gchar *name);
WS_DLL_PUBLIC void guids_add_guid(const e_guid_t *guid, const gchar *name);
/* try to get registered name for this GUID */
WS_DLL_PUBLIC const gchar *guids_get_guid_name(e_guid_t *guid);
WS_DLL_PUBLIC const gchar *guids_get_guid_name(const e_guid_t *guid);
/* resolve GUID to name (or if unknown to hex string) */
/* (if you need hex string only, use guid_to_str instead) */
WS_DLL_PUBLIC const gchar* guids_resolve_guid_to_str(e_guid_t *guid);
WS_DLL_PUBLIC const gchar* guids_resolve_guid_to_str(const e_guid_t *guid);
/* add a UUID (dcerpc_init_uuid() will call this too) */
#define guids_add_uuid(uuid, name) guids_add_guid((e_guid_t *) (uuid), (name))

View File

@ -1357,8 +1357,8 @@ dtbl_entry_get_handle (dtbl_entry_t *dtbl_entry)
static gint
dissector_compare_filter_name(gconstpointer dissector_a, gconstpointer dissector_b)
{
const dissector_handle_t a = (const dissector_handle_t)dissector_a;
const dissector_handle_t b = (const dissector_handle_t)dissector_b;
const struct dissector_handle *a = (const struct dissector_handle *)dissector_a;
const struct dissector_handle *b = (const struct dissector_handle *)dissector_b;
const char *a_name, *b_name;
gint ret;

View File

@ -67,8 +67,8 @@ wmem_test_compare_guint32(const void *a, const void *b)
{
guint32 l, r;
l = *(guint32*)a;
r = *(guint32*)b;
l = *(const guint32*)a;
r = *(const guint32*)b;
return l - r;
}

View File

@ -124,7 +124,7 @@ sub dotap {
$elems{$k} = $v;
}
my $code = "static void wslua_${tname}_to_table(lua_State* L, const void* p) { $sname* v _U_; v = ($sname*)p; lua_newtable(L);\n";
my $code = "static void wslua_${tname}_to_table(lua_State* L, const void* p) { const $sname* v _U_; v = (const $sname*)p; lua_newtable(L);\n";
my $doc = "Tap: $tname\n";
for my $n (sort keys %elems) {

View File

@ -99,7 +99,7 @@ ansi_a_stat_packet(
const void *data)
{
ansi_a_stat_t *stat_p = (ansi_a_stat_t *)tapdata;
const ansi_a_tap_rec_t *data_p = (ansi_a_tap_rec_t *)data;
const ansi_a_tap_rec_t *data_p = (const ansi_a_tap_rec_t *)data;
switch (data_p->pdu_type)
{

View File

@ -91,7 +91,7 @@ static int gtk_camelcounter_packet(void *phs,
const void *phi)
{
struct camelcounter_t * p_counter =(struct camelcounter_t *)phs;
const struct camelsrt_info_t * pi=(struct camelsrt_info_t *)phi;
const struct camelsrt_info_t * pi=(const struct camelsrt_info_t *)phi;
if (pi->opcode != 255)
p_counter->camel_msg[pi->opcode]++;

View File

@ -258,7 +258,7 @@ static gboolean
error_packet(void *pss, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *prv)
{
expert_comp_dlg_t *ss=(expert_comp_dlg_t *)pss;
const expert_info_t *error_pkt=(expert_info_t *)prv;
const expert_info_t *error_pkt=(const expert_info_t *)prv;
/* if return value is 0 then no error */
if(error_pkt==NULL){

View File

@ -73,7 +73,7 @@ static int
smb2stat_packet(void *pss, packet_info *pinfo, epan_dissect_t *edt _U_, const void *psi)
{
smb2stat_t *ss=(smb2stat_t *)pss;
const smb2_info_t *si=(smb2_info_t *)psi;
const smb2_info_t *si=(const smb2_info_t *)psi;
/* we are only interested in response packets */
if(!(si->flags&SMB2_FLAGS_RESPONSE)){

View File

@ -77,7 +77,7 @@ static int
smbstat_packet(void *pss, packet_info *pinfo, epan_dissect_t *edt _U_, const void *psi)
{
smbstat_t *ss=(smbstat_t *)pss;
const smb_info_t *si=(smb_info_t *)psi;
const smb_info_t *si=(const smb_info_t *)psi;
/* we are only interested in reply packets */
if(si->request){

View File

@ -1390,7 +1390,7 @@ remove_tap_listener_isup_calls(void)
static int
mtp3_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, const void *mtp3_info _U_)
{
const mtp3_tap_rec_t *pi = (mtp3_tap_rec_t *)mtp3_info;
const mtp3_tap_rec_t *pi = (const mtp3_tap_rec_t *)mtp3_info;
/* keep the data in memory to use when the ISUP information arrives */
@ -2139,7 +2139,7 @@ H245dgcalls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, c
GList *list2;
h245_address_t *h245_add = NULL;
const h245_packet_info *pi = (h245_packet_info *)H245info;
const h245_packet_info *pi = (const h245_packet_info *)H245info;
/* check if Tunneling is OFF and we have a call with this H245 add */
list = g_list_first(tapinfo->callsinfo_list);
@ -2241,7 +2241,7 @@ static int
SDPcalls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, const void *SDPinfo)
{
voip_calls_tapinfo_t *tapinfo = &the_tapinfo_struct;
const sdp_packet_info *pi = (sdp_packet_info *)SDPinfo;
const sdp_packet_info *pi = (const sdp_packet_info *)SDPinfo;
/* There are protocols like MGCP/SIP where the SDP is called before the tap for the
MGCP/SIP packet, in those cases we assign the SPD summary to global lastSDPsummary
@ -2432,7 +2432,7 @@ MGCPcalls_packet( void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, co
gboolean fromEndpoint = FALSE; /* true for calls originated in Endpoints, false for calls from MGC */
gdouble diff_time;
const mgcp_info_t *pi = (mgcp_info_t *)MGCPinfo;
const mgcp_info_t *pi = (const mgcp_info_t *)MGCPinfo;
if ((pi->mgcp_type == MGCP_REQUEST) && !pi->is_duplicate ) {
@ -2823,7 +2823,7 @@ static gboolean have_megaco_tap_listener = FALSE;
static int h248_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, const void *prot_info) {
voip_calls_tapinfo_t *tapinfo = &the_tapinfo_struct;
const gcp_cmd_t *cmd = (gcp_cmd_t *)prot_info;
const gcp_cmd_t *cmd = (const gcp_cmd_t *)prot_info;
GList *list;
voip_calls_info_t *callsinfo = NULL;
address *mgw;
@ -3697,7 +3697,7 @@ skinny_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_,
GList* list;
voip_calls_info_t *callsinfo = NULL;
address* phone;
const skinny_info_t *si = (skinny_info_t *)skinny_info;
const skinny_info_t *si = (const skinny_info_t *)skinny_info;
skinny_calls_info_t *tmp_skinnyinfo;
gchar *comment;
@ -3851,7 +3851,7 @@ iax2_calls_packet( void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, c
GList* list;
voip_calls_info_t *callsinfo = NULL;
address* phone;
const iax2_info_t *ii = (iax2_info_t *)iax2_info;
const iax2_info_t *ii = (const iax2_info_t *)iax2_info;
iax2_info_t *tmp_iax2info;
if (ii == NULL || ii->ptype != IAX2_FULL_PACKET || (ii->scallno == 0 && ii->dcallno == 0))
@ -3981,7 +3981,7 @@ VoIPcalls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, con
voip_calls_info_t *callsinfo = NULL;
voip_calls_info_t *tmp_listinfo;
GList *list = NULL;
const voip_packet_info_t *pi = (voip_packet_info_t *)VoIPinfo;
const voip_packet_info_t *pi = (const voip_packet_info_t *)VoIPinfo;
if (pi->call_id)
list = g_list_first(tapinfo->callsinfo_list);

View File

@ -159,7 +159,7 @@ static int
wspstat_packet(void *psp, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *pri)
{
wspstat_t *sp = (wspstat_t *)psp;
const wsp_info_value_t *value = (wsp_info_value_t *)pri;
const wsp_info_value_t *value = (const wsp_info_value_t *)pri;
gint idx = pdut2index(value->pdut);
gboolean retour = FALSE;

View File

@ -163,7 +163,7 @@ static void reset(void *arg)
}
static sctp_assoc_info_t *calc_checksum(struct _sctp_info *check_data, sctp_assoc_info_t *data)
static sctp_assoc_info_t *calc_checksum(const struct _sctp_info *check_data, sctp_assoc_info_t *data)
{
gboolean ok = FALSE;
@ -314,7 +314,7 @@ static sctp_assoc_info_t * add_address(address * vadd, sctp_assoc_info_t *info,
static int
packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const void *data)
{
struct _sctp_info *sctp_info;
const struct _sctp_info *sctp_info = (const struct _sctp_info *) data;
guint32 chunk_number = 0, tsnumber,framenumber;
sctp_tmp_info_t tmp_info;
sctp_assoc_info_t *info = NULL;
@ -332,8 +332,6 @@ packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const v
int i;
guint8 idx = 0;
sctp_info = (struct _sctp_info *) data;
framenumber=pinfo->fd->num;
type = sctp_info->ip_src.type;

View File

@ -144,7 +144,7 @@ static gboolean
seq_analysis_tcp_packet( void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, const void *tcp_info)
{
seq_analysis_info_t *sainfo = (seq_analysis_info_t *) ptr;
const struct tcpheader *tcph = (struct tcpheader *)tcp_info;
const struct tcpheader *tcph = (const struct tcpheader *)tcp_info;
if ((sainfo->all_packets)||(pinfo->fd->flags.passed_dfilter==1)){
/* copied from packet-tcp */