From 30c366ee5db4c27e9d0ef94fd5786af55b1b0147 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Thu, 3 Oct 2019 06:03:46 +0100 Subject: [PATCH] GUI: Add Missing Switch Default Cases These are flagged by GCC if -Wswitch-default is enabled. --- gui/ThemeEngine.cpp | 7 +++++++ gui/console.cpp | 12 ++++++++---- gui/debugger.cpp | 2 ++ gui/dialog.cpp | 2 ++ gui/launcher.cpp | 2 ++ gui/onscreendialog.cpp | 2 ++ gui/options.cpp | 2 ++ gui/predictivedialog.cpp | 2 ++ gui/saveload-dialog.cpp | 3 +++ gui/saveload.cpp | 2 ++ gui/unknown-game-dialog.cpp | 2 ++ gui/widget.cpp | 2 ++ gui/widgets/list.cpp | 2 ++ gui/widgets/scrollcontainer.cpp | 2 ++ gui/widgets/tab.cpp | 3 +++ 15 files changed, 43 insertions(+), 4 deletions(-) diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp index dd074ccef3d..666b9b3d8a4 100644 --- a/gui/ThemeEngine.cpp +++ b/gui/ThemeEngine.cpp @@ -1082,6 +1082,9 @@ void ThemeEngine::drawDialogBackground(const Common::Rect &r, DialogBackground b case kDialogBackgroundDefault: drawDD(kDDDefaultBackground, r); break; + + default: + // fallthrough intended case kDialogBackgroundNone: // no op break; @@ -1209,6 +1212,8 @@ void ThemeEngine::drawText(const Common::Rect &r, const Common::String &str, Wid colorId = kTextColorNormalHover; break; + default: + // fallthrough intended case kStateEnabled: case kStatePressed: colorId = kTextColorNormal; @@ -1230,6 +1235,8 @@ void ThemeEngine::drawText(const Common::Rect &r, const Common::String &str, Wid colorId = kTextColorAlternativeHover; break; + default: + // fallthrough intended case kStateEnabled: case kStatePressed: colorId = kTextColorAlternative; diff --git a/gui/console.cpp b/gui/console.cpp index a47f5b9afd7..41b7a73379e 100644 --- a/gui/console.cpp +++ b/gui/console.cpp @@ -489,12 +489,16 @@ void ConsoleDialog::insertIntoPrompt(const char* str) { void ConsoleDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) { switch (cmd) { case kSetPositionCmd: - int newPos = (int)data + _linesPerPage - 1 + _firstLineInBuffer; - if (newPos != _scrollLine) { - _scrollLine = newPos; - g_gui.scheduleTopDialogRedraw(); + { + int newPos = (int)data + _linesPerPage - 1 + _firstLineInBuffer; + if (newPos != _scrollLine) { + _scrollLine = newPos; + g_gui.scheduleTopDialogRedraw(); + } } break; + default: + break; } } diff --git a/gui/debugger.cpp b/gui/debugger.cpp index 2e8ae1ca013..ea8a699ac00 100644 --- a/gui/debugger.cpp +++ b/gui/debugger.cpp @@ -403,6 +403,8 @@ void Debugger::splitCommand(Common::String &input, int &argc, const char **argv) c = (byte)*p; switch (state) { + default: + // fallthrough intended case DULL: // not in a word, not in a double quoted string if (isspace(c)) diff --git a/gui/dialog.cpp b/gui/dialog.cpp index 781de330e27..99441e08413 100644 --- a/gui/dialog.cpp +++ b/gui/dialog.cpp @@ -353,6 +353,8 @@ void Dialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) { case kCloseCmd: close(); break; + default: + break; } } diff --git a/gui/launcher.cpp b/gui/launcher.cpp index b09f650fc95..ac414e0fa1e 100644 --- a/gui/launcher.cpp +++ b/gui/launcher.cpp @@ -454,6 +454,8 @@ void LauncherDialog::recordGame(int item) { MessageDialog alert(_("Do you want to load saved game?"), _("Yes"), _("No")); switch(recorderDialog.runModal(_domains[item])) { + default: + // fallthrough intended case RecorderDialog::kRecordDialogClose: break; case RecorderDialog::kRecordDialogPlayback: diff --git a/gui/onscreendialog.cpp b/gui/onscreendialog.cpp index 8b338f56df4..7d348d720d3 100644 --- a/gui/onscreendialog.cpp +++ b/gui/onscreendialog.cpp @@ -153,6 +153,8 @@ void OnScreenDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat case kFastModeCmd: g_eventRec.switchFastMode(); break; + default: + break; } } diff --git a/gui/options.cpp b/gui/options.cpp index 8548cc99a4d..772f94686b7 100644 --- a/gui/options.cpp +++ b/gui/options.cpp @@ -2350,6 +2350,8 @@ void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3 case Cloud::kStorageBoxId: url += "box"; break; + default: + break; } if (!g_system->openUrl(url)) { diff --git a/gui/predictivedialog.cpp b/gui/predictivedialog.cpp index b01e4950d5c..b15bd5c97ab 100644 --- a/gui/predictivedialog.cpp +++ b/gui/predictivedialog.cpp @@ -532,6 +532,8 @@ void PredictiveDialog::processButton(ButtonId button) { _temp[x] = buttons[_currentCode[x] - '1'][_repeatcount[x]]; _temp[_currentCode.size()] = 0; _currentWord = _temp; + default: + break; } } else if (button == kNextAct) { // next if (_mode == kModePre) { diff --git a/gui/saveload-dialog.cpp b/gui/saveload-dialog.cpp index d0132d91ef7..61fd392976f 100644 --- a/gui/saveload-dialog.cpp +++ b/gui/saveload-dialog.cpp @@ -84,6 +84,9 @@ void SaveLoadCloudSyncProgressDialog::handleCommand(CommandSender *sender, uint3 case kBackgroundSyncCmd: _close = true; break; + + default: + break; } Dialog::handleCommand(sender, cmd, data); diff --git a/gui/saveload.cpp b/gui/saveload.cpp index a893f3c0db6..6de8be97d82 100644 --- a/gui/saveload.cpp +++ b/gui/saveload.cpp @@ -51,6 +51,8 @@ void SaveLoadChooser::selectChooser(const MetaEngine &engine) { _impl = new SaveLoadChooserGrid(_title, _saveMode); break; + default: + // fallthrough intended case kSaveLoadDialogList: #endif // !DISABLE_SAVELOADCHOOSER_GRID _impl = new SaveLoadChooserSimple(_title, _buttonLabel, _saveMode); diff --git a/gui/unknown-game-dialog.cpp b/gui/unknown-game-dialog.cpp index 0aa8cc57504..790f7249489 100644 --- a/gui/unknown-game-dialog.cpp +++ b/gui/unknown-game-dialog.cpp @@ -232,6 +232,8 @@ void UnknownGameDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 for (uint i = 0; i < _textWidgets.size() ; i++) _textWidgets[i]->setVisible(true); break; + default: + break; } } diff --git a/gui/widget.cpp b/gui/widget.cpp index f870eb52dcf..3e372828e15 100644 --- a/gui/widget.cpp +++ b/gui/widget.cpp @@ -237,6 +237,8 @@ uint8 Widget::parseHotkey(const Common::String &label) { else state = 0; break; + default: + break; } } diff --git a/gui/widgets/list.cpp b/gui/widgets/list.cpp index cc5ea917454..3ef365ba5cf 100644 --- a/gui/widgets/list.cpp +++ b/gui/widgets/list.cpp @@ -516,6 +516,8 @@ void ListWidget::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) { ((GUI::Dialog *)_boss)->setFocusWidget(this); } break; + default: + break; } } diff --git a/gui/widgets/scrollcontainer.cpp b/gui/widgets/scrollcontainer.cpp index 389eed05c3e..c136c57a813 100644 --- a/gui/widgets/scrollcontainer.cpp +++ b/gui/widgets/scrollcontainer.cpp @@ -111,6 +111,8 @@ void ScrollContainerWidget::handleCommand(CommandSender *sender, uint32 cmd, uin reflowLayout(); g_gui.scheduleTopDialogRedraw(); break; + default: + break; } } diff --git a/gui/widgets/tab.cpp b/gui/widgets/tab.cpp index 8c136ba4672..0305b57061a 100644 --- a/gui/widgets/tab.cpp +++ b/gui/widgets/tab.cpp @@ -195,6 +195,9 @@ void TabWidget::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) { setFirstVisible(_firstVisibleTab + 1, false); } break; + + default: + break; } }