Support compiler without variable length support

This commit is contained in:
David Henningsson 2010-07-15 18:50:38 +00:00
parent ad35993faf
commit 557fe5d45e
2 changed files with 13 additions and 3 deletions

View file

@ -334,7 +334,8 @@ static FLUID_INLINE void
fluid_render_loop_singlethread(fluid_rvoice_mixer_t* mixer)
{
int i;
fluid_real_t* bufs[mixer->buffers.buf_count * 2 + mixer->buffers.fx_buf_count * 2];
FLUID_DECLARE_VLA(fluid_real_t*, bufs,
mixer->buffers.buf_count * 2 + mixer->buffers.fx_buf_count * 2);
int bufcount = fluid_mixer_buffers_prepare(&mixer->buffers, bufs);
fluid_profile_ref_var(prof_ref);
for (i=0; i < mixer->active_voices; i++) {
@ -627,7 +628,7 @@ fluid_mixer_thread_func (void* data)
fluid_mixer_buffers_t* buffers = data;
fluid_rvoice_mixer_t* mixer = buffers->mixer;
int hasValidData = 0;
fluid_real_t* bufs[buffers->buf_count*2 + buffers->fx_buf_count*2];
FLUID_DECLARE_VLA(fluid_real_t*, bufs, buffers->buf_count*2 + buffers->fx_buf_count*2);
int bufcount = 0;
while (!fluid_atomic_int_get(&mixer->threads_should_terminate)) {
@ -721,7 +722,8 @@ fluid_render_loop_multithread(fluid_rvoice_mixer_t* mixer)
{
int i; //, test=0, waits=0;
//int scount = mixer->current_blockcount * FLUID_BUFSIZE;
fluid_real_t* bufs[mixer->buffers.buf_count * 2 + mixer->buffers.fx_buf_count * 2];
FLUID_DECLARE_VLA(fluid_real_t*, bufs,
mixer->buffers.buf_count * 2 + mixer->buffers.fx_buf_count * 2);
int bufcount = fluid_mixer_buffers_prepare(&mixer->buffers, bufs);
// Prepare voice list

View file

@ -163,6 +163,14 @@ typedef int fluid_socket_t;
#define INVALID_SOCKET -1
#endif
#if SUPPORTS_VLA
# define FLUID_DECLARE_VLA(_type, _name, _len) \
_type _name[_len]
#else
# define FLUID_DECLARE_VLA(_type, _name, _len) \
_type* _name = alloca(sizeof(_type) * (_len))
#endif
/** Integer types */
typedef gint8 sint8;