Fix const warnings.

svn path=/trunk/; revision=54092
This commit is contained in:
Jakub Zawadzki 2013-12-14 14:33:46 +00:00
parent 2754c08d93
commit e0e86bab5a
29 changed files with 49 additions and 46 deletions

View File

@ -146,7 +146,7 @@ set_address_hf(address *addr, address_type addr_type, int addr_len, const void *
*/
#define TVB_SET_ADDRESS_HF(addr, addr_type, tvb, offset, addr_len, addr_hf) \
do { \
const void *TVB_SET_ADDRESS_data = (void *) tvb_get_ptr(tvb, offset, addr_len); \
const void *TVB_SET_ADDRESS_data = (const void *) tvb_get_ptr(tvb, offset, addr_len); \
set_address_hf((addr), (addr_type), (addr_len), TVB_SET_ADDRESS_data, (addr_hf)); \
} while (0)

View File

@ -914,14 +914,14 @@ enip_open_cip_connection( packet_info *pinfo, cip_conn_info_t* connInfo)
if ((connInfo->O2T.port == 0) || (connInfo->O2T.type == CONN_TYPE_MULTICAST))
connInfo->O2T.port = ENIP_IO_PORT;
if ((connInfo->O2T.ipaddress.type == AT_NONE) ||
((connInfo->O2T.ipaddress.type == AT_IPv4) && ((*(guint32*)connInfo->O2T.ipaddress.data)) == 0) ||
((connInfo->O2T.ipaddress.type == AT_IPv4) && ((*(const guint32*)connInfo->O2T.ipaddress.data)) == 0) ||
((connInfo->O2T.ipaddress.type == AT_IPv6) && (memcmp(connInfo->O2T.ipaddress.data, &ipv6_zero, sizeof(ipv6_zero)) == 0)) ||
(connInfo->O2T.type != CONN_TYPE_MULTICAST))
connInfo->O2T.ipaddress = pinfo->src;
if ((connInfo->T2O.port == 0) || (connInfo->T2O.type == CONN_TYPE_MULTICAST))
connInfo->T2O.port = ENIP_IO_PORT;
if ((connInfo->T2O.ipaddress.type == AT_NONE) ||
((connInfo->T2O.ipaddress.type == AT_IPv4) && ((*(guint32*)connInfo->T2O.ipaddress.data)) == 0) ||
((connInfo->T2O.ipaddress.type == AT_IPv4) && ((*(const guint32*)connInfo->T2O.ipaddress.data)) == 0) ||
((connInfo->T2O.ipaddress.type == AT_IPv6) && (memcmp(connInfo->T2O.ipaddress.data, &ipv6_zero, sizeof(ipv6_zero)) == 0)) ||
(connInfo->T2O.type != CONN_TYPE_MULTICAST))
connInfo->T2O.ipaddress = pinfo->dst;

View File

@ -297,9 +297,9 @@ hartip_stats_tree_packet(stats_tree* st, packet_info* pinfo _U_,
hartip_message_id_values,
"Unknown message %d");
tick_stat_node(st, (guint8*)st_str_packets, 0, FALSE);
tick_stat_node(st, (guint8*)message_type_node_str, st_node_packets, FALSE);
tick_stat_node(st, (guint8*)message_id_node_str, message_type_node, FALSE);
tick_stat_node(st, st_str_packets, 0, FALSE);
tick_stat_node(st, message_type_node_str, st_node_packets, FALSE);
tick_stat_node(st, message_id_node_str, message_type_node, FALSE);
return 1;
}

View File

