From 005c414e5f2a0ace3756da767d3920ac98cb5c76 Mon Sep 17 00:00:00 2001 From: Aidan MacDonald Date: Sat, 24 Jul 2021 15:39:01 +0100 Subject: Document intentional fallthroughs + fix harmless unintended ones Change-Id: I1ca5b1027ec30cbf61093bab35b980196ed14e6b --- apps/debug_menu.c | 3 ++- apps/gui/list.c | 1 + apps/gui/statusbar-skinned.c | 1 + apps/gui/wps.c | 1 + apps/onplay.c | 3 +++ apps/plugins/bubbles.c | 4 +++- apps/plugins/calculator.c | 2 ++ apps/plugins/chessbox/chessbox.c | 1 + apps/plugins/doom/p_ceilng.c | 3 +++ apps/plugins/doom/p_floor.c | 1 + apps/plugins/goban/goban.c | 1 + apps/plugins/imageviewer/imageviewer.c | 2 ++ apps/plugins/lrcplayer.c | 1 + apps/plugins/metronome.c | 2 ++ apps/plugins/mpegplayer/libmpeg2/header.c | 1 + apps/plugins/random_folder_advance_config.c | 1 + apps/plugins/rocklife.c | 1 + apps/plugins/rockpaint.c | 1 + apps/tagcache.c | 1 + apps/usb_keymaps.c | 1 + 20 files changed, 30 insertions(+), 2 deletions(-) (limited to 'apps') diff --git a/apps/debug_menu.c b/apps/debug_menu.c index 02dc19359b..800e485ce3 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c @@ -1726,6 +1726,7 @@ static bool dbg_disk_info(void) #ifdef HAVE_DIRCACHE static int dircache_callback(int btn, struct gui_synclist *lists) { + (void)lists; struct dircache_info info; dircache_get_info(&info); @@ -1737,6 +1738,7 @@ static int dircache_callback(int btn, struct gui_synclist *lists) splash(HZ/2, "Rebuilding cache"); dircache_suspend(); *(int *)lists->data = dircache_resume(); + /* Fallthrough */ case ACTION_UNKNOWN: btn = ACTION_NONE; break; @@ -1776,7 +1778,6 @@ static int dircache_callback(int btn, struct gui_synclist *lists) btn = ACTION_REDRAW; return btn; - (void)lists; } static bool dbg_dircache_info(void) diff --git a/apps/gui/list.c b/apps/gui/list.c index 36dbe44445..139dbaac18 100644 --- a/apps/gui/list.c +++ b/apps/gui/list.c @@ -748,6 +748,7 @@ bool gui_synclist_do_button(struct gui_synclist * lists, return true; } *actionptr = ACTION_TREE_PGLEFT; + /* fallthrough */ case ACTION_TREE_PGLEFT: if(pgleft_allow_cancel && (lists->offset_position[0] == 0)) { diff --git a/apps/gui/statusbar-skinned.c b/apps/gui/statusbar-skinned.c index 9b10ad4dce..63f3197faa 100644 --- a/apps/gui/statusbar-skinned.c +++ b/apps/gui/statusbar-skinned.c @@ -270,6 +270,7 @@ char* sb_create_from_settings(enum screen_type screen) { case STATUSBAR_TOP: y = STATUSBAR_HEIGHT; + /* Fallthrough */ case STATUSBAR_BOTTOM: height = screens[screen].lcdheight - STATUSBAR_HEIGHT; break; diff --git a/apps/gui/wps.c b/apps/gui/wps.c index 35716087c2..e491d6f35b 100644 --- a/apps/gui/wps.c +++ b/apps/gui/wps.c @@ -223,6 +223,7 @@ bool ffwd_rew(int button) { case ACTION_WPS_SEEKFWD: direction = 1; + /* Fallthrough */ case ACTION_WPS_SEEKBACK: if (skin_get_global_state()->ff_rewind) { diff --git a/apps/onplay.c b/apps/onplay.c index 0942d69d3f..a5a92e7c1c 100644 --- a/apps/onplay.c +++ b/apps/onplay.c @@ -1441,10 +1441,13 @@ static int clipboard_paste(void) { case OPRC_CANCELLED: splash_cancelled(); + /* Fallthrough */ case OPRC_SUCCESS: onplay_result = ONPLAY_RELOAD_DIR; + /* Fallthrough */ case OPRC_NOOP: clipboard_clear_selection(&clipboard); + /* Fallthrough */ case OPRC_NOOVERWRT: break; default: diff --git a/apps/plugins/bubbles.c b/apps/plugins/bubbles.c index ffc814e7a0..88d7228d72 100644 --- a/apps/plugins/bubbles.c +++ b/apps/plugins/bubbles.c @@ -76,7 +76,7 @@ enum { #endif #define ANGLE_STEP 2 -#define ANGLE_STEP_REP 4 +#define ANGLE_STEP_REP 6 #define BUBBLES_QUIT1 PLA_EXIT #define BUBBLES_QUIT2 PLA_CANCEL @@ -2367,12 +2367,14 @@ static int bubbles_handlebuttons(struct game_context* bb, bool animblock, switch(button){ case BUBBLES_LEFT_REP: if(bb->angle > MIN_ANGLE) bb->angle -= ANGLE_STEP_REP; + break; case BUBBLES_LEFT: /* change angle to the left */ if(bb->angle > MIN_ANGLE) bb->angle -= ANGLE_STEP; break; case BUBBLES_RIGHT_REP: if(bb->angle < MAX_ANGLE) bb->angle += ANGLE_STEP_REP; + break; case BUBBLES_RIGHT: /* change angle to the right */ if(bb->angle < MAX_ANGLE) bb->angle += ANGLE_STEP; break; diff --git a/apps/plugins/calculator.c b/apps/plugins/calculator.c index bd09330529..5bab15d7ed 100644 --- a/apps/plugins/calculator.c +++ b/apps/plugins/calculator.c @@ -755,6 +755,7 @@ double strtod(const char *nptr, char **endptr) case '.': case '\'': end=1; + /* fallthrough */ default: nptr++; } @@ -1687,6 +1688,7 @@ static void typingProcess(void){ clearInput(); *typingbufPointer = '0'; typingbufPointer++; + /* Fallthrough */ case cal_typing: calStatus = cal_dotted; *typingbufPointer = '.'; diff --git a/apps/plugins/chessbox/chessbox.c b/apps/plugins/chessbox/chessbox.c index 397fd0e559..13df4f177e 100644 --- a/apps/plugins/chessbox/chessbox.c +++ b/apps/plugins/chessbox/chessbox.c @@ -780,6 +780,7 @@ static bool cb_start_viewer(const char* filename){ break; case COMMAND_QUIT: exit_app = true; + /* fallthrough */ case COMMAND_RETURN: exit_viewer = true; break; diff --git a/apps/plugins/doom/p_ceilng.c b/apps/plugins/doom/p_ceilng.c index db5a701b1a..f83bdc0260 100644 --- a/apps/plugins/doom/p_ceilng.c +++ b/apps/plugins/doom/p_ceilng.c @@ -121,6 +121,7 @@ void T_MoveCeiling (ceiling_t* ceiling) // crushers reverse direction at the top case silentCrushAndRaise: S_StartSound((mobj_t *)&ceiling->sector->soundorg,sfx_pstop); + /* fallthrough */ case genSilentCrusher: case genCrusher: case fastCrushAndRaise: @@ -177,8 +178,10 @@ void T_MoveCeiling (ceiling_t* ceiling) // except generalized ones, reset speed, start back up case silentCrushAndRaise: S_StartSound((mobj_t *)&ceiling->sector->soundorg,sfx_pstop); + /* fallthrough */ case crushAndRaise: ceiling->speed = CEILSPEED; + /* fallthrough */ case fastCrushAndRaise: ceiling->direction = 1; break; diff --git a/apps/plugins/doom/p_floor.c b/apps/plugins/doom/p_floor.c index f4dbcd04f5..953e4dd09d 100644 --- a/apps/plugins/doom/p_floor.c +++ b/apps/plugins/doom/p_floor.c @@ -503,6 +503,7 @@ int EV_DoFloor case raiseFloorCrush: floor->crush = true; + /* fallthrough */ case raiseFloor: floor->direction = 1; floor->sector = sec; diff --git a/apps/plugins/goban/goban.c b/apps/plugins/goban/goban.c index 7b378eebff..b041f7cd73 100644 --- a/apps/plugins/goban/goban.c +++ b/apps/plugins/goban/goban.c @@ -524,6 +524,7 @@ plugin_start (const void *parameter) case BUTTON_NONE: is_idle = true; + /* fallthrough */ default: if (rb->default_event_handler (btn) == SYS_USB_CONNECTED) { diff --git a/apps/plugins/imageviewer/imageviewer.c b/apps/plugins/imageviewer/imageviewer.c index 4b1a982438..508cf1a5b5 100644 --- a/apps/plugins/imageviewer/imageviewer.c +++ b/apps/plugins/imageviewer/imageviewer.c @@ -600,6 +600,7 @@ static int scroll_bmp(struct image_info *info) if (entries > 1 && info->width <= LCD_WIDTH && info->height <= LCD_HEIGHT) return change_filename(DIR_PREV); + /* fallthrough */ case IMGVIEW_LEFT | BUTTON_REPEAT: pan_view_left(info); break; @@ -608,6 +609,7 @@ static int scroll_bmp(struct image_info *info) if (entries > 1 && info->width <= LCD_WIDTH && info->height <= LCD_HEIGHT) return change_filename(DIR_NEXT); + /* fallthrough */ case IMGVIEW_RIGHT | BUTTON_REPEAT: pan_view_right(info); break; diff --git a/apps/plugins/lrcplayer.c b/apps/plugins/lrcplayer.c index 2abfbef6c9..225f0c8689 100644 --- a/apps/plugins/lrcplayer.c +++ b/apps/plugins/lrcplayer.c @@ -227,6 +227,7 @@ static int lrc_set_time(const char *title, const char *unit, long *pval, case PLA_UP_REPEAT: case PLA_DOWN_REPEAT: mult *= 10; + /* fallthrough */ case PLA_DOWN: case PLA_UP: if (button == PLA_DOWN_REPEAT || button == PLA_DOWN) diff --git a/apps/plugins/metronome.c b/apps/plugins/metronome.c index a6b4181df2..157d116ff9 100644 --- a/apps/plugins/metronome.c +++ b/apps/plugins/metronome.c @@ -1663,11 +1663,13 @@ enum plugin_status plugin_start(const void* file) break; case METRONOME_LEFT: bpm_step_counter = 0; + /* fallthrough */ case METRONOME_LEFT_REP: change_bpm(-1); break; case METRONOME_RIGHT: bpm_step_counter = 0; + /* fallthrough */ case METRONOME_RIGHT_REP: change_bpm(1); break; diff --git a/apps/plugins/mpegplayer/libmpeg2/header.c b/apps/plugins/mpegplayer/libmpeg2/header.c index 001cafe7d5..b40193a338 100644 --- a/apps/plugins/mpegplayer/libmpeg2/header.c +++ b/apps/plugins/mpegplayer/libmpeg2/header.c @@ -307,6 +307,7 @@ static int sequence_ext (mpeg2dec_t * mpeg2dec) return 1; case 2: /* 4:2:0 */ sequence->chroma_height >>= 1; + /* fallthrough */ case 4: /* 4:2:2 */ sequence->chroma_width >>= 1; } diff --git a/apps/plugins/random_folder_advance_config.c b/apps/plugins/random_folder_advance_config.c index c9dce0223b..ca0d5f397d 100644 --- a/apps/plugins/random_folder_advance_config.c +++ b/apps/plugins/random_folder_advance_config.c @@ -366,6 +366,7 @@ static int edit_list(void) { case 0: save_list(); + /* fallthrough */ case 1: exit = true; ret = -2; diff --git a/apps/plugins/rocklife.c b/apps/plugins/rocklife.c index 0be48dcce8..99297abd0f 100644 --- a/apps/plugins/rocklife.c +++ b/apps/plugins/rocklife.c @@ -150,6 +150,7 @@ static bool load_cellfile(const char *file, char *pgrid){ switch(c) { case '!': comment = true; + break; case '.': if (!comment) x++; diff --git a/apps/plugins/rockpaint.c b/apps/plugins/rockpaint.c index a0d9b26ec2..09fa2c8c5f 100644 --- a/apps/plugins/rockpaint.c +++ b/apps/plugins/rockpaint.c @@ -1907,6 +1907,7 @@ static void draw_text( int x, int y ) rb->lcd_set_foreground( rp_colors[ drawcolor ] ); buffer_putsxyofs( save_buffer, COLS, ROWS, x, y, 0, buffer->text.text ); + /* fallthrough */ case TEXT_MENU_CANCEL: default: restore_screen(); diff --git a/apps/tagcache.c b/apps/tagcache.c index 37e389444a..2e705d658e 100644 --- a/apps/tagcache.c +++ b/apps/tagcache.c @@ -4824,6 +4824,7 @@ static void tagcache_thread(void) case Q_START_SCAN: check_done = false; + /* fallthrough */ case SYS_TIMEOUT: if (check_done || !tc_stat.ready) break ; diff --git a/apps/usb_keymaps.c b/apps/usb_keymaps.c index bd72d95be8..2781fb5532 100644 --- a/apps/usb_keymaps.c +++ b/apps/usb_keymaps.c @@ -181,6 +181,7 @@ int get_hid_usb_action(void) { case ACTION_USB_HID_MODE_SWITCH_NEXT: step = 1; + /* fallthrough */ case ACTION_USB_HID_MODE_SWITCH_PREV: /* Switch key mappings in a cyclic way */ usb_keypad_mode = clamp_value_wrap(usb_keypad_mode + step, -- cgit v1.2.3