AUDIO: Fix Compilation with Fluidsynth v1.1.6 or earlier.

The function signature for these functions was changed from (char *) to
(const char *) in the v1.1.7 release, so compiling against
Fluidsynth v1.1.6 or earlier requires the copying of the strings to
prevent compilation errors such as "error: invalid conversion from
'const char*' to 'char*'".

Normally, we would break compatibility with older versions as platforms
should be using the latest Fluidsynth v1.X release of v1.1.11.

However, since this is trivial to fix and prevents breakage for legacy
platforms, am restoring the string duplication with scumm_strdup().

Apart from this, we should look at the Fluidsynth v2.X releases
currently in RC testing as the API is now changed for this.
This commit is contained in:
D G Turner 2018-08-20 22:31:15 +01:00
parent 0e8f1261c5
commit 93ed8a2c47

View File

@ -88,15 +88,26 @@ MidiDriver_FluidSynth::MidiDriver_FluidSynth(Audio::Mixer *mixer)
}
void MidiDriver_FluidSynth::setInt(const char *name, int val) {
fluid_settings_setint(_settings, name, val);
char *name2 = scumm_strdup(name);
fluid_settings_setint(_settings, name2, val);
free(name2);
}
void MidiDriver_FluidSynth::setNum(const char *name, double val) {
fluid_settings_setnum(_settings, name, val);
char *name2 = scumm_strdup(name);
fluid_settings_setnum(_settings, name2, val);
free(name2);
}
void MidiDriver_FluidSynth::setStr(const char *name, const char *val) {
fluid_settings_setstr(_settings, name, val);
char *name2 = scumm_strdup(name);
char *val2 = scumm_strdup(val);
fluid_settings_setstr(_settings, name2, val2);
free(name2);
free(val2);
}
int MidiDriver_FluidSynth::open() {