mirror of
https://github.com/mpv-player/mpv.git
synced 2026-10-28 23:13:18 +08:00
Change grow_array argument from void ** to void *, this avoids a aliasing
violation (thus making gcc 4.4.x compile the code correctly) and allows to get rid of some casts at the expense of making the code less clear. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29733 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
@@ -204,11 +204,12 @@ extern int dvdsub_id;
|
||||
|
||||
/**
|
||||
* \brief ensures there is space for at least one additional element
|
||||
* \param array array to grow
|
||||
* \param arrayp array to grow
|
||||
* \param nelem current number of elements in array
|
||||
* \param elsize size of one array element
|
||||
*/
|
||||
static void grow_array(void **array, int nelem, size_t elsize) {
|
||||
static void grow_array(void *arrayp, int nelem, size_t elsize) {
|
||||
void **array = arrayp;
|
||||
if (!(nelem & 31))
|
||||
*array = realloc(*array, (nelem + 32) * elsize);
|
||||
}
|
||||
@@ -235,7 +236,7 @@ add_cluster_position (mkv_demuxer_t *mkv_d, uint64_t position)
|
||||
if (mkv_d->cluster_positions[i] == position)
|
||||
return;
|
||||
|
||||
grow_array((void **)&mkv_d->cluster_positions, mkv_d->num_cluster_pos,
|
||||
grow_array(&mkv_d->cluster_positions, mkv_d->num_cluster_pos,
|
||||
sizeof(uint64_t));
|
||||
mkv_d->cluster_positions[mkv_d->num_cluster_pos++] = position;
|
||||
}
|
||||
@@ -1079,7 +1080,7 @@ demux_mkv_read_cues (demuxer_t *demuxer)
|
||||
if (time != EBML_UINT_INVALID && track != EBML_UINT_INVALID
|
||||
&& pos != EBML_UINT_INVALID)
|
||||
{
|
||||
grow_array((void **)&mkv_d->indexes, mkv_d->num_indexes, sizeof(mkv_index_t));
|
||||
grow_array(&mkv_d->indexes, mkv_d->num_indexes, sizeof(mkv_index_t));
|
||||
mkv_d->indexes[mkv_d->num_indexes].tnum = track;
|
||||
mkv_d->indexes[mkv_d->num_indexes].timecode = time;
|
||||
mkv_d->indexes[mkv_d->num_indexes].filepos =mkv_d->segment_start+pos;
|
||||
|
||||
Reference in New Issue
Block a user