Patched to build on pre-C99 compilers. SDL-ryan-multiple-audio-device
authorRyan C. Gordon <icculus@icculus.org>
Sun, 08 Oct 2006 00:05:22 +0000
branchSDL-ryan-multiple-audio-device
changeset 3835 84aa539627c8
parent 3834 93326d2ceedb
child 3836 7dc7327cd626
Patched to build on pre-C99 compilers.
src/audio/SDL_audiocvt.c
--- a/src/audio/SDL_audiocvt.c	Sun Oct 08 00:01:16 2006 +0000
+++ b/src/audio/SDL_audiocvt.c	Sun Oct 08 00:05:22 2006 +0000
@@ -159,21 +159,19 @@
             float *dst = (float *) cvt->buf;
             if (SDL_AUDIO_ISBIGENDIAN(format)) {
                 for (i = cvt->len_cvt / 8; i; --i, src += 2) {
-                    float src1, src2;
-                    src1 = SDL_SwapFloatBE(src[0]);
-                    src2 = SDL_SwapFloatBE(src[1]);
+                    const float src1 = SDL_SwapFloatBE(src[0]);
+                    const float src2 = SDL_SwapFloatBE(src[1]);
                     const double added = ((double) src1) + ((double) src2);
-                    src1 = (float) (added * 0.5);
-                    *(dst++) = SDL_SwapFloatBE(src1);
+                    const float halved = (float) (added * 0.5);
+                    *(dst++) = SDL_SwapFloatBE(halved);
                 }
             } else {
                 for (i = cvt->len_cvt / 8; i; --i, src += 2) {
-                    float src1, src2;
-                    src1 = SDL_SwapFloatLE(src[0]);
-                    src2 = SDL_SwapFloatLE(src[1]);
+                    const float src1 = SDL_SwapFloatLE(src[0]);
+                    const float src2 = SDL_SwapFloatLE(src[1]);
                     const double added = ((double) src1) + ((double) src2);
-                    src1 = (float) (added * 0.5);
-                    *(dst++) = SDL_SwapFloatLE(src1);
+                    const float halved = (float) (added * 0.5);
+                    *(dst++) = SDL_SwapFloatLE(halved);
                 }
             }
         }