Replace sizeof(WAVEFORMATEX) occurrences.
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>
Sun, 12 Sep 2010 15:55:47 +0000 (15:55 +0000)
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>
Sun, 12 Sep 2010 15:55:47 +0000 (15:55 +0000)
git-svn-id: svn://git.mplayerhq.hu/mplayer/trunk@32205 b3059339-0415-0410-9bf9-f77b7e298cf2

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

index b179515..0d2cba8 100644 (file)
@@ -72,7 +72,7 @@ static int preinit(sh_audio_t *sh_audio)
 
 //    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);
index 33ed911..31463ab 100644 (file)
@@ -134,8 +134,7 @@ static int init(sh_audio_t *sh) {
     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;
index 63c7163..0988a2c 100644 (file)
@@ -68,7 +68,7 @@ const m_option_t faacopts_conf[] = {
 
 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 @@ static int bind_faac(audio_encoder_t *encoder, muxer_stream_t *mux_a)
        ((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;
index 83e2760..3cb4c51 100644 (file)
@@ -68,7 +68,7 @@ static int bind_toolame(audio_encoder_t *encoder, muxer_stream_t *mux_a)
 {
        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 @@ static int bind_toolame(audio_encoder_t *encoder, muxer_stream_t *mux_a)
        ((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;
index fc66337..8e174e0 100644 (file)
@@ -66,7 +66,7 @@ static int bind_twolame(audio_encoder_t *encoder, muxer_stream_t *mux_a)
 {
        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 @@ static int bind_twolame(audio_encoder_t *encoder, muxer_stream_t *mux_a)
        ((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;
index 6afa3d8..0952f14 100644 (file)
@@ -325,7 +325,7 @@ static demuxer_t* demux_open_lmlm4(demuxer_t* demuxer){
     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;
index 7faba92..b6978c0 100644 (file)
@@ -233,11 +233,11 @@ static demuxer_t* demux_open_rtp(demuxer_t* demuxer)
                                             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;
index 84d7b6c..169337e 100644 (file)
@@ -111,7 +111,7 @@ static demuxer_t * demux_open_nut(demuxer_t * demuxer) {
        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;
index 00140c8..6a41920 100644 (file)
@@ -215,7 +215,7 @@ static demuxer_t* demux_open_rawdv(demuxer_t* demuxer)
        // 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;
index 61c9ad3..097c1b2 100644 (file)
@@ -266,7 +266,7 @@ static int demux_xmms_open(demuxer_t* demuxer) {
 
     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;