Replace some sizeof(type) by sizeof(*pointer)
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>
Sun, 12 Sep 2010 12:22:01 +0000 (12:22 +0000)
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>
Sun, 12 Sep 2010 12:22:01 +0000 (12:22 +0000)
git-svn-id: svn://git.mplayerhq.hu/mplayer/trunk@32184 b3059339-0415-0410-9bf9-f77b7e298cf2

libmpdemux/asfheader.c
libmpdemux/demux_avs.c
libmpdemux/demux_roq.c
libmpdemux/demux_viv.c
libmpdemux/muxer_lavf.c

index 0ed64df..7f8c73b 100644 (file)
@@ -345,7 +345,7 @@ static int asf_init_audio_stream(demuxer_t *demuxer,struct asf_priv* asf, sh_aud
   uint8_t *buffer = *buf;
   int pos = *ppos;
 
-  sh_audio->wf=calloc((streamh->type_size<sizeof(WAVEFORMATEX))?sizeof(WAVEFORMATEX):streamh->type_size,1);
+  sh_audio->wf=calloc((streamh->type_size<sizeof(*sh_audio->wf))?sizeof(*sh_audio->wf):streamh->type_size,1);
   memcpy(sh_audio->wf,buffer,streamh->type_size);
   le2me_WAVEFORMATEX(sh_audio->wf);
   if( mp_msg_test(MSGT_HEADER,MSGL_V) ) print_wave_header(sh_audio->wf,MSGL_V);
@@ -494,10 +494,10 @@ int read_asf_header(demuxer_t *demuxer,struct asf_priv* asf){
         len=streamh->type_size-(4+4+1+2);
        ++video_streams;
 //        sh_video->bih=malloc(chunksize); memset(sh_video->bih,0,chunksize);
-        sh_video->bih=calloc((len<sizeof(BITMAPINFOHEADER))?sizeof(BITMAPINFOHEADER):len,1);
+        sh_video->bih=calloc((len<sizeof(*sh_video->bih))?sizeof(*sh_video->bih):len,1);
         memcpy(sh_video->bih,&buffer[4+4+1+2],len);
        le2me_BITMAPINFOHEADER(sh_video->bih);
-       if (sh_video->bih->biSize > len && sh_video->bih->biSize > sizeof(BITMAPINFOHEADER))
+       if (sh_video->bih->biSize > len && sh_video->bih->biSize > sizeof(*sh_video->bih))
                sh_video->bih->biSize = len;
         if (sh_video->bih->biCompression == mmioFOURCC('D', 'V', 'R', ' ')) {
           //mp_msg(MSGT_DEMUXER, MSGL_WARN, MSGTR_MPDEMUX_ASFHDR_DVRWantsLibavformat);
index 1f30f5d..fc14f1d 100644 (file)
@@ -300,7 +300,7 @@ static demuxer_t* demux_open_avs(demuxer_t* demuxer)
         sh_video->fps = (double) AVS->video_info->fps_numerator / (double) AVS->video_info->fps_denominator;
         sh_video->frametime = 1.0 / sh_video->fps;
 
-        sh_video->bih = malloc(sizeof(BITMAPINFOHEADER) + (256 * 4));
+        sh_video->bih = malloc(sizeof(*sh_video->bih) + (256 * 4));
         sh_video->bih->biCompression = sh_video->format;
         sh_video->bih->biBitCount = avs_bits_per_pixel(AVS->video_info);
         //sh_video->bih->biPlanes = 2;
@@ -333,7 +333,7 @@ static demuxer_t* demux_open_avs(demuxer_t* demuxer)
         demuxer->audio->sh = sh_audio;
         sh_audio->ds = demuxer->audio;
 
-        sh_audio->wf = malloc(sizeof(WAVEFORMATEX));
+        sh_audio->wf = malloc(sizeof(*sh_audio->wf));
         sh_audio->wf->wFormatTag = sh_audio->format =
             (AVS->video_info->sample_type == AVS_SAMPLE_FLOAT) ? 0x3 : 0x1;
         sh_audio->wf->nChannels = sh_audio->channels = AVS->video_info->nchannels;
index 72a96fc..3831f57 100644 (file)
@@ -177,7 +177,7 @@ static demuxer_t* demux_open_roq(demuxer_t* demuxer)
         sh_audio->ds = demuxer->audio;
 
         // go through the bother of making a WAVEFORMATEX structure
-        sh_audio->wf = malloc(sizeof(WAVEFORMATEX));
+        sh_audio->wf = malloc(sizeof(*sh_audio->wf));
 
         // custom fourcc for internal MPlayer use
         sh_audio->format = mmioFOURCC('R', 'o', 'Q', 'A');
index 600c557..03b02a8 100644 (file)
@@ -614,7 +614,7 @@ static demuxer_t* demux_open_vivo(demuxer_t* demuxer){
                    sh->disp_h = height;
 
                // emulate BITMAPINFOHEADER:
-               sh->bih=calloc(1, sizeof(BITMAPINFOHEADER));
+               sh->bih=calloc(1, sizeof(*sh->bih));
                sh->bih->biSize=40;
                if (priv->width)
                    sh->bih->biWidth = priv->width;
@@ -678,7 +678,7 @@ if (demuxer->audio->id >= -1){
                }
 
                // Emulate WAVEFORMATEX struct:
-               sh->wf=calloc(1, sizeof(WAVEFORMATEX));
+               sh->wf=calloc(1, sizeof(*sh->wf));
                sh->wf->wFormatTag=sh->format;
                sh->wf->nChannels=1; /* 1 channels for both Siren and G.723 */
 
index ca211e6..52302a6 100644 (file)
@@ -229,9 +229,9 @@ static void fix_parameters(muxer_stream_t *stream)
                ctx->bit_rate = 800000;
                ctx->time_base.den = stream->h.dwRate;
                ctx->time_base.num = stream->h.dwScale;
-               if(stream->bih+1 && (stream->bih->biSize > sizeof(BITMAPINFOHEADER)))
+               if(stream->bih+1 && (stream->bih->biSize > sizeof(*stream->bih)))
                {
-                       ctx->extradata_size = stream->bih->biSize - sizeof(BITMAPINFOHEADER);
+                       ctx->extradata_size = stream->bih->biSize - sizeof(*stream->bih);
                        ctx->extradata = av_malloc(ctx->extradata_size);
                        if(ctx->extradata != NULL)
                                memcpy(ctx->extradata, stream->bih+1, ctx->extradata_size);