* modules/audio_filter/converter/s16tofloat32swab.c:
authorGildas Bazin <gbazin@videolan.org>
Tue, 22 Apr 2003 22:25:09 +0000 (22:25 +0000)
committerGildas Bazin <gbazin@videolan.org>
Tue, 22 Apr 2003 22:25:09 +0000 (22:25 +0000)
   added an #ifdef HAVE_ALLOCA.

modules/audio_filter/converter/s16tofloat32swab.c

index 615e389..8d132d4 100644 (file)
@@ -3,7 +3,7 @@
  *                      with endianness change
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: s16tofloat32swab.c,v 1.8 2002/11/20 16:43:32 sam Exp $
+ * $Id: s16tofloat32swab.c,v 1.9 2003/04/22 22:25:09 gbazin Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *          Henri Fallon <henri@videolan.org>
@@ -101,9 +101,15 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
     float * p_out = (float *)p_out_buf->p_buffer + i - 1;
 
 #ifdef HAVE_SWAB
+#   ifdef HAVE_ALLOCA
     s16 * p_swabbed = alloca( i * sizeof(s16) );
+#   else
+    s16 * p_swabbed = malloc( i * sizeof(s16) );
+#   endif
+
     swab( p_in_buf->p_buffer, (void *)p_swabbed, i * sizeof(s16) );
     p_in = p_swabbed + i - 1;
+
 #else
     byte_t p_tmp[2];
     p_in = (s16 *)p_in_buf->p_buffer + i - 1;
@@ -121,6 +127,12 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
         p_in--; p_out--;
     }
 
+#ifdef HAVE_SWAB
+#   ifndef HAVE_ALLOCA
+    free( p_swabbed );
+#   endif
+#endif
+
     p_out_buf->i_nb_samples = p_in_buf->i_nb_samples;
     p_out_buf->i_nb_bytes = p_in_buf->i_nb_bytes * 2;
 }