[MPlayer-cvslog] r32205 - in trunk: 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/de...

reimar subversion at mplayerhq.hu
Sun Sep 12 17:55:47 CEST 2010


Author: reimar
Date: Sun Sep 12 17:55:47 2010
New Revision: 32205

Log:
Replace sizeof(WAVEFORMATEX) occurrences.

Modified:
   trunk/libmpcodecs/ad_acm.c
   trunk/libmpcodecs/ad_mpc.c
   trunk/libmpcodecs/ae_faac.c
   trunk/libmpcodecs/ae_toolame.c
   trunk/libmpcodecs/ae_twolame.c
   trunk/libmpdemux/demux_lmlm4.c
   trunk/libmpdemux/demux_nemesi.c
   trunk/libmpdemux/demux_nut.c
   trunk/libmpdemux/demux_rawdv.c
   trunk/libmpdemux/demux_xmms.c

Modified: trunk/libmpcodecs/ad_acm.c
==============================================================================
--- trunk/libmpcodecs/ad_acm.c	Sun Sep 12 17:51:11 2010	(r32204)
+++ trunk/libmpcodecs/ad_acm.c	Sun Sep 12 17:55:47 2010	(r32205)
@@ -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);

Modified: trunk/libmpcodecs/ad_mpc.c
==============================================================================
--- trunk/libmpcodecs/ad_mpc.c	Sun Sep 12 17:51:11 2010	(r32204)
+++ trunk/libmpcodecs/ad_mpc.c	Sun Sep 12 17:55:47 2010	(r32205)
@@ -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;

Modified: trunk/libmpcodecs/ae_faac.c
==============================================================================
--- trunk/libmpcodecs/ae_faac.c	Sun Sep 12 17:51:11 2010	(r32204)
+++ trunk/libmpcodecs/ae_faac.c	Sun Sep 12 17:55:47 2010	(r32205)
@@ -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 *en
 	((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;

Modified: trunk/libmpcodecs/ae_toolame.c
==============================================================================
--- trunk/libmpcodecs/ae_toolame.c	Sun Sep 12 17:51:11 2010	(r32204)
+++ trunk/libmpcodecs/ae_toolame.c	Sun Sep 12 17:55:47 2010	(r32205)
@@ -68,7 +68,7 @@ static int bind_toolame(audio_encoder_t 
 {
 	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 
 	((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;

Modified: trunk/libmpcodecs/ae_twolame.c
==============================================================================
--- trunk/libmpcodecs/ae_twolame.c	Sun Sep 12 17:51:11 2010	(r32204)
+++ trunk/libmpcodecs/ae_twolame.c	Sun Sep 12 17:55:47 2010	(r32205)
@@ -66,7 +66,7 @@ static int bind_twolame(audio_encoder_t 
 {
 	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 
 	((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;

Modified: trunk/libmpdemux/demux_lmlm4.c
==============================================================================
--- trunk/libmpdemux/demux_lmlm4.c	Sun Sep 12 17:51:11 2010	(r32204)
+++ trunk/libmpdemux/demux_lmlm4.c	Sun Sep 12 17:55:47 2010	(r32205)
@@ -325,7 +325,7 @@ static demuxer_t* demux_open_lmlm4(demux
     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;

Modified: trunk/libmpdemux/demux_nemesi.c
==============================================================================
--- trunk/libmpdemux/demux_nemesi.c	Sun Sep 12 17:51:11 2010	(r32204)
+++ trunk/libmpdemux/demux_nemesi.c	Sun Sep 12 17:55:47 2010	(r32205)
@@ -233,11 +233,11 @@ static demuxer_t* demux_open_rtp(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;

Modified: trunk/libmpdemux/demux_nut.c
==============================================================================
--- trunk/libmpdemux/demux_nut.c	Sun Sep 12 17:51:11 2010	(r32204)
+++ trunk/libmpdemux/demux_nut.c	Sun Sep 12 17:55:47 2010	(r32205)
@@ -111,7 +111,7 @@ static demuxer_t * demux_open_nut(demuxe
 	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;

Modified: trunk/libmpdemux/demux_rawdv.c
==============================================================================
--- trunk/libmpdemux/demux_rawdv.c	Sun Sep 12 17:51:11 2010	(r32204)
+++ trunk/libmpdemux/demux_rawdv.c	Sun Sep 12 17:55:47 2010	(r32205)
@@ -215,7 +215,7 @@ static demuxer_t* demux_open_rawdv(demux
        // 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;

Modified: trunk/libmpdemux/demux_xmms.c
==============================================================================
--- trunk/libmpdemux/demux_xmms.c	Sun Sep 12 17:51:11 2010	(r32204)
+++ trunk/libmpdemux/demux_xmms.c	Sun Sep 12 17:55:47 2010	(r32205)
@@ -266,7 +266,7 @@ static int demux_xmms_open(demuxer_t* de
 
     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;


More information about the MPlayer-cvslog mailing list