diff options
author | Daniel Pfeifer <daniel@pfeifer-mail.de> | 2016-08-18 17:39:54 (GMT) |
---|---|---|
committer | Daniel Pfeifer <daniel@pfeifer-mail.de> | 2016-08-18 17:39:54 (GMT) |
commit | 4988b914e1fb7ca215436738ab08ed199a6f63d2 (patch) | |
tree | c6c2ea4dbf1fca8dc6e0e18ebd84bf0f63f88fe8 /Source | |
parent | 11e0ceaeab905075d93e279b87470b99c6401929 (diff) | |
download | CMake-4988b914e1fb7ca215436738ab08ed199a6f63d2.zip CMake-4988b914e1fb7ca215436738ab08ed199a6f63d2.tar.gz CMake-4988b914e1fb7ca215436738ab08ed199a6f63d2.tar.bz2 |
CursesDialog: don't use else after return
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CursesDialog/cmCursesBoolWidget.cxx | 3 | ||||
-rw-r--r-- | Source/CursesDialog/cmCursesCacheEntryComposite.cxx | 3 | ||||
-rw-r--r-- | Source/CursesDialog/cmCursesOptionsWidget.cxx | 45 | ||||
-rw-r--r-- | Source/CursesDialog/cmCursesStringWidget.cxx | 8 |
4 files changed, 27 insertions, 32 deletions
diff --git a/Source/CursesDialog/cmCursesBoolWidget.cxx b/Source/CursesDialog/cmCursesBoolWidget.cxx index 068bcdc..99f7dcc 100644 --- a/Source/CursesDialog/cmCursesBoolWidget.cxx +++ b/Source/CursesDialog/cmCursesBoolWidget.cxx @@ -40,9 +40,8 @@ bool cmCursesBoolWidget::HandleInput(int& key, cmCursesMainForm* /*fm*/, touchwin(w); wrefresh(w); return true; - } else { - return false; } + return false; } void cmCursesBoolWidget::SetValueAsBool(bool value) diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx index ea12756..462cb6e 100644 --- a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx +++ b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx @@ -110,7 +110,6 @@ const char* cmCursesCacheEntryComposite::GetValue() { if (this->Label) { return this->Label->GetValue(); - } else { - return CM_NULLPTR; } + return CM_NULLPTR; } diff --git a/Source/CursesDialog/cmCursesOptionsWidget.cxx b/Source/CursesDialog/cmCursesOptionsWidget.cxx index 5892e53..9a88aef 100644 --- a/Source/CursesDialog/cmCursesOptionsWidget.cxx +++ b/Source/CursesDialog/cmCursesOptionsWidget.cxx @@ -13,10 +13,7 @@ #include "cmCursesMainForm.h" -inline int ctrl(int z) -{ - return (z & 037); -} +#define ctrl(z) ((z)&037) cmCursesOptionsWidget::cmCursesOptionsWidget(int width, int height, int left, int top) @@ -34,25 +31,27 @@ cmCursesOptionsWidget::cmCursesOptionsWidget(int width, int height, int left, bool cmCursesOptionsWidget::HandleInput(int& key, cmCursesMainForm* /*fm*/, WINDOW* w) { - - // 10 == enter - if (key == 10 || key == KEY_ENTER) { - this->NextOption(); - touchwin(w); - wrefresh(w); - return true; - } else if (key == KEY_LEFT || key == ctrl('b')) { - touchwin(w); - wrefresh(w); - this->PreviousOption(); - return true; - } else if (key == KEY_RIGHT || key == ctrl('f')) { - this->NextOption(); - touchwin(w); - wrefresh(w); - return true; - } else { - return false; + switch (key) { + case 10: // 10 == enter + case KEY_ENTER: + this->NextOption(); + touchwin(w); + wrefresh(w); + return true; + case KEY_LEFT: + case ctrl('b'): + touchwin(w); + wrefresh(w); + this->PreviousOption(); + return true; + case KEY_RIGHT: + case ctrl('f'): + this->NextOption(); + touchwin(w); + wrefresh(w); + return true; + default: + return false; } } diff --git a/Source/CursesDialog/cmCursesStringWidget.cxx b/Source/CursesDialog/cmCursesStringWidget.cxx index c16de23..db98a00 100644 --- a/Source/CursesDialog/cmCursesStringWidget.cxx +++ b/Source/CursesDialog/cmCursesStringWidget.cxx @@ -94,10 +94,9 @@ bool cmCursesStringWidget::HandleInput(int& key, cmCursesMainForm* fm, // quit if (key == 'q') { return false; - } else { - key = getch(); - continue; } + key = getch(); + continue; } // If resize occurred during edit, move out of edit mode @@ -207,7 +206,6 @@ bool cmCursesStringWidget::PrintKeys() curses_move(y - 3, 0); printw(fmt_s, "Editing option, press [enter] to leave edit."); return true; - } else { - return false; } + return false; } |