Use explicit casts.
authoretxrab <etxrab@f5534014-38df-0310-8fa8-9805f1628bb7>
Tue, 5 Mar 2013 22:15:20 +0000 (22:15 +0000)
committeretxrab <etxrab@f5534014-38df-0310-8fa8-9805f1628bb7>
Tue, 5 Mar 2013 22:15:20 +0000 (22:15 +0000)
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@48108 f5534014-38df-0310-8fa8-9805f1628bb7

capinfos.c
editcap.c
epan/filesystem.c
mergecap.c
u3.c
ui/cli/tap-bootpstat.c
ui/cli/tap-camelcounter.c
ui/cli/tap-camelsrt.c
ui/cli/tap-comparestat.c
ws80211_utils.c

index 2581b32cc7f3733c0a019f1ca460cb9a1eae144a..5adc480618a9b82c76f884983d77b5450d06ac92 100644 (file)
@@ -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))  {
index f1fdf7dcb51844ac3aa81d17158fa5289a9348c0..5331d0f897149ca00b3c560ca7a6f4bf8461244b 100644 (file)
--- a/editcap.c
+++ b/editcap.c
@@ -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)) {
index a38cf86d1d0422a8654043707109a44a04c95aa2..afd1b06003ac2c6db973bc76ef3b5aef05d58a7b 100644 (file)
@@ -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) {
index d42b858cdee2e81a571092b8f2b0ff6d93f2d82e..4bb8299bdcadb154ca584b4cc4c9f2468816d07d 100644 (file)
@@ -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);
diff --git a/u3.c b/u3.c
index ace7c9ca2b2f6ff5bd8531efd9bb0b6433f6751a..25e16fe8a00b0897621b55dd53a16fca8a405b30 100644 (file)
--- a/u3.c
+++ b/u3.c
@@ -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;
 
index af1ed51f8a39c7c233bd617c6e9d96f798575847..2bdb2f3cd58ee77a72df18a642c60656e15482f6 100644 (file)
@@ -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);
index 600a351e0afe06ea1fd90414e1a07ed71110017f..2d82d311cbfa0a66f7f04275615d9e043c477c40 100644 (file)
@@ -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 {
index 2c0e19dda8ee383f368cfcec1b4d1aba112703af..f241a729600b038b4fdd1965764ce2b86e7b54d6 100644 (file)
@@ -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 {
index 970854cdaecef28a68026594602e83776d9784a3..336e866b28f6d608b2ab887f8a07c7415bfc30bf 100644 (file)
@@ -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;
index 107c0fcb9fb0f500fef561785c20af1e8463ce14..566d4932da66a48e6894a62cf4c98df5aaad6797 100644 (file)
@@ -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_)
 {