RemoteVstPlugin: fix build failure due to out-of-bounds-array-access-warning

Newer versions of GCC seem to assume an array size of 0 for arrays whose
size is not specified explicitely. This causes a warning about an
out-of-bounds array access.
This commit is contained in:
Tobias Doerffel
2014-01-26 10:04:03 +01:00
parent 80a58df124
commit 5d1335f390
2 changed files with 6 additions and 7 deletions

View File

@@ -175,7 +175,7 @@ public:
// 04
void *reserved;
// 08
VstEvent * events[];
VstEvent* events[1];
} ;

View File

@@ -773,16 +773,15 @@ void RemoteVstPlugin::process( const sampleFrame * _in, sampleFrame * _out )
// dispatcher-call, so we create static copies of the
// data and post them
#define MIDI_EVENT_BUFFER_COUNT 1024
static char event_buf[sizeof( VstMidiEvent * ) *
MIDI_EVENT_BUFFER_COUNT +
sizeof( VstEvents )];
static char eventsBuffer[sizeof( VstEvents ) + sizeof( VstMidiEvent * ) * MIDI_EVENT_BUFFER_COUNT];
static VstMidiEvent vme[MIDI_EVENT_BUFFER_COUNT];
VstEvents * events = (VstEvents *) event_buf;
VstEvents* events = (VstEvents *) eventsBuffer;
events->reserved = 0;
events->numEvents = m_midiEvents.size();
int idx = 0;
for( VstMidiEventList::iterator it = m_midiEvents.begin();
it != m_midiEvents.end(); ++it, ++idx )
for( VstMidiEventList::iterator it = m_midiEvents.begin(); it != m_midiEvents.end(); ++it, ++idx )
{
memcpy( &vme[idx], &*it, sizeof( VstMidiEvent ) );
events->events[idx] = (VstEvent *) &vme[idx];