src/audio/SDL_wave.c
branchSDL-1.3
changeset 1668 4da1ee79c9af
parent 1662 782fd950bd46
     1.1 --- a/src/audio/SDL_wave.c	Mon May 29 03:53:21 2006 +0000
     1.2 +++ b/src/audio/SDL_wave.c	Mon May 29 04:04:35 2006 +0000
     1.3 @@ -27,7 +27,7 @@
     1.4  #include "SDL_wave.h"
     1.5  
     1.6  
     1.7 -static int ReadChunk (SDL_RWops * src, Chunk * chunk);
     1.8 +static int ReadChunk(SDL_RWops * src, Chunk * chunk);
     1.9  
    1.10  struct MS_ADPCM_decodestate
    1.11  {
    1.12 @@ -47,45 +47,45 @@
    1.13  } MS_ADPCM_state;
    1.14  
    1.15  static int
    1.16 -InitMS_ADPCM (WaveFMT * format)
    1.17 +InitMS_ADPCM(WaveFMT * format)
    1.18  {
    1.19      Uint8 *rogue_feel;
    1.20      Uint16 extra_info;
    1.21      int i;
    1.22  
    1.23      /* Set the rogue pointer to the MS_ADPCM specific data */
    1.24 -    MS_ADPCM_state.wavefmt.encoding = SDL_SwapLE16 (format->encoding);
    1.25 -    MS_ADPCM_state.wavefmt.channels = SDL_SwapLE16 (format->channels);
    1.26 -    MS_ADPCM_state.wavefmt.frequency = SDL_SwapLE32 (format->frequency);
    1.27 -    MS_ADPCM_state.wavefmt.byterate = SDL_SwapLE32 (format->byterate);
    1.28 -    MS_ADPCM_state.wavefmt.blockalign = SDL_SwapLE16 (format->blockalign);
    1.29 +    MS_ADPCM_state.wavefmt.encoding = SDL_SwapLE16(format->encoding);
    1.30 +    MS_ADPCM_state.wavefmt.channels = SDL_SwapLE16(format->channels);
    1.31 +    MS_ADPCM_state.wavefmt.frequency = SDL_SwapLE32(format->frequency);
    1.32 +    MS_ADPCM_state.wavefmt.byterate = SDL_SwapLE32(format->byterate);
    1.33 +    MS_ADPCM_state.wavefmt.blockalign = SDL_SwapLE16(format->blockalign);
    1.34      MS_ADPCM_state.wavefmt.bitspersample =
    1.35 -        SDL_SwapLE16 (format->bitspersample);
    1.36 -    rogue_feel = (Uint8 *) format + sizeof (*format);
    1.37 -    if (sizeof (*format) == 16) {
    1.38 +        SDL_SwapLE16(format->bitspersample);
    1.39 +    rogue_feel = (Uint8 *) format + sizeof(*format);
    1.40 +    if (sizeof(*format) == 16) {
    1.41          extra_info = ((rogue_feel[1] << 8) | rogue_feel[0]);
    1.42 -        rogue_feel += sizeof (Uint16);
    1.43 +        rogue_feel += sizeof(Uint16);
    1.44      }
    1.45      MS_ADPCM_state.wSamplesPerBlock = ((rogue_feel[1] << 8) | rogue_feel[0]);
    1.46 -    rogue_feel += sizeof (Uint16);
    1.47 +    rogue_feel += sizeof(Uint16);
    1.48      MS_ADPCM_state.wNumCoef = ((rogue_feel[1] << 8) | rogue_feel[0]);
    1.49 -    rogue_feel += sizeof (Uint16);
    1.50 +    rogue_feel += sizeof(Uint16);
    1.51      if (MS_ADPCM_state.wNumCoef != 7) {
    1.52 -        SDL_SetError ("Unknown set of MS_ADPCM coefficients");
    1.53 +        SDL_SetError("Unknown set of MS_ADPCM coefficients");
    1.54          return (-1);
    1.55      }
    1.56      for (i = 0; i < MS_ADPCM_state.wNumCoef; ++i) {
    1.57          MS_ADPCM_state.aCoeff[i][0] = ((rogue_feel[1] << 8) | rogue_feel[0]);
    1.58 -        rogue_feel += sizeof (Uint16);
    1.59 +        rogue_feel += sizeof(Uint16);
    1.60          MS_ADPCM_state.aCoeff[i][1] = ((rogue_feel[1] << 8) | rogue_feel[0]);
    1.61 -        rogue_feel += sizeof (Uint16);
    1.62 +        rogue_feel += sizeof(Uint16);
    1.63      }
    1.64      return (0);
    1.65  }
    1.66  
    1.67  static Sint32
    1.68 -MS_ADPCM_nibble (struct MS_ADPCM_decodestate *state,
    1.69 -                 Uint8 nybble, Sint16 * coeff)
    1.70 +MS_ADPCM_nibble(struct MS_ADPCM_decodestate *state,
    1.71 +                Uint8 nybble, Sint16 * coeff)
    1.72  {
    1.73      const Sint32 max_audioval = ((1 << (16 - 1)) - 1);
    1.74      const Sint32 min_audioval = -(1 << (16 - 1));
    1.75 @@ -118,7 +118,7 @@
    1.76  }
    1.77  
    1.78  static int
    1.79 -MS_ADPCM_decode (Uint8 ** audio_buf, Uint32 * audio_len)
    1.80 +MS_ADPCM_decode(Uint8 ** audio_buf, Uint32 * audio_len)
    1.81  {
    1.82      struct MS_ADPCM_decodestate *state[2];
    1.83      Uint8 *freeable, *encoded, *decoded;
    1.84 @@ -133,10 +133,10 @@
    1.85      freeable = *audio_buf;
    1.86      *audio_len = (encoded_len / MS_ADPCM_state.wavefmt.blockalign) *
    1.87          MS_ADPCM_state.wSamplesPerBlock *
    1.88 -        MS_ADPCM_state.wavefmt.channels * sizeof (Sint16);
    1.89 -    *audio_buf = (Uint8 *) SDL_malloc (*audio_len);
    1.90 +        MS_ADPCM_state.wavefmt.channels * sizeof(Sint16);
    1.91 +    *audio_buf = (Uint8 *) SDL_malloc(*audio_len);
    1.92      if (*audio_buf == NULL) {
    1.93 -        SDL_Error (SDL_ENOMEM);
    1.94 +        SDL_Error(SDL_ENOMEM);
    1.95          return (-1);
    1.96      }
    1.97      decoded = *audio_buf;
    1.98 @@ -152,22 +152,22 @@
    1.99              state[1]->hPredictor = *encoded++;
   1.100          }
   1.101          state[0]->iDelta = ((encoded[1] << 8) | encoded[0]);
   1.102 -        encoded += sizeof (Sint16);
   1.103 +        encoded += sizeof(Sint16);
   1.104          if (stereo) {
   1.105              state[1]->iDelta = ((encoded[1] << 8) | encoded[0]);
   1.106 -            encoded += sizeof (Sint16);
   1.107 +            encoded += sizeof(Sint16);
   1.108          }
   1.109          state[0]->iSamp1 = ((encoded[1] << 8) | encoded[0]);
   1.110 -        encoded += sizeof (Sint16);
   1.111 +        encoded += sizeof(Sint16);
   1.112          if (stereo) {
   1.113              state[1]->iSamp1 = ((encoded[1] << 8) | encoded[0]);
   1.114 -            encoded += sizeof (Sint16);
   1.115 +            encoded += sizeof(Sint16);
   1.116          }
   1.117          state[0]->iSamp2 = ((encoded[1] << 8) | encoded[0]);
   1.118 -        encoded += sizeof (Sint16);
   1.119 +        encoded += sizeof(Sint16);
   1.120          if (stereo) {
   1.121              state[1]->iSamp2 = ((encoded[1] << 8) | encoded[0]);
   1.122 -            encoded += sizeof (Sint16);
   1.123 +            encoded += sizeof(Sint16);
   1.124          }
   1.125          coeff[0] = MS_ADPCM_state.aCoeff[state[0]->hPredictor];
   1.126          coeff[1] = MS_ADPCM_state.aCoeff[state[1]->hPredictor];
   1.127 @@ -195,14 +195,14 @@
   1.128              MS_ADPCM_state.wavefmt.channels;
   1.129          while (samplesleft > 0) {
   1.130              nybble = (*encoded) >> 4;
   1.131 -            new_sample = MS_ADPCM_nibble (state[0], nybble, coeff[0]);
   1.132 +            new_sample = MS_ADPCM_nibble(state[0], nybble, coeff[0]);
   1.133              decoded[0] = new_sample & 0xFF;
   1.134              new_sample >>= 8;
   1.135              decoded[1] = new_sample & 0xFF;
   1.136              decoded += 2;
   1.137  
   1.138              nybble = (*encoded) & 0x0F;
   1.139 -            new_sample = MS_ADPCM_nibble (state[1], nybble, coeff[1]);
   1.140 +            new_sample = MS_ADPCM_nibble(state[1], nybble, coeff[1]);
   1.141              decoded[0] = new_sample & 0xFF;
   1.142              new_sample >>= 8;
   1.143              decoded[1] = new_sample & 0xFF;
   1.144 @@ -213,7 +213,7 @@
   1.145          }
   1.146          encoded_len -= MS_ADPCM_state.wavefmt.blockalign;
   1.147      }
   1.148 -    SDL_free (freeable);
   1.149 +    SDL_free(freeable);
   1.150      return (0);
   1.151  }
   1.152  
   1.153 @@ -231,30 +231,30 @@
   1.154  } IMA_ADPCM_state;
   1.155  
   1.156  static int
   1.157 -InitIMA_ADPCM (WaveFMT * format)
   1.158 +InitIMA_ADPCM(WaveFMT * format)
   1.159  {
   1.160      Uint8 *rogue_feel;
   1.161      Uint16 extra_info;
   1.162  
   1.163      /* Set the rogue pointer to the IMA_ADPCM specific data */
   1.164 -    IMA_ADPCM_state.wavefmt.encoding = SDL_SwapLE16 (format->encoding);
   1.165 -    IMA_ADPCM_state.wavefmt.channels = SDL_SwapLE16 (format->channels);
   1.166 -    IMA_ADPCM_state.wavefmt.frequency = SDL_SwapLE32 (format->frequency);
   1.167 -    IMA_ADPCM_state.wavefmt.byterate = SDL_SwapLE32 (format->byterate);
   1.168 -    IMA_ADPCM_state.wavefmt.blockalign = SDL_SwapLE16 (format->blockalign);
   1.169 +    IMA_ADPCM_state.wavefmt.encoding = SDL_SwapLE16(format->encoding);
   1.170 +    IMA_ADPCM_state.wavefmt.channels = SDL_SwapLE16(format->channels);
   1.171 +    IMA_ADPCM_state.wavefmt.frequency = SDL_SwapLE32(format->frequency);
   1.172 +    IMA_ADPCM_state.wavefmt.byterate = SDL_SwapLE32(format->byterate);
   1.173 +    IMA_ADPCM_state.wavefmt.blockalign = SDL_SwapLE16(format->blockalign);
   1.174      IMA_ADPCM_state.wavefmt.bitspersample =
   1.175 -        SDL_SwapLE16 (format->bitspersample);
   1.176 -    rogue_feel = (Uint8 *) format + sizeof (*format);
   1.177 -    if (sizeof (*format) == 16) {
   1.178 +        SDL_SwapLE16(format->bitspersample);
   1.179 +    rogue_feel = (Uint8 *) format + sizeof(*format);
   1.180 +    if (sizeof(*format) == 16) {
   1.181          extra_info = ((rogue_feel[1] << 8) | rogue_feel[0]);
   1.182 -        rogue_feel += sizeof (Uint16);
   1.183 +        rogue_feel += sizeof(Uint16);
   1.184      }
   1.185      IMA_ADPCM_state.wSamplesPerBlock = ((rogue_feel[1] << 8) | rogue_feel[0]);
   1.186      return (0);
   1.187  }
   1.188  
   1.189  static Sint32
   1.190 -IMA_ADPCM_nibble (struct IMA_ADPCM_decodestate *state, Uint8 nybble)
   1.191 +IMA_ADPCM_nibble(struct IMA_ADPCM_decodestate *state, Uint8 nybble)
   1.192  {
   1.193      const Sint32 max_audioval = ((1 << (16 - 1)) - 1);
   1.194      const Sint32 min_audioval = -(1 << (16 - 1));
   1.195 @@ -308,9 +308,9 @@
   1.196  
   1.197  /* Fill the decode buffer with a channel block of data (8 samples) */
   1.198  static void
   1.199 -Fill_IMA_ADPCM_block (Uint8 * decoded, Uint8 * encoded,
   1.200 -                      int channel, int numchannels,
   1.201 -                      struct IMA_ADPCM_decodestate *state)
   1.202 +Fill_IMA_ADPCM_block(Uint8 * decoded, Uint8 * encoded,
   1.203 +                     int channel, int numchannels,
   1.204 +                     struct IMA_ADPCM_decodestate *state)
   1.205  {
   1.206      int i;
   1.207      Sint8 nybble;
   1.208 @@ -319,14 +319,14 @@
   1.209      decoded += (channel * 2);
   1.210      for (i = 0; i < 4; ++i) {
   1.211          nybble = (*encoded) & 0x0F;
   1.212 -        new_sample = IMA_ADPCM_nibble (state, nybble);
   1.213 +        new_sample = IMA_ADPCM_nibble(state, nybble);
   1.214          decoded[0] = new_sample & 0xFF;
   1.215          new_sample >>= 8;
   1.216          decoded[1] = new_sample & 0xFF;
   1.217          decoded += 2 * numchannels;
   1.218  
   1.219          nybble = (*encoded) >> 4;
   1.220 -        new_sample = IMA_ADPCM_nibble (state, nybble);
   1.221 +        new_sample = IMA_ADPCM_nibble(state, nybble);
   1.222          decoded[0] = new_sample & 0xFF;
   1.223          new_sample >>= 8;
   1.224          decoded[1] = new_sample & 0xFF;
   1.225 @@ -337,7 +337,7 @@
   1.226  }
   1.227  
   1.228  static int
   1.229 -IMA_ADPCM_decode (Uint8 ** audio_buf, Uint32 * audio_len)
   1.230 +IMA_ADPCM_decode(Uint8 ** audio_buf, Uint32 * audio_len)
   1.231  {
   1.232      struct IMA_ADPCM_decodestate *state;
   1.233      Uint8 *freeable, *encoded, *decoded;
   1.234 @@ -346,9 +346,9 @@
   1.235  
   1.236      /* Check to make sure we have enough variables in the state array */
   1.237      channels = IMA_ADPCM_state.wavefmt.channels;
   1.238 -    if (channels > SDL_arraysize (IMA_ADPCM_state.state)) {
   1.239 -        SDL_SetError ("IMA ADPCM decoder can only handle %d channels",
   1.240 -                      SDL_arraysize (IMA_ADPCM_state.state));
   1.241 +    if (channels > SDL_arraysize(IMA_ADPCM_state.state)) {
   1.242 +        SDL_SetError("IMA ADPCM decoder can only handle %d channels",
   1.243 +                     SDL_arraysize(IMA_ADPCM_state.state));
   1.244          return (-1);
   1.245      }
   1.246      state = IMA_ADPCM_state.state;
   1.247 @@ -359,10 +359,10 @@
   1.248      freeable = *audio_buf;
   1.249      *audio_len = (encoded_len / IMA_ADPCM_state.wavefmt.blockalign) *
   1.250          IMA_ADPCM_state.wSamplesPerBlock *
   1.251 -        IMA_ADPCM_state.wavefmt.channels * sizeof (Sint16);
   1.252 -    *audio_buf = (Uint8 *) SDL_malloc (*audio_len);
   1.253 +        IMA_ADPCM_state.wavefmt.channels * sizeof(Sint16);
   1.254 +    *audio_buf = (Uint8 *) SDL_malloc(*audio_len);
   1.255      if (*audio_buf == NULL) {
   1.256 -        SDL_Error (SDL_ENOMEM);
   1.257 +        SDL_Error(SDL_ENOMEM);
   1.258          return (-1);
   1.259      }
   1.260      decoded = *audio_buf;
   1.261 @@ -393,8 +393,8 @@
   1.262          samplesleft = (IMA_ADPCM_state.wSamplesPerBlock - 1) * channels;
   1.263          while (samplesleft > 0) {
   1.264              for (c = 0; c < channels; ++c) {
   1.265 -                Fill_IMA_ADPCM_block (decoded, encoded,
   1.266 -                                      c, channels, &state[c]);
   1.267 +                Fill_IMA_ADPCM_block(decoded, encoded,
   1.268 +                                     c, channels, &state[c]);
   1.269                  encoded += 4;
   1.270                  samplesleft -= 8;
   1.271              }
   1.272 @@ -402,13 +402,13 @@
   1.273          }
   1.274          encoded_len -= IMA_ADPCM_state.wavefmt.blockalign;
   1.275      }
   1.276 -    SDL_free (freeable);
   1.277 +    SDL_free(freeable);
   1.278      return (0);
   1.279  }
   1.280  
   1.281  SDL_AudioSpec *
   1.282 -SDL_LoadWAV_RW (SDL_RWops * src, int freesrc,
   1.283 -                SDL_AudioSpec * spec, Uint8 ** audio_buf, Uint32 * audio_len)
   1.284 +SDL_LoadWAV_RW(SDL_RWops * src, int freesrc,
   1.285 +               SDL_AudioSpec * spec, Uint8 ** audio_buf, Uint32 * audio_len)
   1.286  {
   1.287      int was_error;
   1.288      Chunk chunk;
   1.289 @@ -433,53 +433,53 @@
   1.290      }
   1.291  
   1.292      /* Check the magic header */
   1.293 -    RIFFchunk = SDL_ReadLE32 (src);
   1.294 -    wavelen = SDL_ReadLE32 (src);
   1.295 +    RIFFchunk = SDL_ReadLE32(src);
   1.296 +    wavelen = SDL_ReadLE32(src);
   1.297      if (wavelen == WAVE) {      /* The RIFFchunk has already been read */
   1.298          WAVEmagic = wavelen;
   1.299          wavelen = RIFFchunk;
   1.300          RIFFchunk = RIFF;
   1.301      } else {
   1.302 -        WAVEmagic = SDL_ReadLE32 (src);
   1.303 +        WAVEmagic = SDL_ReadLE32(src);
   1.304      }
   1.305      if ((RIFFchunk != RIFF) || (WAVEmagic != WAVE)) {
   1.306 -        SDL_SetError ("Unrecognized file type (not WAVE)");
   1.307 +        SDL_SetError("Unrecognized file type (not WAVE)");
   1.308          was_error = 1;
   1.309          goto done;
   1.310      }
   1.311 -    headerDiff += sizeof (Uint32);      /* for WAVE */
   1.312 +    headerDiff += sizeof(Uint32);       /* for WAVE */
   1.313  
   1.314      /* Read the audio data format chunk */
   1.315      chunk.data = NULL;
   1.316      do {
   1.317          if (chunk.data != NULL) {
   1.318 -            SDL_free (chunk.data);
   1.319 +            SDL_free(chunk.data);
   1.320          }
   1.321 -        lenread = ReadChunk (src, &chunk);
   1.322 +        lenread = ReadChunk(src, &chunk);
   1.323          if (lenread < 0) {
   1.324              was_error = 1;
   1.325              goto done;
   1.326          }
   1.327          /* 2 Uint32's for chunk header+len, plus the lenread */
   1.328 -        headerDiff += lenread + 2 * sizeof (Uint32);
   1.329 +        headerDiff += lenread + 2 * sizeof(Uint32);
   1.330      }
   1.331      while ((chunk.magic == FACT) || (chunk.magic == LIST));
   1.332  
   1.333      /* Decode the audio data format */
   1.334      format = (WaveFMT *) chunk.data;
   1.335      if (chunk.magic != FMT) {
   1.336 -        SDL_SetError ("Complex WAVE files not supported");
   1.337 +        SDL_SetError("Complex WAVE files not supported");
   1.338          was_error = 1;
   1.339          goto done;
   1.340      }
   1.341      MS_ADPCM_encoded = IMA_ADPCM_encoded = 0;
   1.342 -    switch (SDL_SwapLE16 (format->encoding)) {
   1.343 +    switch (SDL_SwapLE16(format->encoding)) {
   1.344      case PCM_CODE:
   1.345          /* We can understand this */
   1.346          break;
   1.347      case MS_ADPCM_CODE:
   1.348          /* Try to understand this */
   1.349 -        if (InitMS_ADPCM (format) < 0) {
   1.350 +        if (InitMS_ADPCM(format) < 0) {
   1.351              was_error = 1;
   1.352              goto done;
   1.353          }
   1.354 @@ -487,26 +487,26 @@
   1.355          break;
   1.356      case IMA_ADPCM_CODE:
   1.357          /* Try to understand this */
   1.358 -        if (InitIMA_ADPCM (format) < 0) {
   1.359 +        if (InitIMA_ADPCM(format) < 0) {
   1.360              was_error = 1;
   1.361              goto done;
   1.362          }
   1.363          IMA_ADPCM_encoded = 1;
   1.364          break;
   1.365      case MP3_CODE:
   1.366 -        SDL_SetError ("MPEG Layer 3 data not supported",
   1.367 -                      SDL_SwapLE16 (format->encoding));
   1.368 +        SDL_SetError("MPEG Layer 3 data not supported",
   1.369 +                     SDL_SwapLE16(format->encoding));
   1.370          was_error = 1;
   1.371          goto done;
   1.372      default:
   1.373 -        SDL_SetError ("Unknown WAVE data format: 0x%.4x",
   1.374 -                      SDL_SwapLE16 (format->encoding));
   1.375 +        SDL_SetError("Unknown WAVE data format: 0x%.4x",
   1.376 +                     SDL_SwapLE16(format->encoding));
   1.377          was_error = 1;
   1.378          goto done;
   1.379      }
   1.380 -    SDL_memset (spec, 0, (sizeof *spec));
   1.381 -    spec->freq = SDL_SwapLE32 (format->frequency);
   1.382 -    switch (SDL_SwapLE16 (format->bitspersample)) {
   1.383 +    SDL_memset(spec, 0, (sizeof *spec));
   1.384 +    spec->freq = SDL_SwapLE32(format->frequency);
   1.385 +    switch (SDL_SwapLE16(format->bitspersample)) {
   1.386      case 4:
   1.387          if (MS_ADPCM_encoded || IMA_ADPCM_encoded) {
   1.388              spec->format = AUDIO_S16;
   1.389 @@ -525,20 +525,20 @@
   1.390          break;
   1.391      }
   1.392      if (was_error) {
   1.393 -        SDL_SetError ("Unknown %d-bit PCM data format",
   1.394 -                      SDL_SwapLE16 (format->bitspersample));
   1.395 +        SDL_SetError("Unknown %d-bit PCM data format",
   1.396 +                     SDL_SwapLE16(format->bitspersample));
   1.397          goto done;
   1.398      }
   1.399 -    spec->channels = (Uint8) SDL_SwapLE16 (format->channels);
   1.400 +    spec->channels = (Uint8) SDL_SwapLE16(format->channels);
   1.401      spec->samples = 4096;       /* Good default buffer size */
   1.402  
   1.403      /* Read the audio data chunk */
   1.404      *audio_buf = NULL;
   1.405      do {
   1.406          if (*audio_buf != NULL) {
   1.407 -            SDL_free (*audio_buf);
   1.408 +            SDL_free(*audio_buf);
   1.409          }
   1.410 -        lenread = ReadChunk (src, &chunk);
   1.411 +        lenread = ReadChunk(src, &chunk);
   1.412          if (lenread < 0) {
   1.413              was_error = 1;
   1.414              goto done;
   1.415 @@ -546,19 +546,19 @@
   1.416          *audio_len = lenread;
   1.417          *audio_buf = chunk.data;
   1.418          if (chunk.magic != DATA)
   1.419 -            headerDiff += lenread + 2 * sizeof (Uint32);
   1.420 +            headerDiff += lenread + 2 * sizeof(Uint32);
   1.421      }
   1.422      while (chunk.magic != DATA);
   1.423 -    headerDiff += 2 * sizeof (Uint32);  /* for the data chunk and len */
   1.424 +    headerDiff += 2 * sizeof(Uint32);   /* for the data chunk and len */
   1.425  
   1.426      if (MS_ADPCM_encoded) {
   1.427 -        if (MS_ADPCM_decode (audio_buf, audio_len) < 0) {
   1.428 +        if (MS_ADPCM_decode(audio_buf, audio_len) < 0) {
   1.429              was_error = 1;
   1.430              goto done;
   1.431          }
   1.432      }
   1.433      if (IMA_ADPCM_encoded) {
   1.434 -        if (IMA_ADPCM_decode (audio_buf, audio_len) < 0) {
   1.435 +        if (IMA_ADPCM_decode(audio_buf, audio_len) < 0) {
   1.436              was_error = 1;
   1.437              goto done;
   1.438          }
   1.439 @@ -570,15 +570,14 @@
   1.440  
   1.441    done:
   1.442      if (format != NULL) {
   1.443 -        SDL_free (format);
   1.444 +        SDL_free(format);
   1.445      }
   1.446      if (src) {
   1.447          if (freesrc) {
   1.448 -            SDL_RWclose (src);
   1.449 +            SDL_RWclose(src);
   1.450          } else {
   1.451              /* seek to the end of the file (given by the RIFF chunk) */
   1.452 -            SDL_RWseek (src, wavelen - chunk.length - headerDiff,
   1.453 -                        RW_SEEK_CUR);
   1.454 +            SDL_RWseek(src, wavelen - chunk.length - headerDiff, RW_SEEK_CUR);
   1.455          }
   1.456      }
   1.457      if (was_error) {
   1.458 @@ -591,26 +590,26 @@
   1.459     be freed here.  (Necessary under Win32, VC++)
   1.460   */
   1.461  void
   1.462 -SDL_FreeWAV (Uint8 * audio_buf)
   1.463 +SDL_FreeWAV(Uint8 * audio_buf)
   1.464  {
   1.465      if (audio_buf != NULL) {
   1.466 -        SDL_free (audio_buf);
   1.467 +        SDL_free(audio_buf);
   1.468      }
   1.469  }
   1.470  
   1.471  static int
   1.472 -ReadChunk (SDL_RWops * src, Chunk * chunk)
   1.473 +ReadChunk(SDL_RWops * src, Chunk * chunk)
   1.474  {
   1.475 -    chunk->magic = SDL_ReadLE32 (src);
   1.476 -    chunk->length = SDL_ReadLE32 (src);
   1.477 -    chunk->data = (Uint8 *) SDL_malloc (chunk->length);
   1.478 +    chunk->magic = SDL_ReadLE32(src);
   1.479 +    chunk->length = SDL_ReadLE32(src);
   1.480 +    chunk->data = (Uint8 *) SDL_malloc(chunk->length);
   1.481      if (chunk->data == NULL) {
   1.482 -        SDL_Error (SDL_ENOMEM);
   1.483 +        SDL_Error(SDL_ENOMEM);
   1.484          return (-1);
   1.485      }
   1.486 -    if (SDL_RWread (src, chunk->data, chunk->length, 1) != 1) {
   1.487 -        SDL_Error (SDL_EFREAD);
   1.488 -        SDL_free (chunk->data);
   1.489 +    if (SDL_RWread(src, chunk->data, chunk->length, 1) != 1) {
   1.490 +        SDL_Error(SDL_EFREAD);
   1.491 +        SDL_free(chunk->data);
   1.492          return (-1);
   1.493      }
   1.494      return (chunk->length);