From f8a93562e06bfc5c0f0b7a7f738d95114eaa0338 Mon Sep 17 00:00:00 2001 From: Anders Broman Date: Thu, 21 Mar 2013 17:52:43 +0000 Subject: [-Wmissing-prototypes] Use explicit casts. svn path=/trunk/; revision=48457 --- epan/addr_resolv.c | 12 ++++----- epan/dissectors/packet-soupbintcp.c | 6 +++-- epan/oids.c | 14 +++++------ ui/gtk/rtp_player.c | 50 ++++++++++++++++++------------------- 4 files changed, 42 insertions(+), 40 deletions(-) diff --git a/epan/addr_resolv.c b/epan/addr_resolv.c index 6148de24bf..b5ec5dddb7 100644 --- a/epan/addr_resolv.c +++ b/epan/addr_resolv.c @@ -373,7 +373,7 @@ add_async_dns_ipv4(int type, guint32 addr) { async_dns_queue_msg_t *msg; - msg = g_malloc(sizeof(async_dns_queue_msg_t)); + msg = g_new(async_dns_queue_msg_t,1); #ifdef HAVE_C_ARES msg->family = type; msg->addr.ip4 = addr; @@ -727,7 +727,7 @@ c_ares_ghba_cb(void *arg, int status, struct hostent *he) { #else c_ares_ghba_cb(void *arg, int status, int timeouts _U_, struct hostent *he) { #endif - async_dns_queue_msg_t *caqm = arg; + async_dns_queue_msg_t *caqm = (async_dns_queue_msg_t *)arg; char **p; if (!caqm) return; @@ -825,7 +825,7 @@ host_lookup(const guint addr, gboolean *found) * else call gethostbyaddr and hope for the best */ - hostp = gethostbyaddr((char *)&addr, 4, AF_INET); + hostp = gethostbyaddr((const char *)&addr, 4, AF_INET); if (hostp != NULL) { g_strlcpy(tp->name, hostp->h_name, MAXNAMELEN); @@ -906,7 +906,7 @@ host_lookup6(const struct e_in6_addr *addr, gboolean *found) if ((gbl_resolv_flags.concurrent_dns) && name_resolve_concurrency > 0 && async_dns_initialized) { - caqm = g_malloc(sizeof(async_dns_queue_msg_t)); + caqm = g_new(async_dns_queue_msg_t,1); caqm->family = AF_INET6; memcpy(&caqm->addr.ip6, addr, sizeof(caqm->addr.ip6)); async_dns_queue_head = g_list_append(async_dns_queue_head, (gpointer) caqm); @@ -924,7 +924,7 @@ host_lookup6(const struct e_in6_addr *addr, gboolean *found) #endif /* HAVE_C_ARES */ /* Quick hack to avoid DNS/YP timeout */ - hostp = gethostbyaddr((char *)addr, sizeof(*addr), AF_INET6); + hostp = gethostbyaddr((const char *)addr, sizeof(*addr), AF_INET6); if (hostp != NULL) { g_strlcpy(tp->name, hostp->h_name, MAXNAMELEN); @@ -3257,7 +3257,7 @@ c_ares_ghi_cb(void *arg, int status, int timeouts _U_, struct hostent *hp) { * XXX - If we wanted to be really fancy we could cache results here and * look them up in get_host_ipaddr* below. */ - async_hostent_t *ahp = arg; + async_hostent_t *ahp = (async_hostent_t *)arg; if (status == ARES_SUCCESS && hp && ahp && hp->h_length == ahp->addr_size) { memcpy(ahp->addrp, hp->h_addr, hp->h_length); ahp->copied = hp->h_length; diff --git a/epan/dissectors/packet-soupbintcp.c b/epan/dissectors/packet-soupbintcp.c index 4af6890a89..9926bdcea1 100644 --- a/epan/dissectors/packet-soupbintcp.c +++ b/epan/dissectors/packet-soupbintcp.c @@ -64,6 +64,8 @@ /* For tcp_dissect_pdus() */ #include "packet-tcp.h" +void proto_register_soupbintcp(void); +void proto_reg_handoff_soupbintcp(void); /** Session data stored in the conversation */ struct conv_data { @@ -246,7 +248,7 @@ dissect_soupbintcp_common( 0); /* Store starting sequence number for session's packets */ - conv_data = wmem_alloc(wmem_file_scope(), sizeof(struct conv_data)); + conv_data = (struct conv_data *)wmem_alloc(wmem_file_scope(), sizeof(struct conv_data)); conv_data->next_seq = next_seq; conversation_add_proto_data(conv, proto_soupbintcp, conv_data); } @@ -265,7 +267,7 @@ dissect_soupbintcp_common( if (!conv) { this_seq = 0; } else { - conv_data = conversation_get_proto_data(conv, + conv_data = (struct conv_data *)conversation_get_proto_data(conv, proto_soupbintcp); if (conv_data) { this_seq = conv_data->next_seq++; diff --git a/epan/oids.c b/epan/oids.c index c2926729b6..2f7ca68ddc 100644 --- a/epan/oids.c +++ b/epan/oids.c @@ -248,8 +248,8 @@ static void smi_error_handler(char *path, int line, int severity, char *msg, cha static void* smi_mod_copy_cb(void* dest, const void* orig, size_t len _U_) { - const smi_module_t* m = orig; - smi_module_t* d = dest; + const smi_module_t* m = (const smi_module_t*)orig; + smi_module_t* d = (smi_module_t*)dest; d->name = g_strdup(m->name); @@ -257,7 +257,7 @@ static void* smi_mod_copy_cb(void* dest, const void* orig, size_t len _U_) { } static void smi_mod_free_cb(void* p) { - smi_module_t* m = p; + smi_module_t* m = (smi_module_t*)p; g_free(m->name); } @@ -322,7 +322,7 @@ static const oid_value_type_t* get_typedata(SmiType* smiType) { {"enum",SMI_BASETYPE_ENUM,&integer_type}, {"bits",SMI_BASETYPE_BITS,&bytes_type}, {"unk",SMI_BASETYPE_UNKNOWN,&unknown_type}, - {NULL,0,NULL} + {NULL,SMI_BASETYPE_UNKNOWN,NULL} /* SMI_BASETYPE_UNKNOWN = 0 */ }; const struct _type_mapping_t* t; SmiType* sT = smiType; @@ -421,7 +421,7 @@ static inline oid_kind_t smikind(SmiNode* sN, oid_key_t** key_p) { typedata = get_typedata(elType); - k = g_malloc(sizeof(oid_key_t)); + k = g_new(oid_key_t,1); oid1 = smiRenderOID(sN->oidlen, sN->oid, SMI_RENDER_QUALIFIED); oid2 = smiRenderOID(elNode->oidlen, elNode->oid, SMI_RENDER_NAME); @@ -748,7 +748,7 @@ void oid_pref_init(module_t *nameres) sizeof(smi_module_t), "smi_paths", FALSE, - (void*)&smi_paths, + (void**)&smi_paths, &num_smi_paths, /* affects dissection of packets (as the MIBs and PIBs affect the interpretation of e.g. SNMP variable bindings), but not set of @@ -776,7 +776,7 @@ void oid_pref_init(module_t *nameres) sizeof(smi_module_t), "smi_modules", FALSE, - (void*)&smi_modules, + (void**)&smi_modules, &num_smi_modules, /* affects dissection of packets (as the MIBs and PIBs affect the interpretation of e.g. SNMP variable bindings), but not set of diff --git a/ui/gtk/rtp_player.c b/ui/gtk/rtp_player.c index 88555d82e7..e710db026e 100644 --- a/ui/gtk/rtp_player.c +++ b/ui/gtk/rtp_player.c @@ -259,7 +259,7 @@ rtp_key_destroy(gpointer key) static void rtp_channel_value_destroy(gpointer rci_arg) { - rtp_channel_info_t *rci = rci_arg; + rtp_channel_info_t *rci = (rtp_channel_info_t *)rci_arg; g_array_free(rci->samples, TRUE); g_free(rci); @@ -270,14 +270,14 @@ rtp_channel_value_destroy(gpointer rci_arg) static void rtp_stream_value_destroy(gpointer rsi_arg) { - rtp_stream_info_t *rsi = rsi_arg; + rtp_stream_info_t *rsi = (rtp_stream_info_t *)rsi_arg; GList* rtp_packets_list; rtp_packet_t *rp; rtp_packets_list = g_list_first(rsi->rtp_packets_list); while (rtp_packets_list) { - rp = rtp_packets_list->data; + rp = (rtp_packet_t *)rtp_packets_list->data; g_free(rp->info); g_free(rp->payload_data); @@ -296,7 +296,7 @@ rtp_stream_value_destroy(gpointer rsi_arg) static void rtp_decoder_value_destroy(gpointer dec_arg) { - rtp_decoder_t *dec = dec_arg; + rtp_decoder_t *dec = (rtp_decoder_t *)dec_arg; if (dec->handle) codec_release(dec->handle, dec->context); @@ -373,11 +373,11 @@ add_rtp_packet(const struct _rtp_info *rtp_info, packet_info *pinfo) pinfo->destport, rtp_info->info_sync_src ); /* lookup for this RTP packet in the stream hash table */ - stream_info = g_hash_table_lookup( rtp_streams_hash, key_str->str); + stream_info = (rtp_stream_info_t *)g_hash_table_lookup( rtp_streams_hash, key_str->str); /* if it is not in the hash table, create a new stream */ if (stream_info==NULL) { - stream_info = g_malloc(sizeof(rtp_stream_info_t)); + stream_info = g_new(rtp_stream_info_t,1); COPY_ADDRESS(&(stream_info->src_addr), &(pinfo->src)); stream_info->src_port = pinfo->srcport; COPY_ADDRESS(&(stream_info->dest_addr), &(pinfo->dst)); @@ -401,14 +401,14 @@ add_rtp_packet(const struct _rtp_info *rtp_info, packet_info *pinfo) stream_info->num_packets++; /* Add the RTP packet to the list */ - new_rtp_packet = g_malloc(sizeof(rtp_packet_t)); - new_rtp_packet->info = g_malloc(sizeof(struct _rtp_info)); + new_rtp_packet = g_new(rtp_packet_t,1); + new_rtp_packet->info = (struct _rtp_info *)g_malloc(sizeof(struct _rtp_info)); memcpy(new_rtp_packet->info, rtp_info, sizeof(struct _rtp_info)); new_rtp_packet->arrive_offset = nstime_to_msec(&pinfo->fd->rel_ts) - stream_info->start_time; /* copy the RTP payload to the rtp_packet to be decoded later */ if (rtp_info->info_all_data_present && (rtp_info->info_payload_len != 0)) { - new_rtp_packet->payload_data = g_malloc(rtp_info->info_payload_len); + new_rtp_packet->payload_data = (guint8 *)g_malloc(rtp_info->info_payload_len); memcpy(new_rtp_packet->payload_data, &(rtp_info->info_data[rtp_info->info_payload_offset]), rtp_info->info_payload_len); } else { new_rtp_packet->payload_data = NULL; @@ -440,14 +440,14 @@ mark_rtp_stream_to_play(gchar *key _U_ , rtp_stream_info_t *rsi, gpointer ptr _U graph_list = g_list_first(voip_calls->graph_analysis->list); while (graph_list) { - graph_item = graph_list->data; + graph_item = (graph_analysis_item_t *)graph_list->data; if (rsi->first_frame_number == graph_item->fd->num) { rsi->call_num = graph_item->conv_num; /* if it is in the graph list, then check if the voip_call is selected */ voip_calls_list = g_list_first(voip_calls->callsinfo_list); while (voip_calls_list) { - tmp_voip_call = voip_calls_list->data; + tmp_voip_call = (voip_calls_info_t *)voip_calls_list->data; if ( (tmp_voip_call->call_num == rsi->call_num) && (tmp_voip_call->selected == TRUE) ) { rsi->play = TRUE; total_packets += rsi->num_packets; @@ -493,9 +493,9 @@ decode_rtp_packet(rtp_packet_t *rp, SAMPLE **out_buff, GHashTable *decoders_hash payload_type = rp->info->info_payload_type; /* Look for registered codecs */ - decoder = g_hash_table_lookup(decoders_hash, GUINT_TO_POINTER(payload_type)); + decoder = (rtp_decoder_t *)g_hash_table_lookup(decoders_hash, GUINT_TO_POINTER(payload_type)); if (!decoder) { /* Put either valid or empty decoder into the hash table */ - decoder = g_malloc(sizeof(rtp_decoder_t)); + decoder = g_new(rtp_decoder_t,1); decoder->handle = NULL; decoder->context = NULL; p = match_strval_ext(payload_type, &rtp_payload_type_short_vals_ext); @@ -508,7 +508,7 @@ decode_rtp_packet(rtp_packet_t *rp, SAMPLE **out_buff, GHashTable *decoders_hash } if (decoder->handle) { /* Decode with registered codec */ tmp_buff_len = codec_decode(decoder->handle, decoder->context, rp->payload_data, rp->info->info_payload_len, NULL, NULL); - tmp_buff = g_malloc(tmp_buff_len); + tmp_buff = (SAMPLE *)g_malloc(tmp_buff_len); decoded_bytes = codec_decode(decoder->handle, decoder->context, rp->payload_data, rp->info->info_payload_len, tmp_buff, &tmp_buff_len); *out_buff = tmp_buff; return decoded_bytes; @@ -519,13 +519,13 @@ decode_rtp_packet(rtp_packet_t *rp, SAMPLE **out_buff, GHashTable *decoders_hash switch (payload_type) { case PT_PCMU: /* G.711 u-law */ - tmp_buff = g_malloc(sizeof(SAMPLE) * rp->info->info_payload_len * 1); + tmp_buff = (SAMPLE *)g_malloc(sizeof(SAMPLE) * rp->info->info_payload_len * 1); decodeG711u(rp->payload_data, rp->info->info_payload_len, tmp_buff, &decoded_bytes); break; case PT_PCMA: /* G.711 A-law */ - tmp_buff = g_malloc(sizeof(SAMPLE) * rp->info->info_payload_len * 1); + tmp_buff = (SAMPLE *)g_malloc(sizeof(SAMPLE) * rp->info->info_payload_len * 1); decodeG711a(rp->payload_data, rp->info->info_payload_len, tmp_buff, &decoded_bytes); break; @@ -646,11 +646,11 @@ decode_rtp_stream(rtp_stream_info_t *rsi, gpointer ptr _U_) } /* lookup for this stream in the channel hash table */ - rci = g_hash_table_lookup( rtp_channels_hash, key_str->str); + rci = (rtp_channel_info_t *)g_hash_table_lookup( rtp_channels_hash, key_str->str); /* ..if it is not in the hash, create an entry */ if (rci == NULL) { - rci = g_malloc(sizeof(rtp_channel_info_t)); + rci = g_new(rtp_channel_info_t,1); rci->call_num = rsi->call_num; rci->start_time = rsi->start_time; rci->start_time_abs = rsi->start_time_abs; @@ -729,7 +729,7 @@ decode_rtp_stream(rtp_stream_info_t *rsi, gpointer ptr _U_) } - rp = rtp_packets_list->data; + rp = (rtp_packet_t *)rtp_packets_list->data; if (first == TRUE) { start_timestamp = rp->info->info_timestamp; /* defined start_timestmp to avoid overflow in timestamp. TODO: handle the timestamp correctly */ start_rtp_time = 0; @@ -862,7 +862,7 @@ decode_rtp_stream(rtp_stream_info_t *rsi, gpointer ptr _U_) static gint h_scrollbar_changed(GtkWidget *widget _U_, gpointer user_data) { - rtp_channel_info_t *rci = user_data; + rtp_channel_info_t *rci = (rtp_channel_info_t *)user_data; rci->cursor_catch = TRUE; return TRUE; } @@ -1234,7 +1234,7 @@ static int paCallback( const void *inputBuffer _U_, void *outputBuffer, static void on_bt_check_clicked(GtkButton *button _U_, gpointer user_data) { - rtp_channel_info_t *rci = user_data; + rtp_channel_info_t *rci = (rtp_channel_info_t *)user_data; if (rci->selected) { if (rtp_channels->rci[0] == rci) { @@ -1593,7 +1593,7 @@ static void channel_draw(rtp_channel_info_t* rci) /****************************************************************************/ static gboolean expose_event_channels(GtkWidget *widget, GdkEventExpose *event, gpointer user_data) { - rtp_channel_info_t *rci = user_data; + rtp_channel_info_t *rci = (rtp_channel_info_t *)user_data; cairo_t *cr; if (gtk_widget_is_drawable(widget)){ @@ -1616,7 +1616,7 @@ static gboolean expose_event_channels(GtkWidget *widget, GdkEventExpose *event, static gboolean configure_event_channels(GtkWidget *widget, GdkEventConfigure *event _U_, gpointer user_data) { - rtp_channel_info_t *rci = user_data; + rtp_channel_info_t *rci = (rtp_channel_info_t *)user_data; int i; GtkAllocation widget_alloc; cairo_t *cr; @@ -1707,7 +1707,7 @@ configure_event_channels(GtkWidget *widget, GdkEventConfigure *event _U_, gpoint static gboolean button_press_event_channel(GtkWidget *widget _U_, GdkEventButton *event _U_, gpointer user_data) { - rtp_channel_info_t *rci = user_data; + rtp_channel_info_t *rci = (rtp_channel_info_t *)user_data; int this_channel; unsigned long prev_index; @@ -2487,7 +2487,7 @@ rtp_player_init(voip_calls_tapinfo_t *voip_calls_tap) #endif /* HAVE_G729_G723 */ if (!rtp_channels) { - rtp_channels = g_malloc(sizeof(rtp_play_channels_t)); + rtp_channels = g_new(rtp_play_channels_t,1); } reset_rtp_channels(); -- cgit v1.2.3