# HG changeset patch # User reimar # Date 1254295663 0 # Node ID 183ea012e25b27fa3fc6fa0cc060b90eaa27ea64 # Parent b5e23411a51e8a802ed9d2140bc5bd769c8b3230 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. diff -r b5e23411a51e -r 183ea012e25b libmpdemux/demux_mkv.c --- a/libmpdemux/demux_mkv.c Tue Sep 29 06:44:10 2009 +0000 +++ b/libmpdemux/demux_mkv.c Wed Sep 30 07:27:43 2009 +0000 @@ -204,11 +204,12 @@ /** * \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 @@ 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 @@ 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;