[MPlayer-cvslog] r32184 - in trunk/libmpdemux: asfheader.c demux_avs.c demux_roq.c demux_viv.c muxer_lavf.c

reimar subversion at mplayerhq.hu
Sun Sep 12 14:22:01 CEST 2010


Author: reimar
Date: Sun Sep 12 14:22:01 2010
New Revision: 32184

Log:
Replace some sizeof(type) by sizeof(*pointer)

Modified:
   trunk/libmpdemux/asfheader.c
   trunk/libmpdemux/demux_avs.c
   trunk/libmpdemux/demux_roq.c
   trunk/libmpdemux/demux_viv.c
   trunk/libmpdemux/muxer_lavf.c

Modified: trunk/libmpdemux/asfheader.c
==============================================================================
--- trunk/libmpdemux/asfheader.c	Sun Sep 12 14:14:37 2010	(r32183)
+++ trunk/libmpdemux/asfheader.c	Sun Sep 12 14:22:01 2010	(r32184)
@@ -345,7 +345,7 @@ static int asf_init_audio_stream(demuxer
   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,s
         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);

Modified: trunk/libmpdemux/demux_avs.c
==============================================================================
--- trunk/libmpdemux/demux_avs.c	Sun Sep 12 14:14:37 2010	(r32183)
+++ trunk/libmpdemux/demux_avs.c	Sun Sep 12 14:22:01 2010	(r32184)
@@ -300,7 +300,7 @@ static demuxer_t* demux_open_avs(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
         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;

Modified: trunk/libmpdemux/demux_roq.c
==============================================================================
--- trunk/libmpdemux/demux_roq.c	Sun Sep 12 14:14:37 2010	(r32183)
+++ trunk/libmpdemux/demux_roq.c	Sun Sep 12 14:22:01 2010	(r32184)
@@ -177,7 +177,7 @@ static demuxer_t* demux_open_roq(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');

Modified: trunk/libmpdemux/demux_viv.c
==============================================================================
--- trunk/libmpdemux/demux_viv.c	Sun Sep 12 14:14:37 2010	(r32183)
+++ trunk/libmpdemux/demux_viv.c	Sun Sep 12 14:22:01 2010	(r32184)
@@ -614,7 +614,7 @@ static demuxer_t* demux_open_vivo(demuxe
 		    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 */
 

Modified: trunk/libmpdemux/muxer_lavf.c
==============================================================================
--- trunk/libmpdemux/muxer_lavf.c	Sun Sep 12 14:14:37 2010	(r32183)
+++ trunk/libmpdemux/muxer_lavf.c	Sun Sep 12 14:22:01 2010	(r32184)
@@ -229,9 +229,9 @@ static void fix_parameters(muxer_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);


More information about the MPlayer-cvslog mailing list