changeset 32121:d332ea379205

Replace sizeof(WAVEFORMATEX) occurrences.
author reimar
date Sun, 12 Sep 2010 15:55:47 +0000
parents 20bc9bdd7aa1
children 0f9662ec84d0
files libmpcodecs/ad_acm.c libmpcodecs/ad_mpc.c libmpcodecs/ae_faac.c libmpcodecs/ae_toolame.c libmpcodecs/ae_twolame.c libmpdemux/demux_lmlm4.c libmpdemux/demux_nemesi.c libmpdemux/demux_nut.c libmpdemux/demux_rawdv.c libmpdemux/demux_xmms.c
diffstat 10 files changed, 14 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/ad_acm.c	Sun Sep 12 15:51:11 2010 +0000
+++ b/libmpcodecs/ad_acm.c	Sun Sep 12 15:55:47 2010 +0000
@@ -72,7 +72,7 @@
 
 //    priv->handle = NULL;
 
-    priv->o_wf = malloc(sizeof(WAVEFORMATEX));
+    priv->o_wf = malloc(sizeof(*priv->o_wf));
     if (!priv->o_wf)
     {
 	mp_msg(MSGT_DECAUDIO,MSGL_ERR,MSGTR_ACMiniterror);
--- a/libmpcodecs/ad_mpc.c	Sun Sep 12 15:51:11 2010 +0000
+++ b/libmpcodecs/ad_mpc.c	Sun Sep 12 15:55:47 2010 +0000
@@ -134,8 +134,7 @@
     mp_msg(MSGT_DECAUDIO, MSGL_FATAL, "Missing extradata!\n");
     return 0;
   }
-  cd->header = (char *)sh->wf;
-  cd->header = &cd->header[sizeof(WAVEFORMATEX)];
+  cd->header = (char *)(sh->wf + 1);
   cd->header_len = sh->wf->cbSize;
   cd->sh = sh;
   cd->pos = 0;