@ -713,9 +713,9 @@ static proto_item* get_InfoObjectAddress(guint32 *asdu_info_obj_addr, tvbuff_t *
static guint8 get_TypeIdLength(guint8 TypeId)
{
guint8 ret = 0;
td_asdu_length *item;
const td_asdu_length *item;
item = (td_asdu_length *)asdu_length;
item = asdu_length;
while (item->value)
{
if (item->value == TypeId)

View File

@ -872,14 +872,14 @@ capture_radiotap(const guchar * pd, int offset, int len, packet_counts * ld)
guint16 it_len;
guint32 present, xpresent;
guint8 rflags;
struct ieee80211_radiotap_header *hdr;
const struct ieee80211_radiotap_header *hdr;
if (!BYTES_ARE_IN_FRAME(offset, len,
sizeof(struct ieee80211_radiotap_header))) {
ld->other++;
return;
}
hdr = (struct ieee80211_radiotap_header *)pd;
hdr = (const struct ieee80211_radiotap_header *)pd;
it_len = pletoh16(&hdr->it_len);
if (!BYTES_ARE_IN_FRAME(offset, len, it_len)) {
ld->other++;

View File

@ -1243,15 +1243,18 @@ static GHashTable *mac_lte_drx_frame_result = NULL;
static gint mac_lte_framenum_instance_hash_equal(gconstpointer v, gconstpointer v2)
{
drx_state_key_t *p1 = (drx_state_key_t*)v;
drx_state_key_t *p2 = (drx_state_key_t*)v2;
const drx_state_key_t *p1 = (const drx_state_key_t*)v;
const drx_state_key_t *p2 = (const drx_state_key_t*)v2;
return ((p1->frameNumber == p2->frameNumber) &&
(p1->pdu_instance == p2->pdu_instance));
}
static guint mac_lte_framenum_instance_hash_func(gconstpointer v)
{
drx_state_key_t *p1 = (drx_state_key_t*)v;
const drx_state_key_t *p1 = (const drx_state_key_t*)v;
/* XXX which one return ? */
return p1->frameNumber + (p1->pdu_instance >> 8);
return GPOINTER_TO_UINT(v);
}

View File

@ -5562,8 +5562,8 @@ static v9_v10_tmplt_t *v9_v10_tmplt_build_key(v9_v10_tmplt_t *tmplt_p, packet_in
static gboolean
v9_v10_tmplt_table_equal(gconstpointer k1, gconstpointer k2)
{
const v9_v10_tmplt_t *ta = (v9_v10_tmplt_t *)k1;
const v9_v10_tmplt_t *tb = (v9_v10_tmplt_t *)k2;
const v9_v10_tmplt_t *ta = (const v9_v10_tmplt_t *)k1;
const v9_v10_tmplt_t *tb = (const v9_v10_tmplt_t *)k2;
return (
(CMP_ADDRESS(&ta->src_addr, &tb->src_addr) == 0) &&
@ -5578,7 +5578,7 @@ v9_v10_tmplt_table_equal(gconstpointer k1, gconstpointer k2)
static guint
v9_v10_tmplt_table_hash(gconstpointer k)
{
const v9_v10_tmplt_t *tmplt_p = (v9_v10_tmplt_t *)k;
const v9_v10_tmplt_t *tmplt_p = (const v9_v10_tmplt_t *)k;
guint32 val;
val = tmplt_p->src_id + (tmplt_p->tmplt_id << 9) + tmplt_p->src_port + tmplt_p->dst_port;

View File

@ -1124,7 +1124,7 @@ smpp_stats_tree_per_packet(stats_tree *st, /* st as it was passed to us */
epan_dissect_t *edt _U_,
const void *p) /* Used for getting SMPP command_id values */
{
smpp_tap_rec_t* tap_rec = (smpp_tap_rec_t*)p;
const smpp_tap_rec_t* tap_rec = (const smpp_tap_rec_t*)p;
tick_stat_node(st, "SMPP Operations", 0, TRUE);

View File

@ -1120,7 +1120,7 @@ dissect_socks(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) {
if (hash_info->dst_addr.type == AT_IPv4) {
ti = proto_tree_add_ipv4( socks_tree, hf_socks_ip_dst, tvb,
offset, 0, *((guint32*)hash_info->dst_addr.data));
offset, 0, *((const guint32*)hash_info->dst_addr.data));
PROTO_ITEM_SET_GENERATED(ti);
} else if (hash_info->dst_addr.type == AT_IPv6) {
ti = proto_tree_add_ipv6( socks_tree, hf_socks_ip6_dst, tvb,

View File

@ -4460,9 +4460,9 @@ dissect_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* We haven't turned checksum checking off; checksum it. */
/* 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;
switch (pinfo->src.type) {

View File

@ -516,11 +516,11 @@ dissect_tr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree_add_uint(bf_tree, hf_tr_fc_type, tr_tvb, 1, 1, trh->fc);
proto_tree_add_uint(bf_tree, hf_tr_fc_pcf, tr_tvb, 1, 1, trh->fc);
proto_tree_add_ether(tr_tree, hf_tr_dst, tr_tvb, 2, 6, (guint8 *)trh->dst.data);
proto_tree_add_ether(tr_tree, hf_tr_src, tr_tvb, 8, 6, (guint8 *)trh->src.data);
hidden_item = proto_tree_add_ether(tr_tree, hf_tr_addr, tr_tvb, 2, 6, (guint8 *)trh->dst.data);
proto_tree_add_ether(tr_tree, hf_tr_dst, tr_tvb, 2, 6, (const guint8 *)trh->dst.data);
proto_tree_add_ether(tr_tree, hf_tr_src, tr_tvb, 8, 6, (const guint8 *)trh->src.data);
hidden_item = proto_tree_add_ether(tr_tree, hf_tr_addr, tr_tvb, 2, 6, (const guint8 *)trh->dst.data);
PROTO_ITEM_SET_HIDDEN(hidden_item);
hidden_item = proto_tree_add_ether(tr_tree, hf_tr_addr, tr_tvb, 8, 6, (guint8 *)trh->src.data);
hidden_item = proto_tree_add_ether(tr_tree, hf_tr_addr, tr_tvb, 8, 6, (const guint8 *)trh->src.data);
PROTO_ITEM_SET_HIDDEN(hidden_item);
proto_tree_add_boolean(tr_tree, hf_tr_sr, tr_tvb, 8, 1, source_routed);

View File

@ -670,7 +670,7 @@ ucp_stats_tree_per_packet(stats_tree *st, /* st as it was passed to us */
epan_dissect_t *edt _U_,
const void *p) /* Used for getting UCP stats */
{
ucp_tap_rec_t *tap_rec = (ucp_tap_rec_t*)p;
const ucp_tap_rec_t *tap_rec = (const ucp_tap_rec_t*)p;
tick_stat_node(st, st_str_ucp, 0, TRUE);

View File

@ -7522,7 +7522,7 @@ parse_wbxml_tag_defined (proto_tree *tree, tvbuff_t *tvb, guint32 offset,
DebugLog(("STAG: LITERAL tag (peek = 0x%02X, off = %u) - TableRef follows!\n", peek, off));
idx = tvb_get_guintvar (tvb, off+1, &tag_len);
str_len = tvb_strsize (tvb, str_tbl+idx);
tag_new_literal = (gchar*)tvb_get_ptr (tvb, str_tbl+idx, str_len);
tag_new_literal = (const gchar*)tvb_get_ptr (tvb, str_tbl+idx, str_len);
tag_new_known = 0; /* invalidate known tag_new */
} else { /* Known tag */
tag_new_known = peek & 0x3F;
@ -7908,7 +7908,7 @@ parse_wbxml_tag (proto_tree *tree, tvbuff_t *tvb, guint32 offset,
" - TableRef follows!\n", peek, off));
idx = tvb_get_guintvar (tvb, off+1, &tag_len);
str_len = tvb_strsize (tvb, str_tbl+idx);
tag_new_literal = (gchar*)tvb_get_ptr (tvb, str_tbl+idx, str_len);
tag_new_literal = (const gchar*)tvb_get_ptr (tvb, str_tbl+idx, str_len);
tag_new_known = 0; /* invalidate known tag_new */
} else { /* Known tag */
tag_new_known = peek & 0x3F;

View File

@ -186,7 +186,7 @@ static int
comparestat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt _U_, const void *arg2)
{
compstat_t *cs=(compstat_t *)arg;
const ws_ip *ci=(ws_ip *)arg2;
const ws_ip *ci=(const ws_ip *)arg2;
frame_info *fInfo, *fInfoTemp;
vec_t cksum_vec[3];
guint16 computed_cksum=0;
@ -204,7 +204,7 @@ comparestat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt _U_, const
cksum_vec[1].ptr=&ci->ip_p;
cksum_vec[1].len=1;
/* skip header checksum and ip's (because of NAT)*/
cksum_vec[2].ptr=(guint8 *)ci->ip_dst.data;
cksum_vec[2].ptr=(const guint8 *)ci->ip_dst.data;
cksum_vec[2].ptr=cksum_vec[2].ptr+ci->ip_dst.len;
/* dynamic computation */
cksum_vec[2].len=ci->ip_len-20;

View File

@ -77,7 +77,7 @@ diameterstat_reset(void *pdiameter)
static int
diameterstat_packet(void *pdiameter, packet_info *pinfo, epan_dissect_t *edt _U_, const void *pdi)
{
const diameter_req_ans_pair_t *diameter=(diameter_req_ans_pair_t *)pdi;
const diameter_req_ans_pair_t *diameter=(const diameter_req_ans_pair_t *)pdi;
diameterstat_t *fs=(diameterstat_t *)pdiameter;
int* idx = NULL;

View File

@ -204,7 +204,7 @@ gsm_a_stat_packet(
const void *data)
{
gsm_a_stat_t *stat_p = (gsm_a_stat_t *)tapdata;
const gsm_a_tap_rec_t *data_p = (gsm_a_tap_rec_t *)data;
const gsm_a_tap_rec_t *data_p = (const gsm_a_tap_rec_t *)data;
switch (data_p->pdu_type)
{

View File

@ -291,7 +291,7 @@ gsm_map_stat_packet(
const void *data)
{
gsm_map_stat_t *stat_p = (gsm_map_stat_t *)tapdata;
const gsm_map_tap_rec_t *data_p = (gsm_map_tap_rec_t *)data;
const gsm_map_tap_rec_t *data_p = (const gsm_map_tap_rec_t *)data;
#if 0 /* always false because message_type is 8 bit value */
if (data_p->opr_code_idx > sizeof(stat_p->opr_code))

View File

@ -160,7 +160,7 @@ static int
h225counter_packet(void *phs, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *phi)
{
h225counter_t *hs=(h225counter_t *)phs;
const h225_packet_info *pi=(h225_packet_info *)phi;
const h225_packet_info *pi=(const h225_packet_info *)phi;
switch (pi->msg_type) {

View File

@ -145,7 +145,7 @@ static int
h225rassrt_packet(void *phs, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *phi)
{
h225rassrt_t *hs=(h225rassrt_t *)phs;
const h225_packet_info *pi=(h225_packet_info *)phi;
const h225_packet_info *pi=(const h225_packet_info *)phi;
ras_type rasmsg_type = RAS_OTHER;
ras_category rascategory = RAS_OTHERS;

View File

@ -43,7 +43,7 @@ static int
eth_hostlist_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip)
{
hostlist_table *hosts=(hostlist_table *)pit;
const eth_hdr *ehdr=(eth_hdr *)vip;
const eth_hdr *ehdr=(const eth_hdr *)vip;
/* Take two "add" passes per packet, adding for each direction, ensures that all
packets are counted properly (even if address is sending to itself)

View File

@ -42,7 +42,7 @@ static int
wlan_hostlist_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip)
{
hostlist_table *hosts=(hostlist_table *)pit;
const wlan_hdr *whdr=(wlan_hdr *)vip;
const wlan_hdr *whdr=(const wlan_hdr *)vip;
/* Take two "add" passes per packet, adding for each direction, ensures that all
packets are counted properly (even if address is sending to itself)

View File

@ -448,7 +448,7 @@ static gboolean
iax2_packet(void *user_data_arg, packet_info *pinfo, epan_dissect_t *edt _U_, const void *iax2info_arg)
{
user_data_t *user_data = (user_data_t *)user_data_arg;
const struct _iax2_info_t *iax2info = (struct _iax2_info_t *)iax2info_arg;
const struct _iax2_info_t *iax2info = (const struct _iax2_info_t *)iax2info_arg;
/* we ignore packets that are not displayed */
if (pinfo->fd->flags.passed_dfilter == 0)

View File

@ -302,7 +302,7 @@ static int
ncpstat_packet(void *pss, packet_info *pinfo, epan_dissect_t *edt _U_, const void *prv)
{
ncpstat_t *ss=(ncpstat_t *)pss;
const ncp_req_hash_value *request_val=(ncp_req_hash_value *)prv;
const ncp_req_hash_value *request_val=(const ncp_req_hash_value *)prv;
/* if we havent seen the request, just ignore it */
if(!request_val || request_val->ncp_rec==0){

View File

@ -204,7 +204,7 @@ add_new_program(rpc_program_t *rp)
static gboolean
rpcprogs_packet(void *dummy _U_, packet_info *pinfo, epan_dissect_t *edt _U_, const void *arg)
{
const rpc_call_info_value *ri = (rpc_call_info_value *)arg;
const rpc_call_info_value *ri = (const rpc_call_info_value *)arg;
nstime_t delta;
rpc_program_t *rp;

View File

@ -103,7 +103,7 @@ static gboolean
rpcstat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt _U_, const void *arg2)
{
rpcstat_t *rs = (rpcstat_t *)arg;
const rpc_call_info_value *ri = (rpc_call_info_value *)arg2;
const rpc_call_info_value *ri = (const rpc_call_info_value *)arg2;
/* we are only interested in reply packets */
if(ri->request){

View File

@ -490,7 +490,7 @@ static int
rtp_packet(void *user_data_arg, packet_info *pinfo, epan_dissect_t *edt _U_, const void *rtpinfo_arg)
{
user_data_t *user_data = (user_data_t *)user_data_arg;
const struct _rtp_info *rtpinfo = (struct _rtp_info *)rtpinfo_arg;
const struct _rtp_info *rtpinfo = (const struct _rtp_info *)rtpinfo_arg;
gboolean rtp_selected = FALSE;
/* we ignore packets that are not displayed */

View File

@ -189,8 +189,8 @@ rtpstream_on_unselect(GtkButton *button _U_, gpointer user_data _U_)
/****************************************************************************/
static gint rtp_stream_info_cmp_reverse(gconstpointer aa, gconstpointer bb)
{
const struct _rtp_stream_info* a = (struct _rtp_stream_info *)aa;
const struct _rtp_stream_info* b = (struct _rtp_stream_info *)bb;
const struct _rtp_stream_info* a = (const struct _rtp_stream_info *)aa;
const struct _rtp_stream_info* b = (const struct _rtp_stream_info *)bb;
if (a==NULL || b==NULL)
return 1;

View File

@ -361,7 +361,7 @@ sipstat_reset(void *psp)
static int
sipstat_packet(void *psp, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *pri)
{
const sip_info_value_t *value = (sip_info_value_t *)pri;
const sip_info_value_t *value = (const sip_info_value_t *)pri;
sipstat_t *sp = (sipstat_t *)psp;
/* Total number of packets, including continuation packets */

View File

@ -191,7 +191,7 @@ static char *fld_tostr(void *rec, uat_field_t *f) {
GString *s = g_string_sized_new( len*2 + 1 );
guint i;
for (i=0; i<len;i++) g_string_append_printf(s, "%.2X", ((guint8*)ptr)[i]);
for (i=0; i<len;i++) g_string_append_printf(s, "%.2X", ((const guint8*)ptr)[i]);
out = ep_strdup(s->str);
@ -349,7 +349,7 @@ static gboolean uat_dlg_cb(GtkWidget *win _U_, gpointer user_data) {
}
case PT_TXTMOD_ENUM: {
gint idx = *(int*)e;
text = (idx >= 0) ? ((value_string *)(f[colnum].fld_data))[idx].strptr : "";
text = (idx >= 0) ? ((const value_string *)(f[colnum].fld_data))[idx].strptr : "";
len = (unsigned) strlen(text);
break;
}