Silence static code analysis warings pointed out by cppcheck

This commit is contained in:
twinaphex 2021-03-24 02:23:43 +01:00
parent 71b4a4558c
commit d9fa5585a0
2 changed files with 17 additions and 9 deletions

View File

@ -2950,7 +2950,7 @@ static uintptr_t xmb_icon_get_id(xmb_handle_t *xmb,
{ {
unsigned index = 0; unsigned index = 0;
int input_num = type - input_id; int input_num = type - input_id;
for (index = 0; index < sizeof(input_config_bind_order); index++) for (index = 0; index < ARRAY_SIZE(input_config_bind_order); index++)
{ {
if (input_config_bind_order[index] == input_num) if (input_config_bind_order[index] == input_num)
{ {

View File

@ -2273,7 +2273,6 @@ static bool menu_driver_displaylist_push_internal(
} }
else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_PLAYLISTS_TAB))) else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_PLAYLISTS_TAB)))
{ {
struct rarch_state *p_rarch = &rarch_st;
const char *dir_playlist = settings->paths.directory_playlist; const char *dir_playlist = settings->paths.directory_playlist;
filebrowser_clear_type(); filebrowser_clear_type();
@ -2924,6 +2923,9 @@ static bool menu_list_pop_stack(
{ {
file_list_t *menu_list = MENU_LIST_GET(list, (unsigned)idx); file_list_t *menu_list = MENU_LIST_GET(list, (unsigned)idx);
if (!menu_list)
return false;
if (menu_list->size != 0) if (menu_list->size != 0)
{ {
menu_ctx_list_t list_info; menu_ctx_list_t list_info;
@ -11035,10 +11037,13 @@ static bool command_set_shader(const char *arg)
/* rebase on shader directory */ /* rebase on shader directory */
if (!path_is_absolute(arg)) if (!path_is_absolute(arg))
{ {
char abs_arg[PATH_MAX_LENGTH]; static char abs_arg[PATH_MAX_LENGTH];
const char *ref_path = settings->paths.directory_video_shader; const char *ref_path = settings->paths.directory_video_shader;
fill_pathname_join(abs_arg, fill_pathname_join(abs_arg,
ref_path, arg, sizeof(abs_arg)); ref_path, arg, sizeof(abs_arg));
/* TODO/FIXME - pointer to local variable -
* making abs_arg static for now to workaround this
*/
arg = abs_arg; arg = abs_arg;
} }
} }
@ -33313,12 +33318,15 @@ static void input_state_set_last(unsigned port, unsigned device,
if (p_rarch->input_state_list) if (p_rarch->input_state_list)
element = (input_list_element*) element = (input_list_element*)
mylist_add_element(p_rarch->input_state_list); mylist_add_element(p_rarch->input_state_list);
element->port = port; if (element)
element->device = device; {
element->index = index; element->port = port;
if (id >= element->state_size) element->device = device;
input_list_element_expand(element, id); element->index = index;
element->state[id] = value; if (id >= element->state_size)
input_list_element_expand(element, id);
element->state[id] = value;
}
} }
static int16_t input_state_get_last(unsigned port, static int16_t input_state_get_last(unsigned port,