[MPlayer-cvslog] r32195 - in trunk/libmpdemux: aviprint.c demux_audio.c demux_lavf.c demux_mkv.c demux_rawaudio.c demux_realaud.c demux_vqf.c

reimar subversion at mplayerhq.hu
Sun Sep 12 15:26:39 CEST 2010


Author: reimar
Date: Sun Sep 12 15:26:39 2010
New Revision: 32195

Log:
Replace sizeof(type)

Modified:
   trunk/libmpdemux/aviprint.c
   trunk/libmpdemux/demux_audio.c
   trunk/libmpdemux/demux_lavf.c
   trunk/libmpdemux/demux_mkv.c
   trunk/libmpdemux/demux_rawaudio.c
   trunk/libmpdemux/demux_realaud.c
   trunk/libmpdemux/demux_vqf.c

Modified: trunk/libmpdemux/aviprint.c
==============================================================================
--- trunk/libmpdemux/aviprint.c	Sun Sep 12 15:14:18 2010	(r32194)
+++ trunk/libmpdemux/aviprint.c	Sun Sep 12 15:26:39 2010	(r32195)
@@ -117,12 +117,12 @@ void print_video_header(BITMAPINFOHEADER
 	mp_msg(MSGT_HEADER, verbose_level, "  biBitCount %d\n", h->biBitCount);
 	mp_msg(MSGT_HEADER, verbose_level, "  biCompression %d='%.4s'\n", h->biCompression, (char *)&h->biCompression);
 	mp_msg(MSGT_HEADER, verbose_level, "  biSizeImage %d\n", h->biSizeImage);
-  if (h->biSize > sizeof(BITMAPINFOHEADER))
+  if (h->biSize > sizeof(*h))
   {
     int i;
     uint8_t* p = (uint8_t*)(h + 1);
     mp_msg(MSGT_HEADER, verbose_level, "Unknown extra header dump: ");
-    for (i = 0; i < h->biSize-sizeof(BITMAPINFOHEADER); i++)
+    for (i = 0; i < h->biSize-sizeof(*h); i++)
 	mp_msg(MSGT_HEADER, verbose_level, "[%x] ", *(p+i));
     mp_msg(MSGT_HEADER, verbose_level, "\n");
   }

Modified: trunk/libmpdemux/demux_audio.c
==============================================================================
--- trunk/libmpdemux/demux_audio.c	Sun Sep 12 15:14:18 2010	(r32194)
+++ trunk/libmpdemux/demux_audio.c	Sun Sep 12 15:26:39 2010	(r32195)
@@ -336,7 +336,7 @@ static int demux_audio_open(demuxer_t* d
     sh_audio->audio.dwSampleSize= 0;
     sh_audio->audio.dwScale = mp3_found->mpa_spf;
     sh_audio->audio.dwRate = mp3_found->mp3_freq;
-    sh_audio->wf = malloc(sizeof(WAVEFORMATEX));
+    sh_audio->wf = malloc(sizeof(*sh_audio->wf));
     sh_audio->wf->wFormatTag = sh_audio->format;
     sh_audio->wf->nChannels = mp3_found->mp3_chans;
     sh_audio->wf->nSamplesPerSec = mp3_found->mp3_freq;
@@ -397,7 +397,7 @@ static int demux_audio_open(demuxer_t* d
       mp_msg(MSGT_DEMUX,MSGL_ERR,"[demux_audio] Bad wav header length: too long (%d)!!!\n",l);
       l = 16;
     }
-    sh_audio->wf = w = malloc(l > sizeof(WAVEFORMATEX) ? l : sizeof(WAVEFORMATEX));
+    sh_audio->wf = w = malloc(l > sizeof(*w) ? l : sizeof(*w));
     w->wFormatTag = sh_audio->format = stream_read_word_le(s);
     w->nChannels = sh_audio->channels = stream_read_word_le(s);
     w->nSamplesPerSec = sh_audio->samplerate = stream_read_dword_le(s);
@@ -416,7 +416,7 @@ static int demux_audio_open(demuxer_t* d
                l,w->cbSize);
         w->cbSize = l;
       }
-      stream_read(s,(char*)((char*)(w)+sizeof(WAVEFORMATEX)),w->cbSize);
+      stream_read(s,(char*)(w + 1),w->cbSize);
       l -= w->cbSize;
       if (w->wFormatTag & 0xfffe && w->cbSize >= 22)
           sh_audio->format = ((WAVEFORMATEXTENSIBLE *)w)->SubFormat;

Modified: trunk/libmpdemux/demux_lavf.c
==============================================================================
--- trunk/libmpdemux/demux_lavf.c	Sun Sep 12 15:14:18 2010	(r32194)
+++ trunk/libmpdemux/demux_lavf.c	Sun Sep 12 15:26:39 2010	(r32195)
@@ -276,7 +276,7 @@ static void handle_stream(demuxer_t *dem
                 break;
             stream_type = "audio";
             priv->astreams[priv->audio_streams] = i;
-            wf= calloc(sizeof(WAVEFORMATEX) + codec->extradata_size, 1);
+            wf= calloc(sizeof(*wf) + codec->extradata_size, 1);
             // mp4a tag is used for all mp4 files no matter what they actually contain
             if(codec->codec_tag == MKTAG('m', 'p', '4', 'a'))
                 codec->codec_tag= 0;
@@ -348,7 +348,7 @@ static void handle_stream(demuxer_t *dem
             if(!sh_video) break;
             stream_type = "video";
             priv->vstreams[priv->video_streams] = i;
-            bih=calloc(sizeof(BITMAPINFOHEADER) + codec->extradata_size,1);
+            bih=calloc(sizeof(*bih) + codec->extradata_size,1);
 
             if(codec->codec_id == CODEC_ID_RAWVIDEO) {
                 switch (codec->pix_fmt) {
@@ -358,7 +358,7 @@ static void handle_stream(demuxer_t *dem
             }
             if(!codec->codec_tag)
                 codec->codec_tag= av_codec_get_tag(mp_bmp_taglists, codec->codec_id);
-            bih->biSize= sizeof(BITMAPINFOHEADER) + codec->extradata_size;
+            bih->biSize= sizeof(*bih) + codec->extradata_size;
             bih->biWidth= codec->width;
             bih->biHeight= codec->height;
             bih->biBitCount= codec->bits_per_coded_sample;

Modified: trunk/libmpdemux/demux_mkv.c
==============================================================================
--- trunk/libmpdemux/demux_mkv.c	Sun Sep 12 15:14:18 2010	(r32194)
+++ trunk/libmpdemux/demux_mkv.c	Sun Sep 12 15:26:39 2010	(r32195)
@@ -1469,7 +1469,7 @@ static int demux_mkv_open_video(demuxer_
         BITMAPINFOHEADER *src;
 
         if (track->private_data == NULL
-            || track->private_size < sizeof(BITMAPINFOHEADER))
+            || track->private_size < sizeof(*bih))
             return 1;
 
         src = (BITMAPINFOHEADER *) track->private_data;
@@ -1485,17 +1485,17 @@ static int demux_mkv_open_video(demuxer_
         bih->biYPelsPerMeter = le2me_32(src->biYPelsPerMeter);
         bih->biClrUsed = le2me_32(src->biClrUsed);
         bih->biClrImportant = le2me_32(src->biClrImportant);
-        memcpy((char *) bih + sizeof(BITMAPINFOHEADER),
-               (char *) src + sizeof(BITMAPINFOHEADER),
-               track->private_size - sizeof(BITMAPINFOHEADER));
+        memcpy(bih + 1,
+               src + 1,
+               track->private_size - sizeof(*bih));
 
         if (track->v_width == 0)
             track->v_width = bih->biWidth;
         if (track->v_height == 0)
             track->v_height = bih->biHeight;
     } else {
-        bih = calloc(1, sizeof(BITMAPINFOHEADER));
-        bih->biSize = sizeof(BITMAPINFOHEADER);
+        bih = calloc(1, sizeof(*bih));
+        bih->biSize = sizeof(*bih);
         bih->biWidth = track->v_width;
         bih->biHeight = track->v_height;
         bih->biBitCount = 24;
@@ -1513,7 +1513,7 @@ static int demux_mkv_open_video(demuxer_
             src = (uint8_t *) track->private_data + RVPROPERTIES_SIZE;
 
             cnt = track->private_size - RVPROPERTIES_SIZE;
-            bih = realloc(bih, sizeof(BITMAPINFOHEADER) + 8 + cnt);
+            bih = realloc(bih, sizeof(*bih) + 8 + cnt);
             bih->biSize = 48 + cnt;
             bih->biPlanes = 1;
             type2 = AV_RB32(src - 4);
@@ -1617,7 +1617,7 @@ static int demux_mkv_open_audio(demuxer_
 
     sh_a->default_track = track->default_track;
     sh_a->ds = demuxer->audio;
-    sh_a->wf = malloc(sizeof(WAVEFORMATEX));
+    sh_a->wf = malloc(sizeof(*sh_a->wf));
     if (track->ms_compat && (track->private_size >= sizeof(WAVEFORMATEX))) {
         WAVEFORMATEX *wf = (WAVEFORMATEX *) track->private_data;
         sh_a->wf = realloc(sh_a->wf, track->private_size);

Modified: trunk/libmpdemux/demux_rawaudio.c
==============================================================================
--- trunk/libmpdemux/demux_rawaudio.c	Sun Sep 12 15:14:18 2010	(r32194)
+++ trunk/libmpdemux/demux_rawaudio.c	Sun Sep 12 15:26:39 2010	(r32195)
@@ -51,7 +51,7 @@ static demuxer_t* demux_rawaudio_open(de
   WAVEFORMATEX* w;
 
   sh_audio = new_sh_audio(demuxer,0, NULL);
-  sh_audio->wf = w = malloc(sizeof(WAVEFORMATEX));
+  sh_audio->wf = w = malloc(sizeof(*w));
   w->wFormatTag = sh_audio->format = format;
   w->nChannels = sh_audio->channels = channels;
   w->nSamplesPerSec = sh_audio->samplerate = samplerate;

Modified: trunk/libmpdemux/demux_realaud.c
==============================================================================
--- trunk/libmpdemux/demux_realaud.c	Sun Sep 12 15:14:18 2010	(r32194)
+++ trunk/libmpdemux/demux_realaud.c	Sun Sep 12 15:26:39 2010	(r32195)
@@ -287,7 +287,7 @@ static demuxer_t* demux_open_ra(demuxer_
 	}
 
 	/* Fill WAVEFORMATEX */
-	sh->wf = calloc(1, sizeof(WAVEFORMATEX));
+	sh->wf = calloc(1, sizeof(*sh->wf));
 	sh->wf->nChannels = sh->channels;
 	sh->wf->wBitsPerSample = sh->samplesize;
 	sh->wf->nSamplesPerSec = sh->samplerate;

Modified: trunk/libmpdemux/demux_vqf.c
==============================================================================
--- trunk/libmpdemux/demux_vqf.c	Sun Sep 12 15:14:18 2010	(r32194)
+++ trunk/libmpdemux/demux_vqf.c	Sun Sep 12 15:26:39 2010	(r32195)
@@ -49,7 +49,7 @@ static demuxer_t* demux_open_vqf(demuxer
   s = demuxer->stream;
 
   sh_audio = new_sh_audio(demuxer,0, NULL);
-  sh_audio->wf = w = calloc(1, sizeof(WAVEFORMATEX)+sizeof(headerInfo));
+  sh_audio->wf = w = calloc(1, sizeof(*sh_audio->wf)+sizeof(headerInfo));
   hi = (headerInfo *)&w[1];
   w->wFormatTag = 0x1;
   sh_audio->format = mmioFOURCC('T','W','I','N'); /* TWinVQ */


More information about the MPlayer-cvslog mailing list