[MPlayer-cvslog] r29733 - trunk/libmpdemux/demux_mkv.c
reimar
subversion at mplayerhq.hu
Wed Sep 30 09:27:43 CEST 2009
Author: reimar
Date: Wed Sep 30 09:27:43 2009
New Revision: 29733
Log:
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.
Modified:
trunk/libmpdemux/demux_mkv.c
Modified: trunk/libmpdemux/demux_mkv.c
==============================================================================
--- trunk/libmpdemux/demux_mkv.c Tue Sep 29 08:44:10 2009 (r29732)
+++ trunk/libmpdemux/demux_mkv.c Wed Sep 30 09:27:43 2009 (r29733)
@@ -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
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;
More information about the MPlayer-cvslog
mailing list