[MPlayer-cvslog] r32193 - trunk/libmpdemux/demux_real.c
reimar
subversion at mplayerhq.hu
Sun Sep 12 15:13:36 CEST 2010
Author: reimar
Date: Sun Sep 12 15:13:36 2010
New Revision: 32193
Log:
Replace sizeof(type) by sizeof(*ptrvar)
Modified:
trunk/libmpdemux/demux_real.c
Modified: trunk/libmpdemux/demux_real.c
==============================================================================
--- trunk/libmpdemux/demux_real.c Sun Sep 12 15:10:12 2010 (r32192)
+++ trunk/libmpdemux/demux_real.c Sun Sep 12 15:13:36 2010 (r32193)
@@ -1373,7 +1373,7 @@ static demuxer_t* demux_open_real(demuxe
}
/* Emulate WAVEFORMATEX struct: */
- sh->wf = calloc(1, sizeof(WAVEFORMATEX));
+ sh->wf = calloc(1, sizeof(*sh->wf));
sh->wf->nChannels = sh->channels;
sh->wf->wBitsPerSample = sh->samplesize*8;
sh->wf->nSamplesPerSec = sh->samplerate;
@@ -1410,7 +1410,7 @@ static demuxer_t* demux_open_real(demuxe
goto skip_this_chunk;
}
sh->wf->cbSize = codecdata_length;
- sh->wf = realloc(sh->wf, sizeof(WAVEFORMATEX)+sh->wf->cbSize);
+ sh->wf = realloc(sh->wf, sizeof(*sh->wf)+sh->wf->cbSize);
stream_read(demuxer->stream, ((char*)(sh->wf+1)), codecdata_length); // extras
if (priv->intl_id[stream_id] == MKTAG('g', 'e', 'n', 'r'))
sh->wf->nBlockAlign = sub_packet_size;
@@ -1478,7 +1478,7 @@ static demuxer_t* demux_open_real(demuxe
mp_msg(MSGT_DEMUX, MSGL_INFO, MSGTR_AudioID, "real", stream_id);
/* Emulate WAVEFORMATEX struct: */
- sh->wf = calloc(1, sizeof(WAVEFORMATEX));
+ sh->wf = calloc(1, sizeof(*sh->wf));
sh->wf->nChannels = 0;//sh->channels;
sh->wf->wBitsPerSample = 16;
sh->wf->nSamplesPerSec = 0;//sh->samplerate;
@@ -1516,8 +1516,8 @@ static demuxer_t* demux_open_real(demuxe
mp_msg(MSGT_DEMUX,MSGL_V,"video fourcc: %.4s (%x)\n", (char *)&sh->format, sh->format);
/* emulate BITMAPINFOHEADER */
- sh->bih = calloc(1, sizeof(BITMAPINFOHEADER));
- sh->bih->biSize = sizeof(BITMAPINFOHEADER);
+ sh->bih = calloc(1, sizeof(*sh->bih));
+ sh->bih->biSize = sizeof(*sh->bih);
sh->disp_w = sh->bih->biWidth = stream_read_word(demuxer->stream);
sh->disp_h = sh->bih->biHeight = stream_read_word(demuxer->stream);
sh->bih->biPlanes = 1;
@@ -1552,10 +1552,10 @@ static demuxer_t* demux_open_real(demuxe
{
// read and store codec extradata
unsigned int cnt = codec_data_size - (stream_tell(demuxer->stream) - codec_pos);
- if (cnt > 0x7fffffff - sizeof(BITMAPINFOHEADER)) {
+ if (cnt > 0x7fffffff - sizeof(*sh->bih)) {
mp_msg(MSGT_DEMUX, MSGL_ERR,"Extradata too big (%u)\n", cnt);
} else {
- sh->bih = realloc(sh->bih, sizeof(BITMAPINFOHEADER) + cnt);
+ sh->bih = realloc(sh->bih, sizeof(*sh->bih) + cnt);
sh->bih->biSize += cnt;
stream_read(demuxer->stream, ((unsigned char*)(sh->bih+1)), cnt);
}
More information about the MPlayer-cvslog
mailing list