CWE-478: Addition of missing default case in the Switch statement

This commit is contained in:
Markus Gans 2020-04-17 10:53:47 +02:00
parent defc1714e4
commit 6de04a3edd
12 changed files with 32 additions and 0 deletions

View File

@ -275,6 +275,7 @@ std::size_t FLabel::getAlignOffset (const std::size_t length)
switch ( alignment ) switch ( alignment )
{ {
case fc::alignLeft: case fc::alignLeft:
default:
return 0; return 0;
case fc::alignCenter: case fc::alignCenter:

View File

@ -635,6 +635,7 @@ void FLineEdit::adjustLabel()
break; break;
case label_left: case label_left:
default:
label->setGeometry ( FPoint(w->getX() - int(label_width) - 1, w->getY()) label->setGeometry ( FPoint(w->getX() - int(label_width) - 1, w->getY())
, FSize(label_width, 1) ); , FSize(label_width, 1) );
break; break;
@ -749,6 +750,7 @@ void FLineEdit::drawInputField()
switch ( input_type ) switch ( input_type )
{ {
case FLineEdit::textfield: case FLineEdit::textfield:
default:
return printTextField(); return printTextField();
case FLineEdit::password: case FLineEdit::password:
@ -818,6 +820,7 @@ inline std::size_t FLineEdit::getCursorColumnPos()
switch ( input_type ) switch ( input_type )
{ {
case FLineEdit::textfield: case FLineEdit::textfield:
default:
return getColumnWidth (print_text, cursor_pos); return getColumnWidth (print_text, cursor_pos);
case FLineEdit::password: case FLineEdit::password:

View File

@ -1758,6 +1758,7 @@ void FListBox::cb_vbarChange (const FWidget*, const FDataPtr)
switch ( scrollType ) switch ( scrollType )
{ {
case FScrollbar::noScroll: case FScrollbar::noScroll:
default:
break; break;
case FScrollbar::scrollPageBackward: case FScrollbar::scrollPageBackward:
@ -1821,6 +1822,7 @@ void FListBox::cb_hbarChange (const FWidget*, const FDataPtr)
switch ( scrollType ) switch ( scrollType )
{ {
case FScrollbar::noScroll: case FScrollbar::noScroll:
default:
break; break;
case FScrollbar::scrollPageBackward: case FScrollbar::scrollPageBackward:

View File

@ -1018,6 +1018,7 @@ void FListView::sort()
{ {
case fc::unknown: case fc::unknown:
case fc::by_name: case fc::by_name:
default:
if ( sort_order == fc::ascending ) if ( sort_order == fc::ascending )
{ {
sort (sortAscendingByName); sort (sortAscendingByName);
@ -1586,6 +1587,7 @@ std::size_t FListView::getAlignOffset ( const fc::text_alignment align
switch ( align ) switch ( align )
{ {
case fc::alignLeft: case fc::alignLeft:
default:
return 0; return 0;
case fc::alignCenter: case fc::alignCenter:
@ -2857,6 +2859,7 @@ void FListView::cb_vbarChange (const FWidget*, const FDataPtr)
switch ( scrollType ) switch ( scrollType )
{ {
case FScrollbar::noScroll: case FScrollbar::noScroll:
default:
break; break;
case FScrollbar::scrollPageBackward: case FScrollbar::scrollPageBackward:
@ -2916,6 +2919,7 @@ void FListView::cb_hbarChange (const FWidget*, const FDataPtr)
switch ( scrollType ) switch ( scrollType )
{ {
case FScrollbar::noScroll: case FScrollbar::noScroll:
default:
break; break;
case FScrollbar::scrollPageBackward: case FScrollbar::scrollPageBackward:

View File

@ -672,6 +672,7 @@ void FMenuItem::passMouseEvent ( T widget, const FMouseEvent* ev
break; break;
case fc::MouseMove_Event: case fc::MouseMove_Event:
default:
widget->onMouseMove(_ev.get()); widget->onMouseMove(_ev.get());
break; break;
} }

View File

@ -183,6 +183,7 @@ inline FMouse* FMouse::createMouseObject (const mouse_type mt)
switch ( mt ) switch ( mt )
{ {
case none: case none:
default:
return nullptr; return nullptr;
case gpm: case gpm:

View File

@ -793,6 +793,7 @@ void FScrollView::setHorizontalScrollBarVisibility()
switch ( h_mode ) switch ( h_mode )
{ {
case fc::Auto: case fc::Auto:
default:
if ( getScrollWidth() > getViewportWidth() ) if ( getScrollWidth() > getViewportWidth() )
hbar->show(); hbar->show();
else else
@ -815,6 +816,7 @@ void FScrollView::setVerticalScrollBarVisibility()
switch ( v_mode ) switch ( v_mode )
{ {
case fc::Auto: case fc::Auto:
default:
if ( getScrollHeight() > getViewportHeight() ) if ( getScrollHeight() > getViewportHeight() )
vbar->show(); vbar->show();
else else
@ -870,6 +872,7 @@ void FScrollView::cb_vbarChange (const FWidget*, const FDataPtr)
switch ( scrollType ) switch ( scrollType )
{ {
case FScrollbar::noScroll: case FScrollbar::noScroll:
default:
break; break;
case FScrollbar::scrollPageBackward: case FScrollbar::scrollPageBackward:
@ -921,6 +924,7 @@ void FScrollView::cb_hbarChange (const FWidget*, const FDataPtr)
switch ( scrollType ) switch ( scrollType )
{ {
case FScrollbar::noScroll: case FScrollbar::noScroll:
default:
break; break;
case FScrollbar::scrollPageBackward: case FScrollbar::scrollPageBackward:

View File

@ -294,6 +294,7 @@ void FSpinBox::onTimer (FTimerEvent*)
break; break;
case FSpinBox::noSpin: case FSpinBox::noSpin:
default:
break; break;
} }
} }

View File

@ -1090,6 +1090,7 @@ void FTerm::setEncoding (fc::encoding enc)
case fc::ASCII: case fc::ASCII:
case fc::UNKNOWN: case fc::UNKNOWN:
case fc::NUM_OF_ENCODINGS: case fc::NUM_OF_ENCODINGS:
default:
putchar() = &FTerm::putchar_ASCII; putchar() = &FTerm::putchar_ASCII;
} }
@ -2553,6 +2554,10 @@ void FTerm::signal_handler (int signum)
<< signum << signum
<< " (" << strsignal(signum) << ")" << std::endl; << " (" << strsignal(signum) << ")" << std::endl;
std::terminate(); std::terminate();
break;
default:
break;
} }
} }

View File

@ -758,6 +758,7 @@ void FTextView::cb_vbarChange (const FWidget*, const FDataPtr)
switch ( scrollType ) switch ( scrollType )
{ {
case FScrollbar::noScroll: case FScrollbar::noScroll:
default:
break; break;
case FScrollbar::scrollPageBackward: case FScrollbar::scrollPageBackward:
@ -809,6 +810,7 @@ void FTextView::cb_hbarChange (const FWidget*, const FDataPtr)
switch ( scrollType ) switch ( scrollType )
{ {
case FScrollbar::noScroll: case FScrollbar::noScroll:
default:
break; break;
case FScrollbar::scrollPageBackward: case FScrollbar::scrollPageBackward:

View File

@ -159,6 +159,7 @@ void FVTerm::setTerminalUpdates (terminal_update refresh_state)
case continue_terminal_updates: case continue_terminal_updates:
case start_terminal_updates: case start_terminal_updates:
default:
no_terminal_updates = false; no_terminal_updates = false;
} }

View File

@ -235,6 +235,7 @@ std::vector<bool>& FWidget::doubleFlatLine_ref (fc::sides side)
return double_flatline_mask.bottom; return double_flatline_mask.bottom;
case fc::left: case fc::left:
default:
return double_flatline_mask.left; return double_flatline_mask.left;
} }
@ -665,6 +666,9 @@ void FWidget::setDoubleFlatLine (fc::sides side, bool bit)
length = double_flatline_mask.left.size(); length = double_flatline_mask.left.size();
double_flatline_mask.left.assign(length, bit); double_flatline_mask.left.assign(length, bit);
break; break;
default:
break;
} }
} }
@ -714,6 +718,9 @@ void FWidget::setDoubleFlatLine (fc::sides side, int pos, bool bit)
double_flatline_mask.left[index] = bit; double_flatline_mask.left[index] = bit;
break; break;
default:
break;
} }
} }