--- a/libmpcodecs/ae_faac.c	Sun Sep 12 15:51:11 2010 +0000
+++ b/libmpcodecs/ae_faac.c	Sun Sep 12 15:55:47 2010 +0000
@@ -68,7 +68,7 @@
 
 static int bind_faac(audio_encoder_t *encoder, muxer_stream_t *mux_a)
 {
-	mux_a->wf = calloc(1, sizeof(WAVEFORMATEX) + decoder_specific_len + 256);
+	mux_a->wf = calloc(1, sizeof(*mux_a->wf) + decoder_specific_len + 256);
 	mux_a->wf->wFormatTag = 0x706D;
 	mux_a->wf->nChannels = encoder->params.channels;
 	mux_a->h.dwSampleSize=0; // VBR
@@ -90,7 +90,7 @@
 	((MPEGLAYER3WAVEFORMAT *) (mux_a->wf))->nCodecDelay = 0;
 
 	// Fix allocation
-	mux_a->wf = realloc(mux_a->wf, sizeof(WAVEFORMATEX)+mux_a->wf->cbSize);
+	mux_a->wf = realloc(mux_a->wf, sizeof(*mux_a->wf)+mux_a->wf->cbSize);
 
 	if(config->inputFormat == FAAC_INPUT_FLOAT)
 		encoder->input_format = AF_FORMAT_FLOAT_NE;
--- a/libmpcodecs/ae_toolame.c	Sun Sep 12 15:51:11 2010 +0000
+++ b/libmpcodecs/ae_toolame.c	Sun Sep 12 15:55:47 2010 +0000
@@ -68,7 +68,7 @@
 {
 	mpae_toolame_ctx *ctx = (mpae_toolame_ctx *) encoder->priv;
 
-	mux_a->wf = malloc(sizeof(WAVEFORMATEX)+256);
+	mux_a->wf = malloc(sizeof(*mux_a->wf)+256);
 	mux_a->wf->wFormatTag = 0x50;
 	mux_a->wf->nChannels = encoder->params.channels;
 	mux_a->wf->nSamplesPerSec = encoder->params.sample_rate;
@@ -99,7 +99,7 @@
 	((MPEGLAYER3WAVEFORMAT *) (mux_a->wf))->nCodecDelay = 0;
 
 	// Fix allocation
-	mux_a->wf = realloc(mux_a->wf, sizeof(WAVEFORMATEX)+mux_a->wf->cbSize);
+	mux_a->wf = realloc(mux_a->wf, sizeof(*mux_a->wf)+mux_a->wf->cbSize);
 
 	encoder->input_format = AF_FORMAT_S16_NE;
 	encoder->min_buffer_size = mux_a->h.dwSuggestedBufferSize;
--- a/libmpcodecs/ae_twolame.c	Sun Sep 12 15:51:11 2010 +0000
+++ b/libmpcodecs/ae_twolame.c	Sun Sep 12 15:55:47 2010 +0000
@@ -66,7 +66,7 @@
 {
 	mpae_twolame_ctx *ctx = encoder->priv;
 
-	mux_a->wf = malloc(sizeof(WAVEFORMATEX)+256);
+	mux_a->wf = malloc(sizeof(*mux_a->wf)+256);
 	mux_a->wf->wFormatTag = 0x50;
 	mux_a->wf->nChannels = encoder->params.channels;
 	mux_a->wf->nSamplesPerSec = encoder->params.sample_rate;
@@ -97,7 +97,7 @@
 	((MPEGLAYER3WAVEFORMAT *) (mux_a->wf))->nCodecDelay = 0;
 
 	// Fix allocation
-	mux_a->wf = realloc(mux_a->wf, sizeof(WAVEFORMATEX)+mux_a->wf->cbSize);
+	mux_a->wf = realloc(mux_a->wf, sizeof(*mux_a->wf)+mux_a->wf->cbSize);
 
 	encoder->input_format = AF_FORMAT_S16_NE;
 	encoder->min_buffer_size = mux_a->h.dwSuggestedBufferSize;
--- a/libmpdemux/demux_lmlm4.c	Sun Sep 12 15:51:11 2010 +0000
+++ b/libmpdemux/demux_lmlm4.c	Sun Sep 12 15:55:47 2010 +0000
@@ -325,7 +325,7 @@
     demuxer->audio->sh = sh_audio;
     sh_audio->ds = demuxer->audio;
 
-    sh_audio->wf = calloc(1, sizeof(WAVEFORMATEX));
+    sh_audio->wf = calloc(1, sizeof(*sh_audio->wf));
 
     sh_audio->samplerate = 48000;
     sh_audio->wf->wBitsPerSample = 16;
--- a/libmpdemux/demux_nemesi.c	Sun Sep 12 15:51:11 2010 +0000
+++ b/libmpdemux/demux_nemesi.c	Sun Sep 12 15:55:47 2010 +0000
@@ -233,11 +233,11 @@
                                             sess, &buff, NULL);
 
                 if (buff.len) {
-                    wf = calloc(1,sizeof(WAVEFORMATEX)+buff.len);
+                    wf = calloc(1,sizeof(*wf)+buff.len);
                     wf->cbSize = buff.len;
                     memcpy(wf+1, buff.data, buff.len);
                 } else {
-                    wf = calloc(1,sizeof(WAVEFORMATEX));
+                    wf = calloc(1,sizeof(*wf));
                 }
 
                 sh_audio->wf = wf;
--- a/libmpdemux/demux_nut.c	Sun Sep 12 15:51:11 2010 +0000
+++ b/libmpdemux/demux_nut.c	Sun Sep 12 15:55:47 2010 +0000
@@ -111,7 +111,7 @@
 	for (i = 0; s[i].type != -1 && i < 2; i++) switch(s[i].type) {
 		case NUT_AUDIO_CLASS: {
 			WAVEFORMATEX *wf =
-				calloc(sizeof(WAVEFORMATEX) +
+				calloc(sizeof(*wf) +
 				              s[i].codec_specific_len, 1);
 			sh_audio_t* sh_audio = new_sh_audio(demuxer, i, NULL);
 			int j;
--- a/libmpdemux/demux_rawdv.c	Sun Sep 12 15:51:11 2010 +0000
+++ b/libmpdemux/demux_rawdv.c	Sun Sep 12 15:55:47 2010 +0000
@@ -215,7 +215,7 @@
        // custom fourcc for internal MPlayer use
        sh_audio->format = mmioFOURCC('R', 'A', 'D', 'V');
 
-	sh_audio->wf = calloc(1, sizeof(WAVEFORMATEX));
+	sh_audio->wf = calloc(1, sizeof(*sh_audio->wf));
 	sh_audio->wf->wFormatTag = sh_audio->format;
 	sh_audio->wf->nChannels = dv_decoder->audio->num_channels;
 	sh_audio->wf->wBitsPerSample = 16;
--- a/libmpdemux/demux_xmms.c	Sun Sep 12 15:51:11 2010 +0000
+++ b/libmpdemux/demux_xmms.c	Sun Sep 12 15:55:47 2010 +0000
@@ -266,7 +266,7 @@
 
     xmms_channels=0;
     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;
 
     demuxer->movi_start = 0;