diff options
Diffstat (limited to 'wiretap')
-rw-r--r-- | wiretap/catapult_dct2000.c | 4 | ||||
-rw-r--r-- | wiretap/file_wrappers.c | 16 | ||||
-rw-r--r-- | wiretap/k12.c | 22 | ||||
-rw-r--r-- | wiretap/lanalyzer.c | 2 | ||||
-rw-r--r-- | wiretap/netmon.c | 6 | ||||
-rw-r--r-- | wiretap/netscaler.c | 2 | ||||
-rw-r--r-- | wiretap/nettl.c | 2 | ||||
-rw-r--r-- | wiretap/pcapng.c | 10 | ||||
-rw-r--r-- | wiretap/pppdump.c | 6 |
9 files changed, 35 insertions, 35 deletions
diff --git a/wiretap/catapult_dct2000.c b/wiretap/catapult_dct2000.c index dcd663cad3..02198eea27 100644 --- a/wiretap/catapult_dct2000.c +++ b/wiretap/catapult_dct2000.c @@ -211,7 +211,7 @@ catapult_dct2000_open(wtap *wth, int *err, gchar **err_info _U_) /* Need entry in file_externals table */ /* Allocate a new file_externals structure for this file */ - file_externals = g_malloc(sizeof(dct2000_file_externals_t)); + file_externals = g_new(dct2000_file_externals_t,1); memset((void*)file_externals, '\0', sizeof(dct2000_file_externals_t)); /* Copy this first line into buffer so could write out later */ @@ -403,7 +403,7 @@ catapult_dct2000_read(wtap *wth, int *err, gchar **err_info _U_, } /* Store the packet prefix in the hash table */ - line_prefix_info = g_malloc(sizeof(line_prefix_info_t)); + line_prefix_info = g_new(line_prefix_info_t,1); /* Create and use buffer for contents before time */ line_prefix_info->before_time = g_malloc(before_time_offset+2); diff --git a/wiretap/file_wrappers.c b/wiretap/file_wrappers.c index 537cc1a18e..0493a8d1e3 100644 --- a/wiretap/file_wrappers.c +++ b/wiretap/file_wrappers.c @@ -225,7 +225,7 @@ fast_seek_find(FILE_T file, gint64 pos) for (low = 0, max = file->fast_seek->len; low < max; ) { i = (low + max) / 2; - item = file->fast_seek->pdata[i]; + item = (struct fast_seek_point *)file->fast_seek->pdata[i]; if (pos < item->out) max = i; @@ -245,10 +245,10 @@ fast_seek_header(FILE_T file, gint64 in_pos, gint64 out_pos, int compression) struct fast_seek_point *item = NULL; if (file->fast_seek->len != 0) - item = file->fast_seek->pdata[file->fast_seek->len - 1]; + item = (struct fast_seek_point *)file->fast_seek->pdata[file->fast_seek->len - 1]; if (!item || item->out < out_pos) { - struct fast_seek_point *val = g_malloc(sizeof(struct fast_seek_point)); + struct fast_seek_point *val = g_new(struct fast_seek_point,1); val->in = in_pos; val->out = out_pos; val->compression = compression; @@ -402,7 +402,7 @@ static void zlib_fast_seek_add(FILE_T file, struct zlib_cur_seek_point *point, int bits, gint64 in_pos, gint64 out_pos) { /* it's for sure after gzip header, so file->fast_seek->len != 0 */ - struct fast_seek_point *item = file->fast_seek->pdata[file->fast_seek->len - 1]; + struct fast_seek_point *item = (struct fast_seek_point *)file->fast_seek->pdata[file->fast_seek->len - 1]; #ifndef HAVE_INFLATEPRIME if (bits) @@ -414,7 +414,7 @@ zlib_fast_seek_add(FILE_T file, struct zlib_cur_seek_point *point, int bits, gin * It's not big deal, cause first-read don't usually invoke seeking */ if (item->out + SPAN < out_pos) { - struct fast_seek_point *val = g_malloc(sizeof(struct fast_seek_point)); + struct fast_seek_point *val = g_new(struct fast_seek_point,1); val->in = in_pos; val->out = out_pos; val->compression = ZLIB; @@ -655,7 +655,7 @@ gz_head(FILE_T state) state->is_compressed = TRUE; #ifdef Z_BLOCK if (state->fast_seek) { - struct zlib_cur_seek_point *cur = g_malloc(sizeof(struct zlib_cur_seek_point)); + struct zlib_cur_seek_point *cur = g_new(struct zlib_cur_seek_point,1); cur->pos = cur->have = 0; g_free(state->fast_seek_cur); @@ -778,7 +778,7 @@ file_fdopen(int fd) return NULL; /* allocate FILE_T structure to return */ - state = g_try_malloc(sizeof *state); + state = (FILE_T)g_try_malloc(sizeof *state); if (state == NULL) return NULL; @@ -1360,7 +1360,7 @@ gzwfile_fdopen(int fd) GZWFILE_T state; /* allocate wtap_writer structure to return */ - state = g_try_malloc(sizeof *state); + state = (GZWFILE_T)g_try_malloc(sizeof *state); if (state == NULL) return NULL; state->fd = fd; diff --git a/wiretap/k12.c b/wiretap/k12.c index 2bd5f962d3..6a55f75d55 100644 --- a/wiretap/k12.c +++ b/wiretap/k12.c @@ -286,7 +286,7 @@ static gint get_record(guint8** bufferp, FILE_T fh, gint64 file_offset, /* no buffer is given, lets create it */ if (buffer == NULL) { - buffer = g_malloc(0x2000); + buffer = (guint8*)g_malloc(0x2000); buffer_len = 0x2000; } @@ -342,7 +342,7 @@ static gint get_record(guint8** bufferp, FILE_T fh, gint64 file_offset, return -1; } - while (left > buffer_len) *bufferp = buffer = g_realloc(buffer,buffer_len*=2); + while (left > buffer_len) *bufferp = buffer = (guint8*)g_realloc(buffer,buffer_len*=2); writep = buffer + 4; left -= 4; @@ -431,7 +431,7 @@ static gboolean k12_read(wtap *wth, int *err, gchar **err_info, gint64 *data_off src_id = pntohl(buffer + K12_RECORD_SRC_ID); - if ( ! (src_desc = g_hash_table_lookup(k12->src_by_id,GUINT_TO_POINTER(src_id))) ) { + if ( ! (src_desc = (k12_src_desc_t*)g_hash_table_lookup(k12->src_by_id,GUINT_TO_POINTER(src_id))) ) { /* * Some records from K15 files have a port ID of an undeclared * interface which happens to be the only one with the first byte changed. @@ -439,7 +439,7 @@ static gboolean k12_read(wtap *wth, int *err, gchar **err_info, gint64 *data_off * If the lookup of the interface record fails we'll mask it * and retry. */ - src_desc = g_hash_table_lookup(k12->src_by_id,GUINT_TO_POINTER(src_id&K12_RECORD_SRC_ID_MASK)); + src_desc = (k12_src_desc_t*)g_hash_table_lookup(k12->src_by_id,GUINT_TO_POINTER(src_id&K12_RECORD_SRC_ID_MASK)); } K12_DBG(5,("k12_read: record type=%x src_id=%x",type,src_id)); @@ -542,7 +542,7 @@ static gboolean k12_seek_read(wtap *wth, gint64 seek_off, union wtap_pseudo_head input = pntohl(buffer + K12_RECORD_SRC_ID); K12_DBG(5,("k12_seek_read: input=%.8x",input)); - if ( ! (src_desc = g_hash_table_lookup(k12->src_by_id,GUINT_TO_POINTER(input))) ) { + if ( ! (src_desc = (k12_src_desc_t*)g_hash_table_lookup(k12->src_by_id,GUINT_TO_POINTER(input))) ) { /* * Some records from K15 files have a port ID of an undeclared * interface which happens to be the only one with the first byte changed. @@ -550,7 +550,7 @@ static gboolean k12_seek_read(wtap *wth, gint64 seek_off, union wtap_pseudo_head * If the lookup of the interface record fails we'll mask it * and retry. */ - src_desc = g_hash_table_lookup(k12->src_by_id,GUINT_TO_POINTER(input&K12_RECORD_SRC_ID_MASK)); + src_desc = (k12_src_desc_t*)g_hash_table_lookup(k12->src_by_id,GUINT_TO_POINTER(input&K12_RECORD_SRC_ID_MASK)); } if (src_desc) { @@ -623,7 +623,7 @@ static gboolean k12_seek_read(wtap *wth, gint64 seek_off, union wtap_pseudo_head static k12_t* new_k12_file_data(void) { - k12_t* fd = g_malloc(sizeof(k12_t)); + k12_t* fd = g_new(k12_t,1); fd->file_len = 0; fd->num_of_records = 0; @@ -636,7 +636,7 @@ static k12_t* new_k12_file_data(void) { } static gboolean destroy_srcdsc(gpointer k _U_, gpointer v, gpointer p _U_) { - k12_src_desc_t* rec = v; + k12_src_desc_t* rec = (k12_src_desc_t*)v; g_free(rec->input_name); g_free(rec->stack_file); @@ -744,7 +744,7 @@ int k12_open(wtap *wth, int *err, gchar **err_info) { K12_DBG(5,("k12_open: FIRST PACKET offset=%x",offset)); break; } else if (type == K12_REC_SRCDSC || type == K12_REC_SRCDSC2 ) { - rec = g_malloc0(sizeof(k12_src_desc_t)); + rec = g_new0(k12_src_desc_t,1); rec_len = pntohl( read_buffer + K12_RECORD_LEN ); extra_len = pntohs( read_buffer + K12_SRCDESC_EXTRALEN ); @@ -870,8 +870,8 @@ static gboolean k12_dump_record(wtap_dumper *wdh, guint32 len, guint8* buffer, } static void k12_dump_src_setting(gpointer k _U_, gpointer v, gpointer p) { - k12_src_desc_t* src_desc = v; - wtap_dumper *wdh = p; + k12_src_desc_t* src_desc = (k12_src_desc_t*)v; + wtap_dumper *wdh = (wtap_dumper *)p; guint32 len; guint offset; guint i; diff --git a/wiretap/lanalyzer.c b/wiretap/lanalyzer.c index 77a6887041..732b96f668 100644 --- a/wiretap/lanalyzer.c +++ b/wiretap/lanalyzer.c @@ -322,7 +322,7 @@ int lanalyzer_open(wtap *wth, int *err, gchar **err_info) if (record_length != 0) { /* Read the rest of the record as a comment. */ - comment = g_malloc(record_length + 1); + comment = (char *)g_malloc(record_length + 1); bytes_read = file_read(comment, record_length, wth->fh); if (bytes_read != record_length) { *err = file_error(wth->fh, err_info); diff --git a/wiretap/netmon.c b/wiretap/netmon.c index e5253ace55..3df3636bf6 100644 --- a/wiretap/netmon.c +++ b/wiretap/netmon.c @@ -362,7 +362,7 @@ int netmon_open(wtap *wth, int *err, gchar **err_info) g_free(netmon); return -1; } - frame_table = g_malloc(frame_table_length); + frame_table = (guint32 *)g_malloc(frame_table_length); errno = WTAP_ERR_CANT_READ; bytes_read = file_read(frame_table, frame_table_length, wth->fh); if ((guint32)bytes_read != frame_table_length) { @@ -1167,7 +1167,7 @@ static gboolean netmon_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, /* * Haven't yet allocated the buffer for the frame table. */ - netmon->frame_table = g_malloc(1024 * sizeof *netmon->frame_table); + netmon->frame_table = (guint32 *)g_malloc(1024 * sizeof *netmon->frame_table); netmon->frame_table_size = 1024; } else { /* @@ -1178,7 +1178,7 @@ static gboolean netmon_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, * Yes - double the size of the frame table. */ netmon->frame_table_size *= 2; - netmon->frame_table = g_realloc(netmon->frame_table, + netmon->frame_table = (guint32 *)g_realloc(netmon->frame_table, netmon->frame_table_size * sizeof *netmon->frame_table); } } diff --git a/wiretap/netscaler.c b/wiretap/netscaler.c index 68ab88271d..1154a6e66d 100644 --- a/wiretap/netscaler.c +++ b/wiretap/netscaler.c @@ -499,7 +499,7 @@ int nstrace_open(wtap *wth, int *err, gchar **err_info) if ((file_size = wtap_file_size(wth, err)) == -1) return 0; - nstrace_buf = g_malloc(NSPR_PAGESIZE); + nstrace_buf = (gchar *)g_malloc(NSPR_PAGESIZE); page_size = GET_READ_PAGE_SIZE(file_size); switch ((wth->file_type = nspm_signature_version(wth, nstrace_buf, page_size))) diff --git a/wiretap/nettl.c b/wiretap/nettl.c index b83c693cf7..23ebbbbe44 100644 --- a/wiretap/nettl.c +++ b/wiretap/nettl.c @@ -229,7 +229,7 @@ int nettl_open(wtap *wth, int *err, gchar **err_info) /* This is an nettl file */ wth->file_type = WTAP_FILE_NETTL; - nettl = g_malloc(sizeof(nettl_t)); + nettl = g_new(nettl_t,1); wth->priv = (void *)nettl; if (file_hdr.os_vers[2] == '1' && file_hdr.os_vers[3] == '1') nettl->is_hpux_11 = TRUE; diff --git a/wiretap/pcapng.c b/wiretap/pcapng.c index cabbd576e5..17d0cb887c 100644 --- a/wiretap/pcapng.c +++ b/wiretap/pcapng.c @@ -575,7 +575,7 @@ pcapng_read_section_header_block(FILE_T fh, gboolean first_block, to_read = bh->block_total_length - MIN_SHB_SIZE; /* Allocate enough memory to hold all options */ opt_cont_buf_len = to_read; - option_content = g_malloc(opt_cont_buf_len); + option_content = (char *)g_malloc(opt_cont_buf_len); pcapng_debug1("pcapng_read_section_header_block: Options %u bytes", to_read); while (to_read > 0) { /* read option */ @@ -729,7 +729,7 @@ pcapng_read_if_descr_block(FILE_T fh, pcapng_block_header_t *bh, pcapng_t *pn, /* Allocate enough memory to hold all options */ opt_cont_buf_len = to_read; - option_content = g_malloc(opt_cont_buf_len); + option_content = (char *)g_malloc(opt_cont_buf_len); while (to_read > 0) { /* read option */ @@ -838,7 +838,7 @@ pcapng_read_if_descr_block(FILE_T fh, pcapng_block_header_t *bh, pcapng_t *pn, pcapng_debug2("pcapng_read_if_descr_block: if_filter_str %s oh.option_length %u", wblock->data.if_descr.if_filter_str, oh.option_length); } else if (option_content[0] == 1) { wblock->data.if_descr.bpf_filter_len = oh.option_length-1; - wblock->data.if_descr.if_filter_bpf_bytes = g_malloc(oh.option_length-1); + wblock->data.if_descr.if_filter_bpf_bytes = (gchar *)g_malloc(oh.option_length-1); memcpy(&wblock->data.if_descr.if_filter_bpf_bytes, option_content+1, oh.option_length-1); } } else { @@ -1688,7 +1688,7 @@ pcapng_read_interface_statistics_block(FILE_T fh, pcapng_block_header_t *bh, pca /* Allocate enough memory to hold all options */ opt_cont_buf_len = to_read; - option_content = g_malloc(opt_cont_buf_len); + option_content = (char *)g_malloc(opt_cont_buf_len); while (to_read > 0) { /* read option */ @@ -3266,7 +3266,7 @@ pcapng_write_name_resolution_block(wtap_dumper *wdh, pcapng_dump_t *pcapng, int rec_off = 8; /* block type + block total length */ bh.block_type = BLOCK_TYPE_NRB; bh.block_total_length = rec_off + 8; /* end-of-record + block total length */ - rec_data = g_malloc(NRES_REC_MAX_SIZE); + rec_data = (guint8 *)g_malloc(NRES_REC_MAX_SIZE); for (; pcapng->addrinfo_list_last && pcapng->addrinfo_list_last->ai_next; pcapng->addrinfo_list_last = pcapng->addrinfo_list_last->ai_next ) { ai = pcapng->addrinfo_list_last->ai_next; /* Skips over the first (dummy) entry */ diff --git a/wiretap/pppdump.c b/wiretap/pppdump.c index 84cbadd92d..e458876bea 100644 --- a/wiretap/pppdump.c +++ b/wiretap/pppdump.c @@ -326,7 +326,7 @@ pppdump_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset) buffer_assure_space(wth->frame_buffer, PPPD_BUF_SIZE); buf = buffer_start_ptr(wth->frame_buffer); - state = wth->priv; + state = (pppdump_t *)wth->priv; /* If we have a random stream open, allocate a structure to hold the information needed to read this packet's data again. */ @@ -721,9 +721,9 @@ pppdump_seek_read(wtap *wth, pkt_id *pid; gint64 num_bytes_to_skip; - state = wth->priv; + state = (pppdump_t *)wth->priv; - pid = g_ptr_array_index(state->pids, seek_off); + pid = (pkt_id *)g_ptr_array_index(state->pids, seek_off); if (!pid) { *err = WTAP_ERR_BAD_FILE; /* XXX - better error? */ *err_info = g_strdup("pppdump: PID not found for record"); |