aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2011-10-24 20:29:28 +0200
committerJohannes Schickel2011-10-24 20:43:10 +0200
commitc087f917dda52ea72e200990e41b843767f0091d (patch)
tree7bb5483c6ee827652a02868e27d63f775d2e90f7
parent97207dcbe36df803fe8f3f497f32ba1c0f69a086 (diff)
downloadscummvm-rg350-c087f917dda52ea72e200990e41b843767f0091d.tar.gz
scummvm-rg350-c087f917dda52ea72e200990e41b843767f0091d.tar.bz2
scummvm-rg350-c087f917dda52ea72e200990e41b843767f0091d.zip
GUI: Fix missing audio drivers in Edit Game dialog.
This is a regression from 77c65648b1db8f8b7b245510681eafd856798d26. Formerly the code used strtok to check for any audio related GUIO flag to be present in _guioptions. Since strtok tokenizes the string this won't really work. I changed it to use strpbrk, which searches a string for any character from a set of characters (in our case flags). The code should now have the same semantics as of before the above mentioned commit. This also gets rid of copying the gui options into a char array and a strncpy call.
-rw-r--r--gui/options.cpp14
1 files changed, 4 insertions, 10 deletions
diff --git a/gui/options.cpp b/gui/options.cpp
index 8b4d9d183e..e93092f954 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -616,11 +616,8 @@ void OptionsDialog::setAudioSettingsState(bool enabled) {
_midiPopUpDesc->setEnabled(enabled);
_midiPopUp->setEnabled(enabled);
- Common::String allFlags = MidiDriver::musicType2GUIO((uint32)-1);
- char opt[256];
-
- strncpy(opt, _guioptions.c_str(), 256);
- bool hasMidiDefined = (strtok(opt, allFlags.c_str()) != NULL);
+ const Common::String allFlags = MidiDriver::musicType2GUIO((uint32)-1);
+ bool hasMidiDefined = (strpbrk(_guioptions.c_str(), allFlags.c_str()) != NULL);
if (_domain != Common::ConfigManager::kApplicationDomain && // global dialog
hasMidiDefined && // No flags are specified
@@ -766,11 +763,8 @@ void OptionsDialog::addAudioControls(GuiObject *boss, const Common::String &pref
_midiPopUp = new PopUpWidget(boss, prefix + "auMidiPopup", _("Specifies output sound device or sound card emulator"));
// Populate it
- Common::String allFlags = MidiDriver::musicType2GUIO((uint32)-1);
- char opt[256];
-
- strncpy(opt, _guioptions.c_str(), 256);
- bool hasMidiDefined = (strtok(opt, allFlags.c_str()) != NULL);
+ const Common::String allFlags = MidiDriver::musicType2GUIO((uint32)-1);
+ bool hasMidiDefined = (strpbrk(_guioptions.c_str(), allFlags.c_str()) != NULL);
const MusicPlugin::List p = MusicMan.getPlugins();
for (MusicPlugin::List::const_iterator m = p.begin(); m != p.end(); ++m) {