diff options
author | Darren Salt <linux@youmustbejoking.demon.co.uk> | 2008-03-23 15:52:33 +0000 |
---|---|---|
committer | Darren Salt <linux@youmustbejoking.demon.co.uk> | 2008-03-23 15:52:33 +0000 |
commit | 2f6bd99aa3b9e9bee0601f90ab6e772c011c50ad (patch) | |
tree | cd7f9c17d69ed0a3213d94f2c05331363f04e9b0 /src | |
parent | 7a29f15cf90a3629185ef1f3987e24a3910785db (diff) | |
download | xine-lib-2f6bd99aa3b9e9bee0601f90ab6e772c011c50ad.tar.gz xine-lib-2f6bd99aa3b9e9bee0601f90ab6e772c011c50ad.tar.bz2 |
Replace various malloc(x*sizeof(y)) with calloc(x,sizeof(y)).
Diffstat (limited to 'src')
-rw-r--r-- | src/demuxers/demux_film.c | 2 | ||||
-rw-r--r-- | src/demuxers/demux_flac.c | 2 | ||||
-rw-r--r-- | src/demuxers/demux_flv.c | 4 | ||||
-rw-r--r-- | src/demuxers/demux_mpgaudio.c | 2 | ||||
-rw-r--r-- | src/demuxers/demux_qt.c | 38 | ||||
-rw-r--r-- | src/demuxers/demux_real.c | 2 | ||||
-rw-r--r-- | src/demuxers/demux_tta.c | 2 | ||||
-rw-r--r-- | src/demuxers/demux_vmd.c | 2 | ||||
-rw-r--r-- | src/demuxers/demux_wc3movie.c | 4 |
9 files changed, 28 insertions, 30 deletions
diff --git a/src/demuxers/demux_film.c b/src/demuxers/demux_film.c index 349c2578f..60365ab4d 100644 --- a/src/demuxers/demux_film.c +++ b/src/demuxers/demux_film.c @@ -256,7 +256,7 @@ static int open_film_file(demux_film_t *film) { film->frequency = _X_BE_32(&film_header[i + 8]); film->sample_count = _X_BE_32(&film_header[i + 12]); film->sample_table = - xine_xmalloc(film->sample_count * sizeof(film_sample_t)); + calloc(film->sample_count, sizeof(film_sample_t)); if (!film->sample_table) goto film_abort; for (j = 0; j < film->sample_count; j++) { diff --git a/src/demuxers/demux_flac.c b/src/demuxers/demux_flac.c index f6544bb67..c3d547cdb 100644 --- a/src/demuxers/demux_flac.c +++ b/src/demuxers/demux_flac.c @@ -164,7 +164,7 @@ static int open_flac_file(demux_flac_t *flac) { case 3: lprintf ("SEEKTABLE metadata, %d bytes\n", block_length); flac->seekpoint_count = block_length / FLAC_SEEKPOINT_SIZE; - flac->seekpoints = xine_xmalloc(flac->seekpoint_count * + flac->seekpoints = calloc(flac->seekpoint_count, sizeof(flac_seekpoint_t)); for (i = 0; i < flac->seekpoint_count; i++) { if (flac->input->read(flac->input, buffer, FLAC_SEEKPOINT_SIZE) != FLAC_SEEKPOINT_SIZE) diff --git a/src/demuxers/demux_flv.c b/src/demuxers/demux_flv.c index 15afe221d..0d18783c2 100644 --- a/src/demuxers/demux_flv.c +++ b/src/demuxers/demux_flv.c @@ -313,7 +313,7 @@ static int parse_flv_var(demux_flv_t *this, if (!this->index || this->num_indices != num) { if (this->index) free(this->index); - this->index = xine_xmalloc(num*sizeof(flv_index_entry_t)); + this->index = calloc(num, sizeof(flv_index_entry_t)); if (!this->index) return 0; this->num_indices = num; @@ -331,7 +331,7 @@ static int parse_flv_var(demux_flv_t *this, if (!this->index || this->num_indices != num) { if (this->index) free(this->index); - this->index = xine_xmalloc(num*sizeof(flv_index_entry_t)); + this->index = calloc(num, sizeof(flv_index_entry_t)); if (!this->index) return 0; this->num_indices = num; diff --git a/src/demuxers/demux_mpgaudio.c b/src/demuxers/demux_mpgaudio.c index 56759dd4b..c7af1c508 100644 --- a/src/demuxers/demux_mpgaudio.c +++ b/src/demuxers/demux_mpgaudio.c @@ -460,7 +460,7 @@ static vbri_header_t* parse_vbri_header(mpg_audio_frame_t *frame, lprintf("entry_frames: %d\n", vbri->entry_frames); if ((ptr + (vbri->toc_entries + 1) * vbri->entry_size) >= (buf + bufsize)) return 0; - vbri->toc = xine_xmalloc (sizeof(int) * (vbri->toc_entries + 1)); + vbri->toc = calloc (vbri->toc_entries + 1, sizeof (int)); if (!vbri->toc) { free (vbri); return NULL; diff --git a/src/demuxers/demux_qt.c b/src/demuxers/demux_qt.c index 1be93abd9..695059c09 100644 --- a/src/demuxers/demux_qt.c +++ b/src/demuxers/demux_qt.c @@ -911,8 +911,8 @@ static qt_error parse_trak_atom (qt_trak *trak, debug_atom_load(" qt elst atom (edit list atom): %d entries\n", trak->edit_list_count); - trak->edit_list_table = (edit_list_table_t *)xine_xmalloc( - trak->edit_list_count * sizeof(edit_list_table_t)); + trak->edit_list_table = (edit_list_table_t *)calloc( + trak->edit_list_count, sizeof(edit_list_table_t)); if (!trak->edit_list_table) { last_error = QT_NO_MEMORY; goto free_trak; @@ -947,7 +947,7 @@ static qt_error parse_trak_atom (qt_trak *trak, /* allocate space for each of the properties unions */ trak->stsd_atoms_count = _X_BE_32(&trak_atom[i + 8]); - trak->stsd_atoms = xine_xmalloc(trak->stsd_atoms_count * sizeof(properties_t)); + trak->stsd_atoms = calloc(trak->stsd_atoms_count, sizeof(properties_t)); if (!trak->stsd_atoms) { last_error = QT_NO_MEMORY; goto free_trak; @@ -1345,8 +1345,8 @@ static qt_error parse_trak_atom (qt_trak *trak, /* allocate space and load table only if sample size is 0 */ if (trak->sample_size == 0) { - trak->sample_size_table = (unsigned int *)malloc( - trak->sample_size_count * sizeof(unsigned int)); + trak->sample_size_table = (unsigned int *)calloc( + trak->sample_size_count, sizeof(unsigned int)); if (!trak->sample_size_table) { last_error = QT_NO_MEMORY; goto free_trak; @@ -1376,8 +1376,8 @@ static qt_error parse_trak_atom (qt_trak *trak, debug_atom_load(" qt stss atom (sample sync atom): %d sync samples\n", trak->sync_sample_count); - trak->sync_sample_table = (unsigned int *)malloc( - trak->sync_sample_count * sizeof(unsigned int)); + trak->sync_sample_table = (unsigned int *)calloc( + trak->sync_sample_count, sizeof(unsigned int)); if (!trak->sync_sample_table) { last_error = QT_NO_MEMORY; goto free_trak; @@ -1405,8 +1405,8 @@ static qt_error parse_trak_atom (qt_trak *trak, debug_atom_load(" qt stco atom (32-bit chunk offset atom): %d chunk offsets\n", trak->chunk_offset_count); - trak->chunk_offset_table = (int64_t *)malloc( - trak->chunk_offset_count * sizeof(int64_t)); + trak->chunk_offset_table = (int64_t *)calloc( + trak->chunk_offset_count, sizeof(int64_t)); if (!trak->chunk_offset_table) { last_error = QT_NO_MEMORY; goto free_trak; @@ -1433,8 +1433,8 @@ static qt_error parse_trak_atom (qt_trak *trak, debug_atom_load(" qt co64 atom (64-bit chunk offset atom): %d chunk offsets\n", trak->chunk_offset_count); - trak->chunk_offset_table = (int64_t *)malloc( - trak->chunk_offset_count * sizeof(int64_t)); + trak->chunk_offset_table = (int64_t *)calloc( + trak->chunk_offset_count, sizeof(int64_t)); if (!trak->chunk_offset_table) { last_error = QT_NO_MEMORY; goto free_trak; @@ -1464,8 +1464,8 @@ static qt_error parse_trak_atom (qt_trak *trak, debug_atom_load(" qt stsc atom (sample-to-chunk atom): %d entries\n", trak->sample_to_chunk_count); - trak->sample_to_chunk_table = (sample_to_chunk_table_t *)malloc( - trak->sample_to_chunk_count * sizeof(sample_to_chunk_table_t)); + trak->sample_to_chunk_table = (sample_to_chunk_table_t *)calloc( + trak->sample_to_chunk_count, sizeof(sample_to_chunk_table_t)); if (!trak->sample_to_chunk_table) { last_error = QT_NO_MEMORY; goto free_trak; @@ -1499,8 +1499,8 @@ static qt_error parse_trak_atom (qt_trak *trak, debug_atom_load(" qt stts atom (time-to-sample atom): %d entries\n", trak->time_to_sample_count); - trak->time_to_sample_table = (time_to_sample_table_t *)malloc( - (trak->time_to_sample_count+1) * sizeof(time_to_sample_table_t)); + trak->time_to_sample_table = (time_to_sample_table_t *)calloc( + trak->time_to_sample_count+1, sizeof(time_to_sample_table_t)); if (!trak->time_to_sample_table) { last_error = QT_NO_MEMORY; goto free_trak; @@ -1697,8 +1697,7 @@ static qt_error build_frame_table(qt_trak *trak, /* in this case, the total number of frames is equal to the number of * entries in the sample size table */ trak->frame_count = trak->sample_size_count; - trak->frames = (qt_frame *)malloc( - trak->frame_count * sizeof(qt_frame)); + trak->frames = (qt_frame *)calloc(trak->frame_count, sizeof(qt_frame)); if (!trak->frames) return QT_NO_MEMORY; trak->current_frame = 0; @@ -1710,7 +1709,7 @@ static qt_error build_frame_table(qt_trak *trak, pts_index_countdown = trak->time_to_sample_table[pts_index].count; - media_id_counts = xine_xmalloc(trak->stsd_atoms_count * sizeof(int)); + media_id_counts = calloc(trak->stsd_atoms_count, sizeof(int)); if (!media_id_counts) return QT_NO_MEMORY; memset(media_id_counts, 0, trak->stsd_atoms_count * sizeof(int)); @@ -1848,8 +1847,7 @@ static qt_error build_frame_table(qt_trak *trak, /* in this case, the total number of frames is equal to the number of * chunks */ trak->frame_count = trak->chunk_offset_count; - trak->frames = (qt_frame *)malloc( - trak->frame_count * sizeof(qt_frame)); + trak->frames = (qt_frame *)calloc(trak->frame_count, sizeof(qt_frame)); if (!trak->frames) return QT_NO_MEMORY; diff --git a/src/demuxers/demux_real.c b/src/demuxers/demux_real.c index c5096b210..60075d750 100644 --- a/src/demuxers/demux_real.c +++ b/src/demuxers/demux_real.c @@ -233,7 +233,7 @@ static void real_parse_index(demux_real_t *this) { if(index && entries) /* Allocate memory for index */ - *index = xine_xmalloc(entries * sizeof(real_index_entry_t)); + *index = calloc(entries, sizeof(real_index_entry_t)); if(index && entries && *index) { /* Read index */ diff --git a/src/demuxers/demux_tta.c b/src/demuxers/demux_tta.c index f6eadd652..f0dd2612e 100644 --- a/src/demuxers/demux_tta.c +++ b/src/demuxers/demux_tta.c @@ -87,7 +87,7 @@ static int open_tta_file(demux_tta_t *this) { return 0; } - this->seektable = xine_xmalloc(sizeof(uint32_t)*this->totalframes); + this->seektable = calloc(this->totalframes, sizeof(uint32_t)); this->input->read(this->input, this->seektable, sizeof(uint32_t)*this->totalframes); /* Skip the CRC32 */ diff --git a/src/demuxers/demux_vmd.c b/src/demuxers/demux_vmd.c index 8b0087417..416e86f39 100644 --- a/src/demuxers/demux_vmd.c +++ b/src/demuxers/demux_vmd.c @@ -168,7 +168,7 @@ static int open_vmd_file(demux_vmd_t *this) { return 0; } - this->frame_table = xine_xmalloc(this->frame_count * sizeof(vmd_frame_t)); + this->frame_table = calloc(this->frame_count, sizeof(vmd_frame_t)); current_offset = this->data_start = _X_LE_32(&vmd_header[20]); this->data_size = toc_offset - this->data_start; diff --git a/src/demuxers/demux_wc3movie.c b/src/demuxers/demux_wc3movie.c index 1a839924d..b3dcb775f 100644 --- a/src/demuxers/demux_wc3movie.c +++ b/src/demuxers/demux_wc3movie.c @@ -378,7 +378,7 @@ static int open_mve_file(demux_mve_t *this) { this->number_of_shots = _X_LE_32(&preamble[0]); /* allocate space for the shot offset index and set offsets to 0 */ - this->shot_offsets = xine_xmalloc(this->number_of_shots * sizeof(off_t)); + this->shot_offsets = calloc(this->number_of_shots, sizeof(off_t)); this->current_shot = 0; for (i = 0; i < this->number_of_shots; i++) this->shot_offsets[i] = 0; @@ -387,7 +387,7 @@ static int open_mve_file(demux_mve_t *this) { this->input->seek(this->input, 12, SEEK_CUR); /* load the palette chunks */ - this->palettes = xine_xmalloc(this->number_of_shots * PALETTE_SIZE * + this->palettes = calloc(this->number_of_shots, PALETTE_SIZE * sizeof(palette_entry_t)); if (!this->shot_offsets || !this->palettes) { |