# HG changeset patch # User reimar # Date 1284294121 0 # Node ID 0e09b34b0c47666b03a18a00bee5ec322528fb42 # Parent 0e249bbc445c3df7a1199b554d317e71b064c00f Replace some sizeof(type) by sizeof(*pointer) diff -r 0e249bbc445c -r 0e09b34b0c47 libmpdemux/asfheader.c --- a/libmpdemux/asfheader.c Sun Sep 12 12:14:37 2010 +0000 +++ b/libmpdemux/asfheader.c Sun Sep 12 12:22:01 2010 +0000 @@ -345,7 +345,7 @@ uint8_t *buffer = *buf; int pos = *ppos; - sh_audio->wf=calloc((streamh->type_sizetype_size,1); + sh_audio->wf=calloc((streamh->type_sizewf))?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 @@ 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((lenbih=calloc((lenbih))?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); diff -r 0e249bbc445c -r 0e09b34b0c47 libmpdemux/demux_avs.c --- a/libmpdemux/demux_avs.c Sun Sep 12 12:14:37 2010 +0000 +++ b/libmpdemux/demux_avs.c Sun Sep 12 12:22:01 2010 +0000 @@ -300,7 +300,7 @@ 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 @@ 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; diff -r 0e249bbc445c -r 0e09b34b0c47 libmpdemux/demux_roq.c --- a/libmpdemux/demux_roq.c Sun Sep 12 12:14:37 2010 +0000 +++ b/libmpdemux/demux_roq.c Sun Sep 12 12:22:01 2010 +0000 @@ -177,7 +177,7 @@ 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'); diff -r 0e249bbc445c -r 0e09b34b0c47 libmpdemux/demux_viv.c --- a/libmpdemux/demux_viv.c Sun Sep 12 12:14:37 2010 +0000 +++ b/libmpdemux/demux_viv.c Sun Sep 12 12:22:01 2010 +0000 @@ -614,7 +614,7 @@ 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 @@ } // 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 */ diff -r 0e249bbc445c -r 0e09b34b0c47 libmpdemux/muxer_lavf.c --- a/libmpdemux/muxer_lavf.c Sun Sep 12 12:14:37 2010 +0000 +++ b/libmpdemux/muxer_lavf.c Sun Sep 12 12:22:01 2010 +0000 @@ -229,9 +229,9 @@ 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);