From 18978c5f011f60315999a56132d7ed261b1ed472 Mon Sep 17 00:00:00 2001 From: Alcaro Date: Mon, 27 Jun 2016 21:34:05 +0200 Subject: [PATCH] More Coverity cleanups --- cores/libretro-ffmpeg/fft/fft.cpp | 2 ++ menu/cbs/menu_cbs_ok.c | 29 ++++++++++------------------- menu/menu_entries.c | 2 +- 3 files changed, 13 insertions(+), 20 deletions(-) diff --git a/cores/libretro-ffmpeg/fft/fft.cpp b/cores/libretro-ffmpeg/fft/fft.cpp index d73f5684da..4dafad2018 100644 --- a/cores/libretro-ffmpeg/fft/fft.cpp +++ b/cores/libretro-ffmpeg/fft/fft.cpp @@ -305,6 +305,8 @@ static void fft_step(glfft_t *fft, static inline unsigned log2i(unsigned x) { + if (x==0) return 0xBAADFOOD; // shouldn't happen + unsigned res; for (res = 0; x; x >>= 1) res++; diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index 89f5d0591d..2e48cf53dd 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -47,21 +47,24 @@ typedef struct #ifndef BIND_ACTION_OK #define BIND_ACTION_OK(cbs, name) \ - cbs->action_ok = name; \ - cbs->action_ok_ident = #name; + do { \ + cbs->action_ok = name; \ + cbs->action_ok_ident = #name; \ + } while(0) #endif /* FIXME - Global variables, refactor */ -char detect_content_path[PATH_MAX_LENGTH]; -unsigned rdb_entry_start_game_selection_ptr, rpl_entry_selection_ptr; +static char detect_content_path[PATH_MAX_LENGTH]; +static unsigned rpl_entry_selection_ptr; +unsigned rdb_entry_start_game_selection_ptr; size_t hack_shader_pass = 0; #ifdef HAVE_NETWORKING /* HACK - we have to find some way to pass state inbetween * function pointer callback functions that don't necessarily * call each other. */ -char *core_buf; -size_t core_len; +static char *core_buf; +static size_t core_len; /* defined in menu_cbs_deferred_push */ static void cb_net_generic(void *task_data, void *user_data, const char *err) @@ -638,7 +641,6 @@ static int action_ok_playlist_entry_collection(const char *path, size_t selection_ptr = 0; playlist_t *playlist = NULL; bool playlist_initialized = false; - bool is_history = true; const char *entry_path = NULL; const char *entry_label = NULL; const char *core_path = NULL; @@ -664,7 +666,6 @@ static int action_ok_playlist_entry_collection(const char *path, } playlist = tmp_playlist; - is_history = false; selection_ptr = entry_idx; @@ -729,16 +730,6 @@ static int action_ok_playlist_entry_collection(const char *path, if (!menu_content_load_from_playlist(&playlist_info)) return menu_cbs_exit(); - if (is_history) - { - menu_entries_pop_stack(&selection, 0, 1); - menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, - &selection); - - generic_action_ok_displaylist_push("", - "", 0, 0, 0, ACTION_OK_DL_CONTENT_SETTINGS); - } - return menu_cbs_exit(); } @@ -3090,7 +3081,7 @@ static int menu_cbs_init_bind_ok_compare_type(menu_file_list_cbs_t *cbs, } break; case FILE_TYPE_CORE: - if (cbs && cbs->enum_idx != MSG_UNKNOWN) + if (cbs->enum_idx != MSG_UNKNOWN) { switch (cbs->enum_idx) { diff --git a/menu/menu_entries.c b/menu/menu_entries.c index 2846681958..11528fc821 100644 --- a/menu/menu_entries.c +++ b/menu/menu_entries.c @@ -570,7 +570,7 @@ void menu_entries_add_enum(file_list_t *list, const char *path, const char *labe file_list_set_actiondata(list, idx, cbs); - cbs->enum_idx = enum_idx ; + cbs->enum_idx = enum_idx; cbs->setting = menu_setting_find_enum(enum_idx); menu_cbs_init(list, cbs, path, label, type, idx);