diff libmpdemux/demux_real.c @ 32109:9b5658ebf058

Replace sizeof(type) by sizeof(*ptrvar)
author reimar
date Sun, 12 Sep 2010 13:13:36 +0000
parents e4b9fe8ff87a
children f9a0197ad67c
line wrap: on
line diff
--- a/libmpdemux/demux_real.c	Sun Sep 12 13:10:12 2010 +0000
+++ b/libmpdemux/demux_real.c	Sun Sep 12 13:13:36 2010 +0000
@@ -1373,7 +1373,7 @@
                    }
 
 		    /* 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 @@
 				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 @@
     		    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 @@
 		    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 @@
 		    {
 			    // 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);
 			    }