diff options
author | D G Turner | 2018-08-20 22:31:15 +0100 |
---|---|---|
committer | D G Turner | 2018-08-20 22:31:15 +0100 |
commit | 93ed8a2c47055f4b737d79925bf0bca30adda24f (patch) | |
tree | c46680c6adb2cf7fd57b5ac08de4a17aa21a3352 /audio | |
parent | 0e8f1261c526f898fe698fd869baa514a42ec3a8 (diff) | |
download | scummvm-rg350-93ed8a2c47055f4b737d79925bf0bca30adda24f.tar.gz scummvm-rg350-93ed8a2c47055f4b737d79925bf0bca30adda24f.tar.bz2 scummvm-rg350-93ed8a2c47055f4b737d79925bf0bca30adda24f.zip |
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.
Diffstat (limited to 'audio')
-rw-r--r-- | audio/softsynth/fluidsynth.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/audio/softsynth/fluidsynth.cpp b/audio/softsynth/fluidsynth.cpp index 1e78a7b5e3..5c14f33a60 100644 --- a/audio/softsynth/fluidsynth.cpp +++ b/audio/softsynth/fluidsynth.cpp @@ -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() { |