* modules/audio_filter/converter/s16tofloat32swab.c:

added an #ifdef HAVE_ALLOCA.
This commit is contained in:
Gildas Bazin 2003-04-22 22:25:09 +00:00
parent 58d2e71814
commit 171966e294
1 changed files with 13 additions and 1 deletions

View 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;
}