diff libmpdemux/demux_audio.c @ 32111:7c8d240d37a6

Replace sizeof(type)
author reimar
date Sun, 12 Sep 2010 13:26:39 +0000
parents b52f89b55334
children 8fa2f43cb760
line wrap: on
line diff
--- a/libmpdemux/demux_audio.c	Sun Sep 12 13:14:18 2010 +0000
+++ b/libmpdemux/demux_audio.c	Sun Sep 12 13:26:39 2010 +0000
@@ -336,7 +336,7 @@
     sh_audio->audio.dwSampleSize= 0;
     sh_audio->audio.dwScale = mp3_found->mpa_spf;
     sh_audio->audio.dwRate = mp3_found->mp3_freq;
-    sh_audio->wf = malloc(sizeof(WAVEFORMATEX));
+    sh_audio->wf = malloc(sizeof(*sh_audio->wf));
     sh_audio->wf->wFormatTag = sh_audio->format;
     sh_audio->wf->nChannels = mp3_found->mp3_chans;
     sh_audio->wf->nSamplesPerSec = mp3_found->mp3_freq;
@@ -397,7 +397,7 @@
       mp_msg(MSGT_DEMUX,MSGL_ERR,"[demux_audio] Bad wav header length: too long (%d)!!!\n",l);
       l = 16;
     }
-    sh_audio->wf = w = malloc(l > sizeof(WAVEFORMATEX) ? l : sizeof(WAVEFORMATEX));
+    sh_audio->wf = w = malloc(l > sizeof(*w) ? l : sizeof(*w));
     w->wFormatTag = sh_audio->format = stream_read_word_le(s);
     w->nChannels = sh_audio->channels = stream_read_word_le(s);
     w->nSamplesPerSec = sh_audio->samplerate = stream_read_dword_le(s);
@@ -416,7 +416,7 @@
                l,w->cbSize);
         w->cbSize = l;
       }
-      stream_read(s,(char*)((char*)(w)+sizeof(WAVEFORMATEX)),w->cbSize);
+      stream_read(s,(char*)(w + 1),w->cbSize);
       l -= w->cbSize;
       if (w->wFormatTag & 0xfffe && w->cbSize >= 22)
           sh_audio->format = ((WAVEFORMATEXTENSIBLE *)w)->SubFormat;