diff options
-rw-r--r-- | capture_ifinfo.c | 8 | ||||
-rw-r--r-- | capture_sync.c | 14 | ||||
-rw-r--r-- | capture_ui_utils.c | 8 | ||||
-rw-r--r-- | tap-rtp-common.c | 14 |
4 files changed, 22 insertions, 22 deletions
diff --git a/capture_ifinfo.c b/capture_ifinfo.c index b8de531010..eb149b59f0 100644 --- a/capture_ifinfo.c +++ b/capture_ifinfo.c @@ -157,7 +157,7 @@ capture_interface_list(int *err, char **err_str) continue; } - if_info = g_malloc0(sizeof(if_info_t)); + if_info = g_new0(if_info_t,1); if_info->name = g_strdup(name); if (strlen(if_parts[1]) > 0) if_info->vendor_description = g_strdup(if_parts[1]); @@ -165,7 +165,7 @@ capture_interface_list(int *err, char **err_str) if_info->friendly_name = g_strdup(if_parts[2]); addr_parts = g_strsplit(if_parts[3], ",", 0); for (j = 0; addr_parts[j] != NULL; j++) { - if_addr = g_malloc0(sizeof(if_addr_t)); + if_addr = g_new0(if_addr_t,1); if (inet_pton(AF_INET, addr_parts[j], &if_addr->addr.ip4_addr)) { if_addr->ifat_type = IF_AT_IPv4; } else if (inet_pton(AF_INET6, addr_parts[j], @@ -252,7 +252,7 @@ capture_get_if_capabilities(const gchar *ifname, gboolean monitor_mode, /* * Allocate the interface capabilities structure. */ - caps = g_malloc(sizeof *caps); + caps = (if_capabilities_t *)g_malloc(sizeof *caps); switch (*raw_list[0]) { case '0': @@ -284,7 +284,7 @@ capture_get_if_capabilities(const gchar *ifname, gboolean monitor_mode, continue; } - data_link_info = g_malloc(sizeof (data_link_info_t)); + data_link_info = g_new(data_link_info_t,1); data_link_info->dlt = (int) strtol(lt_parts[0], NULL, 10); data_link_info->name = g_strdup(lt_parts[1]); if (strcmp(lt_parts[2], "(not supported)") != 0) diff --git a/capture_sync.c b/capture_sync.c index ad7378470b..8ae0365776 100644 --- a/capture_sync.c +++ b/capture_sync.c @@ -129,7 +129,7 @@ sync_pipe_add_arg(const char **args, int *argc, const char *arg) pointers, *not* counting the NULL pointer at the end, so we have to add 2 in order to get the new size of the array, including the new pointer and the terminating NULL pointer. */ - args = g_realloc( (gpointer) args, (*argc + 2) * sizeof (char *)); + args = (const char **)g_realloc( (gpointer) args, (*argc + 2) * sizeof (char *)); /* Stuff the pointer into the penultimate element of the array, which is the one at the index specified by "*argc". */ @@ -302,7 +302,7 @@ init_pipe_args(int *argc) { /* Allocate the string pointer array with enough space for the terminating NULL pointer. */ *argc = 0; - argv = g_malloc(sizeof (char *)); + argv = (const char **)g_malloc(sizeof (char *)); *argv = NULL; /* take Wireshark's absolute program path and replace "Wireshark" with "dumpcap" */ @@ -611,7 +611,7 @@ sync_pipe_start(capture_options *capture_opts) { /* Couldn't create the pipe between parent and child. */ report_failure("Couldn't create sync pipe: %s", g_strerror(errno)); for (i = 0; i < argc; i++) { - g_free( (gpointer) argv[i]); + g_free( (gconstpointer) argv[i]); } g_free(argv); return FALSE; @@ -624,7 +624,7 @@ sync_pipe_start(capture_options *capture_opts) { */ dup2(sync_pipe[PIPE_WRITE], 2); ws_close(sync_pipe[PIPE_READ]); - execv(argv[0], (gpointer)argv); + execv(argv[0], (char * const*)argv); g_snprintf(errmsg, sizeof errmsg, "Couldn't run %s in child process: %s", argv[0], g_strerror(errno)); sync_pipe_errmsg_to_parent(2, errmsg, ""); @@ -820,7 +820,7 @@ sync_pipe_open_command(const char** argv, int *data_read_fd, /* Couldn't create the message pipe between parent and child. */ *msg = g_strdup_printf("Couldn't create sync pipe: %s", g_strerror(errno)); for (i = 0; argv[i] != NULL; i++) { - g_free( (gpointer) argv[i]); + g_free( (gconstpointer) argv[i]); } g_free(argv); return -1; @@ -833,7 +833,7 @@ sync_pipe_open_command(const char** argv, int *data_read_fd, ws_close(sync_pipe[PIPE_READ]); ws_close(sync_pipe[PIPE_WRITE]); for (i = 0; argv[i] != NULL; i++) { - g_free( (gpointer) argv[i]); + g_free( (gconstpointer) argv[i]); } g_free(argv); return -1; @@ -850,7 +850,7 @@ sync_pipe_open_command(const char** argv, int *data_read_fd, dup2(sync_pipe[PIPE_WRITE], 2); ws_close(sync_pipe[PIPE_READ]); ws_close(sync_pipe[PIPE_WRITE]); - execv(argv[0], (gpointer)argv); + execv(argv[0], (char * const*)argv); g_snprintf(errmsg, sizeof errmsg, "Couldn't run %s in child process: %s", argv[0], g_strerror(errno)); sync_pipe_errmsg_to_parent(2, errmsg, ""); diff --git a/capture_ui_utils.c b/capture_ui_utils.c index 922f4aecd5..5636e7eaec 100644 --- a/capture_ui_utils.c +++ b/capture_ui_utils.c @@ -92,7 +92,7 @@ capture_dev_user_descr_find(const gchar *if_name) /* Allocate enough space to return the string, which runs from p2 to p, plus a terminating '\0'. */ - descr = g_malloc(p - p2 + 1); + descr = (char *)g_malloc(p - p2 + 1); memcpy(descr, p2, p - p2); descr[p - p2] = '\0'; return descr; @@ -178,7 +178,7 @@ get_interface_descriptive_name(const char *if_name) if (if_list != NULL) { if_entry = if_list; do { - if_info = if_entry->data; + if_info = (if_info_t *)if_entry->data; if (strcmp(if_info->name, if_name) == 0) { if (if_info->friendly_name != NULL) { /* We have a "friendly name"; return a copy of that @@ -218,7 +218,7 @@ search_info(GList *if_list, gchar *if_name) for (if_entry = if_list; if_entry != NULL; if_entry = g_list_next(if_entry)) { - if_info = if_entry->data; + if_info = (if_info_t *)if_entry->data; if(strcmp(if_name, if_info->name) == 0) { return if_info; @@ -275,7 +275,7 @@ build_capture_combo_list(GList *if_list, gboolean do_hide) /* Scan through the list and build a list of strings to display. */ for (if_entry = if_list; if_entry != NULL; if_entry = g_list_next(if_entry)) { - if_info = if_entry->data; + if_info = (if_info_t *)if_entry->data; /* Is this interface hidden and, if so, should we include it anyway? */ diff --git a/tap-rtp-common.c b/tap-rtp-common.c index 23f6eeb4da..b259fe5c28 100644 --- a/tap-rtp-common.c +++ b/tap-rtp-common.c @@ -52,8 +52,8 @@ /* GCompareFunc style comparison function for _rtp_stream_info */ gint rtp_stream_info_cmp(gconstpointer aa, gconstpointer bb) { - const struct _rtp_stream_info* a = aa; - const struct _rtp_stream_info* b = 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==b) return 0; @@ -97,7 +97,7 @@ void rtpstream_reset(rtpstream_tapinfo_t *tapinfo) void rtpstream_reset_cb(void *arg) { - rtpstream_reset(arg); + rtpstream_reset((rtpstream_tapinfo_t *)arg); } /* @@ -186,8 +186,8 @@ void rtp_write_sample(rtp_sample_t* sample, FILE* file) /* whenever a RTP packet is seen by the tap listener */ int rtpstream_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt _U_, const void *arg2) { - rtpstream_tapinfo_t *tapinfo = arg; - const struct _rtp_info *rtpinfo = arg2; + rtpstream_tapinfo_t *tapinfo = (rtpstream_tapinfo_t *)arg; + const struct _rtp_info *rtpinfo = (const struct _rtp_info *)arg2; rtp_stream_info_t tmp_strinfo; rtp_stream_info_t *strinfo = NULL; GList* list; @@ -255,13 +255,13 @@ int rtpstream_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt _U_, con tmp_strinfo.rtp_stats.reg_pt = PT_UNDEFINED; /* Get the Setup frame number who set this RTP stream */ - p_conv_data = p_get_proto_data(pinfo->fd, proto_get_id_by_filter_name("rtp")); + p_conv_data = (struct _rtp_conversation_info *)p_get_proto_data(pinfo->fd, proto_get_id_by_filter_name("rtp")); if (p_conv_data) tmp_strinfo.setup_frame_number = p_conv_data->frame_number; else tmp_strinfo.setup_frame_number = 0xFFFFFFFF; - strinfo = g_malloc(sizeof(rtp_stream_info_t)); + strinfo = g_new(rtp_stream_info_t,1); *strinfo = tmp_strinfo; /* memberwise copy of struct */ tapinfo->strinfo_list = g_list_append(tapinfo->strinfo_list, strinfo); } |