diff options
author | Anders Broman <anders.broman@ericsson.com> | 2013-03-05 22:15:20 +0000 |
---|---|---|
committer | Anders Broman <anders.broman@ericsson.com> | 2013-03-05 22:15:20 +0000 |
commit | b204e38aef8bf9905e8d3d1e44361ae77a8f0c3f (patch) | |
tree | b191b3f59b27d26b9f9fc82f64c8b4f8d756467c | |
parent | faa06129a916b6021faa22cc3eb0d6312e9e22a2 (diff) | |
download | wireshark-b204e38aef8bf9905e8d3d1e44361ae77a8f0c3f.tar.gz |
Use explicit casts.
svn path=/trunk/; revision=48108
-rw-r--r-- | capinfos.c | 2 | ||||
-rw-r--r-- | editcap.c | 4 | ||||
-rw-r--r-- | epan/filesystem.c | 2 | ||||
-rw-r--r-- | mergecap.c | 4 | ||||
-rw-r--r-- | u3.c | 12 | ||||
-rw-r--r-- | ui/cli/tap-bootpstat.c | 14 | ||||
-rw-r--r-- | ui/cli/tap-camelcounter.c | 4 | ||||
-rw-r--r-- | ui/cli/tap-camelsrt.c | 4 | ||||
-rw-r--r-- | ui/cli/tap-comparestat.c | 22 | ||||
-rw-r--r-- | ws80211_utils.c | 2 |
10 files changed, 35 insertions, 35 deletions
diff --git a/capinfos.c b/capinfos.c index 2581b32cc7..5adc480618 100644 --- a/capinfos.c +++ b/capinfos.c @@ -816,7 +816,7 @@ process_cap_file(wtap *wth, const char *filename) gboolean know_order = FALSE; order_t order = IN_ORDER; - cf_info.encap_counts = g_malloc0(WTAP_NUM_ENCAP_TYPES * sizeof(int)); + cf_info.encap_counts = g_new0(int,WTAP_NUM_ENCAP_TYPES); /* Tally up data that we need to parse through the file to find */ while (wtap_read(wth, &err, &err_info, &data_offset)) { @@ -168,7 +168,7 @@ static gchar * abs_time_to_str_with_sec_resolution(const struct wtap_nstime *abs_time) { struct tm *tmp; - gchar *buf = g_malloc(16); + gchar *buf = (gchar *)g_malloc(16); #if (defined _WIN32) && (_MSC_VER < 1500) /* calling localtime() on MSVC 2005 with huge values causes it to crash */ @@ -785,7 +785,7 @@ list_capture_types(void) { struct string_elem *captypes; GSList *list = NULL; - captypes = g_malloc(sizeof(struct string_elem) * WTAP_NUM_FILE_TYPES); + captypes = g_new(struct string_elem,WTAP_NUM_FILE_TYPES); fprintf(stderr, "editcap: The available capture file types for the \"-F\" flag are:\n"); for (i = 0; i < WTAP_NUM_FILE_TYPES; i++) { if (wtap_dump_can_open(i)) { diff --git a/epan/filesystem.c b/epan/filesystem.c index a38cf86d1d..afd1b06003 100644 --- a/epan/filesystem.c +++ b/epan/filesystem.c @@ -1818,7 +1818,7 @@ copy_file_binary_mode(const char *from_filename, const char *to_filename) } #define FS_READ_SIZE 65536 - pd = g_malloc(FS_READ_SIZE); + pd = (guint8 *)g_malloc(FS_READ_SIZE); while ((nread = ws_read(from_fd, pd, FS_READ_SIZE)) > 0) { nwritten = ws_write(to_fd, pd, nread); if (nwritten < nread) { diff --git a/mergecap.c b/mergecap.c index d42b858cde..4bb8299bdc 100644 --- a/mergecap.c +++ b/mergecap.c @@ -159,7 +159,7 @@ list_capture_types(void) { struct string_elem *captypes; GSList *list = NULL; - captypes = g_malloc(sizeof(struct string_elem) * WTAP_NUM_FILE_TYPES); + captypes = g_new(struct string_elem,WTAP_NUM_FILE_TYPES); fprintf(stderr, "mergecap: The available capture file types for the \"-F\" flag are:\n"); for (i = 0; i < WTAP_NUM_FILE_TYPES; i++) { @@ -180,7 +180,7 @@ list_encap_types(void) { struct string_elem *encaps; GSList *list = NULL; - encaps = g_malloc(sizeof(struct string_elem) * WTAP_NUM_ENCAP_TYPES); + encaps = g_new(struct string_elem,WTAP_NUM_ENCAP_TYPES); fprintf(stderr, "mergecap: The available encapsulation types for the \"-T\" flag are:\n"); for (i = 0; i < WTAP_NUM_ENCAP_TYPES; i++) { encaps[i].sstr = wtap_encap_short_string(i); @@ -57,7 +57,7 @@ static char *pid_file = NULL; static char *u3devicepath = (char*)-1; static gchar *newpath = NULL; -static const char *u3_change_path(const char *path, const char *old, const char *new); +static const char *u3_change_path(const char *path, const char *old, const char *new_u3devicepath); gboolean u3_active(void) { @@ -124,7 +124,7 @@ void u3_register_pid(void) pid = getpid(); pf_size = (int) strlen(u3hostexecpath) + 32; - pid_file = g_malloc(pf_size); + pid_file = (char *)g_malloc(pf_size); g_snprintf(pid_file, pf_size, "%s\\%d.pid", u3hostexecpath, pid); @@ -164,7 +164,7 @@ const char *u3_contract_device_path(char *path) return u3_change_path(path, NULL, U3_DEVICE_PATH_VAR); } -static const char *u3_change_path(const char *path, const char *old, const char *new) +static const char *u3_change_path(const char *path, const char *old, const char *new_u3devicepath) { if(u3devicepath == (char*)-1) { @@ -178,8 +178,8 @@ static const char *u3_change_path(const char *path, const char *old, const char ("U3_DEVICE_PATH"); } - if(new == NULL) - new = u3devicepath; + if(new_u3devicepath == NULL) + new_u3devicepath = u3devicepath; if(old == NULL) old = u3devicepath; @@ -190,7 +190,7 @@ static const char *u3_change_path(const char *path, const char *old, const char if((path != NULL) && (u3devicepath != NULL) && (strncmp(path, old, strlen(old)) == 0)) { - newpath = g_strconcat(new, path + strlen(old), NULL); + newpath = g_strconcat(new_u3devicepath, path + strlen(old), NULL); return newpath; diff --git a/ui/cli/tap-bootpstat.c b/ui/cli/tap-bootpstat.c index af1ed51f8a..2bdb2f3cd5 100644 --- a/ui/cli/tap-bootpstat.c +++ b/ui/cli/tap-bootpstat.c @@ -76,23 +76,23 @@ dhcp_draw_message_type(gchar *key _U_, dhcp_message_type_t *data, gchar * format static void dhcpstat_reset(void *psp) { - dhcpstat_t *sp=psp; + dhcpstat_t *sp=(dhcpstat_t *)psp; g_hash_table_foreach( sp->hash, (GHFunc)dhcp_reset_hash, NULL); } static int dhcpstat_packet(void *psp, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *pri) { - dhcpstat_t *sp=psp; - const bootp_info_value_t value=pri; + dhcpstat_t *sp=(dhcpstat_t *)psp; + const bootp_info_value_t value=(const bootp_info_value_t)pri; dhcp_message_type_t *sc; if (sp==NULL) return 0; - sc = g_hash_table_lookup( + sc = (dhcp_message_type_t *)g_hash_table_lookup( sp->hash, value); if (!sc) { - sc = g_malloc( sizeof(dhcp_message_type_t) ); + sc = g_new(dhcp_message_type_t,1); sc -> packets = 1; sc -> name = value; sc -> sp = sp; @@ -111,7 +111,7 @@ dhcpstat_packet(void *psp, packet_info *pinfo _U_, epan_dissect_t *edt _U_, cons static void dhcpstat_draw(void *psp) { - dhcpstat_t *sp=psp; + dhcpstat_t *sp=(dhcpstat_t *)psp; printf("\n"); printf("===================================================================\n"); @@ -146,7 +146,7 @@ dhcpstat_init(const char *optarg, void* userdata _U_) filter=NULL; } - sp = g_malloc( sizeof(dhcpstat_t) ); + sp = g_new(dhcpstat_t,1); sp->hash = g_hash_table_new( g_str_hash, g_str_equal); if(filter){ sp->filter=g_strdup(filter); diff --git a/ui/cli/tap-camelcounter.c b/ui/cli/tap-camelcounter.c index 600a351e0a..2d82d311cb 100644 --- a/ui/cli/tap-camelcounter.c +++ b/ui/cli/tap-camelcounter.c @@ -59,7 +59,7 @@ static int camelcounter_packet(void *phs, const void *phi) { struct camelcounter_t * p_counter =(struct camelcounter_t *)phs; - const struct camelsrt_info_t * pi=phi; + const struct camelsrt_info_t * pi=(const struct camelsrt_info_t *)phi; if (pi->opcode != 255) p_counter->camel_msg[pi->opcode]++; @@ -90,7 +90,7 @@ static void camelcounter_init(const char *optarg, void* userdata _U_) struct camelcounter_t *p_camelcounter; GString *error_string; - p_camelcounter = g_malloc(sizeof(struct camelcounter_t)); + p_camelcounter = g_new(struct camelcounter_t,1); if(!strncmp(optarg,"camel,counter,",13)){ p_camelcounter->filter=g_strdup(optarg+13); } else { diff --git a/ui/cli/tap-camelsrt.c b/ui/cli/tap-camelsrt.c index 2c0e19dda8..f241a72960 100644 --- a/ui/cli/tap-camelsrt.c +++ b/ui/cli/tap-camelsrt.c @@ -69,7 +69,7 @@ static int camelsrt_packet(void *phs, const void *phi) { struct camelsrt_t *hs=(struct camelsrt_t *)phs; - const struct camelsrt_info_t * pi=phi; + const struct camelsrt_info_t * pi=(const struct camelsrt_info_t *)phi; int i; for (i=0; i<NB_CAMELSRT_CATEGORY; i++) { @@ -204,7 +204,7 @@ static void camelsrt_init(const char *optarg, void* userdata _U_) struct camelsrt_t *p_camelsrt; GString *error_string; - p_camelsrt = g_malloc(sizeof(struct camelsrt_t)); + p_camelsrt = g_new(struct camelsrt_t,1); if(!strncmp(optarg,"camel,srt,",9)){ p_camelsrt->filter=g_strdup(optarg+9); } else { diff --git a/ui/cli/tap-comparestat.c b/ui/cli/tap-comparestat.c index 970854cdae..336e866b28 100644 --- a/ui/cli/tap-comparestat.c +++ b/ui/cli/tap-comparestat.c @@ -109,8 +109,8 @@ comparestat_reset(void *dummy _U_) static int comparestat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt _U_, const void *arg2) { - comparestat_t *cs=arg; - const ws_ip *ci=arg2; + comparestat_t *cs=(comparestat_t *)arg; + const ws_ip *ci=(const ws_ip *)arg2; frame_info *fInfo; vec_t cksum_vec[3]; guint16 computed_cksum=0; @@ -167,7 +167,7 @@ call_foreach_count_ip_id(gpointer value, gpointer arg) pinfo->fd=(frame_data*)ep_alloc(sizeof(frame_data)); pinfo->fd->num = fInfo->num; - fInfoTemp=se_tree_lookup32(cs->ip_id_tree, fInfo->id); + fInfoTemp=(frame_info *)se_tree_lookup32(cs->ip_id_tree, fInfo->id); if(fInfoTemp==NULL){ /* Detect ongoing package loss */ if((cs->last_hit==FALSE)&&(cs->start_ongoing_hits>compare_start)&&(cs->stop_ongoing_hits<compare_stop)){ @@ -239,7 +239,7 @@ call_foreach_new_order(gpointer value, gpointer arg) frame_info *fInfo=(frame_info*)value, *fInfoTemp; /* overwrite Info column for new ordering */ - fInfoTemp=se_tree_lookup32(cs->nr_tree, fInfo->id); + fInfoTemp=(frame_info *)se_tree_lookup32(cs->nr_tree, fInfo->id); if(fInfoTemp==NULL){ if(TTL_method==FALSE){ if((ADDRESSES_EQUAL(&cs->eth_dst, &fInfo->dl_dst)) || (ADDRESSES_EQUAL(&cs->eth_src, &fInfo->dl_dst))){ @@ -314,7 +314,7 @@ call_foreach_merge_settings(gpointer value, gpointer arg) } if((fInfo->num==tot_packet_amount)&&(cs->stop_packet_nr_first==G_MAXINT32)&&(cs->start_packet_nr_first!=G_MAXINT32)){ - fInfoTemp=se_tree_lookup32(cs->packet_tree, cs->start_packet_nr_first); + fInfoTemp=(frame_info *)se_tree_lookup32(cs->packet_tree, cs->start_packet_nr_first); if(fInfoTemp==NULL){ printf("ERROR: start number not set correctly\n"); return FALSE; @@ -329,10 +329,10 @@ call_foreach_merge_settings(gpointer value, gpointer arg) if(cs->stop_packet_nr_first>cs->start_packet_nr_second){ cs->stop_packet_nr_first=cs->start_packet_nr_second-1; } - fInfoTemp=se_tree_lookup32(cs->packet_tree, cs->stop_packet_nr_first); + fInfoTemp=(frame_info *)se_tree_lookup32(cs->packet_tree, cs->stop_packet_nr_first); while((fInfoTemp!=NULL)?fmod(!fInfoTemp->zebra_time.nsecs, 2):TRUE){ cs->stop_packet_nr_first--; - fInfoTemp=se_tree_lookup32(cs->packet_tree, cs->stop_packet_nr_first); + fInfoTemp=(frame_info *)se_tree_lookup32(cs->packet_tree, cs->stop_packet_nr_first); } } else { /*this only happens if we have too many MAC's or TTL*/ @@ -340,10 +340,10 @@ call_foreach_merge_settings(gpointer value, gpointer arg) if(cs->stop_packet_nr_first>tot_packet_amount-cs->first_file_amount){ cs->stop_packet_nr_first=tot_packet_amount-cs->first_file_amount; } - fInfoTemp=se_tree_lookup32(cs->packet_tree, cs->stop_packet_nr_first); + fInfoTemp=(frame_info *)se_tree_lookup32(cs->packet_tree, cs->stop_packet_nr_first); while((fInfoTemp!=NULL)?fmod(fInfoTemp->zebra_time.nsecs, 2):TRUE){ cs->stop_packet_nr_first--; - fInfoTemp=se_tree_lookup32(cs->packet_tree, cs->stop_packet_nr_first); + fInfoTemp=(frame_info *)se_tree_lookup32(cs->packet_tree, cs->stop_packet_nr_first); } } /* set second stop location */ @@ -441,7 +441,7 @@ call_foreach_print_ip_tree(gpointer value, gpointer user_data) static void comparestat_draw(void *prs) { - comparestat_t *cs=prs; + comparestat_t *cs=(comparestat_t *)prs; GString *filter_str = g_string_new(""); const gchar *statis_string; guint32 first_file_amount, second_file_amount; @@ -529,7 +529,7 @@ comparestat_init(const char *optarg, void* userdata _U_) TTL_method=ttl; ON_method=order; - cs=g_malloc(sizeof(comparestat_t)); + cs=g_new(comparestat_t,1); nstime_set_unset(&cs->current_time); cs->ip_ttl_list=g_array_new(FALSE, FALSE, sizeof(guint8)); cs->last_hit=FALSE; diff --git a/ws80211_utils.c b/ws80211_utils.c index 107c0fcb9f..566d4932da 100644 --- a/ws80211_utils.c +++ b/ws80211_utils.c @@ -684,7 +684,7 @@ int ws80211_get_iface_info(const char *name _U_, struct ws80211_iface_info *ifac void ws80211_free_interfaces(GArray *interfaces _U_) { -}; +} int ws80211_frequency_to_channel(int freq _U_) { |