mirror of
https://github.com/libretro/RetroArch
synced 2025-03-28 08:37:41 +00:00
FIx some new Coverity errors
This commit is contained in:
parent
642818d59c
commit
5379b12e7c
@ -242,11 +242,9 @@ static void add_sub_conf(config_file_t *conf, char *path)
|
|||||||
struct config_include_list *head = conf->includes;
|
struct config_include_list *head = conf->includes;
|
||||||
struct config_include_list *node = (struct config_include_list*)malloc(sizeof(*node));
|
struct config_include_list *node = (struct config_include_list*)malloc(sizeof(*node));
|
||||||
|
|
||||||
node->path = NULL;
|
|
||||||
node->next = NULL;
|
|
||||||
|
|
||||||
if (node)
|
if (node)
|
||||||
{
|
{
|
||||||
|
node->next = NULL;
|
||||||
/* Add include list */
|
/* Add include list */
|
||||||
node->path = strdup(path);
|
node->path = strdup(path);
|
||||||
|
|
||||||
|
@ -735,7 +735,8 @@ static int general_push(menu_displaylist_info_t *info,
|
|||||||
break;
|
break;
|
||||||
case PUSH_DEFAULT:
|
case PUSH_DEFAULT:
|
||||||
{
|
{
|
||||||
char *new_exts = NULL;
|
bool new_exts_allocated = false;
|
||||||
|
char *new_exts = NULL;
|
||||||
|
|
||||||
if (menu_setting_get_browser_selection_type(info->setting) == ST_DIR)
|
if (menu_setting_get_browser_selection_type(info->setting) == ST_DIR)
|
||||||
{
|
{
|
||||||
@ -743,12 +744,18 @@ static int general_push(menu_displaylist_info_t *info,
|
|||||||
else if (system_menu && system_menu->valid_extensions)
|
else if (system_menu && system_menu->valid_extensions)
|
||||||
{
|
{
|
||||||
if (*system_menu->valid_extensions)
|
if (*system_menu->valid_extensions)
|
||||||
new_exts = strdup(system_menu->valid_extensions);
|
{
|
||||||
|
new_exts = strdup(system_menu->valid_extensions);
|
||||||
|
new_exts_allocated = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!string_is_empty(system->valid_extensions))
|
if (!string_is_empty(system->valid_extensions))
|
||||||
new_exts = strdup(system->valid_extensions);
|
{
|
||||||
|
new_exts = strdup(system->valid_extensions);
|
||||||
|
new_exts_allocated = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!new_exts)
|
if (!new_exts)
|
||||||
@ -770,7 +777,11 @@ static int general_push(menu_displaylist_info_t *info,
|
|||||||
string_list_join_concat(newstring2, path_size,
|
string_list_join_concat(newstring2, path_size,
|
||||||
str_list3, "|");
|
str_list3, "|");
|
||||||
string_list_free(str_list3);
|
string_list_free(str_list3);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (new_exts_allocated)
|
||||||
|
free(new_exts);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PUSH_ARCHIVE_OPEN_DETECT_CORE:
|
case PUSH_ARCHIVE_OPEN_DETECT_CORE:
|
||||||
|
@ -2301,21 +2301,21 @@ static void xmb_draw_items(
|
|||||||
menu_animation_ctx_ticker_t ticker;
|
menu_animation_ctx_ticker_t ticker;
|
||||||
char ticker_str[PATH_MAX_LENGTH];
|
char ticker_str[PATH_MAX_LENGTH];
|
||||||
char tmp[255];
|
char tmp[255];
|
||||||
|
menu_entry_t entry;
|
||||||
unsigned entry_type = 0;
|
unsigned entry_type = 0;
|
||||||
const float half_size = xmb->icon_size / 2.0f;
|
const float half_size = xmb->icon_size / 2.0f;
|
||||||
uintptr_t texture_switch = 0;
|
uintptr_t texture_switch = 0;
|
||||||
xmb_node_t * node = (xmb_node_t*)
|
|
||||||
menu_entries_get_userdata_at_offset(list, i);
|
|
||||||
bool do_draw_text = false;
|
bool do_draw_text = false;
|
||||||
unsigned ticker_limit = 35;
|
unsigned ticker_limit = 35;
|
||||||
menu_entry_t *entry = menu_entry_alloc();
|
xmb_node_t * node = (xmb_node_t*)
|
||||||
|
menu_entries_get_userdata_at_offset(list, i);
|
||||||
|
|
||||||
if (!node)
|
if (!node)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ticker_str[0] = tmp[0] = '\0';
|
ticker_str[0] = tmp[0] = '\0';
|
||||||
|
|
||||||
menu_entry_init(entry);
|
menu_entry_init(&entry);
|
||||||
|
|
||||||
icon_y = xmb->margins_screen_top + node->y + half_size;
|
icon_y = xmb->margins_screen_top + node->y + half_size;
|
||||||
|
|
||||||
@ -2331,23 +2331,23 @@ static void xmb_draw_items(
|
|||||||
if (icon_x < -half_size || icon_x > width)
|
if (icon_x < -half_size || icon_x > width)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
menu_entry_get(entry, 0, i, list, true);
|
menu_entry_get(&entry, 0, i, list, true);
|
||||||
entry_type = menu_entry_get_type_new(entry);
|
entry_type = menu_entry_get_type_new(&entry);
|
||||||
|
|
||||||
if (entry_type == FILE_TYPE_CONTENTLIST_ENTRY)
|
if (entry_type == FILE_TYPE_CONTENTLIST_ENTRY)
|
||||||
fill_short_pathname_representation(entry->path, entry->path,
|
fill_short_pathname_representation(entry.path, entry.path,
|
||||||
sizeof(entry->path));
|
sizeof(entry.path));
|
||||||
|
|
||||||
if (string_is_equal(entry->value, msg_hash_to_str(MENU_ENUM_LABEL_DISABLED)) ||
|
if (string_is_equal(entry.value, msg_hash_to_str(MENU_ENUM_LABEL_DISABLED)) ||
|
||||||
(string_is_equal(entry->value, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF))))
|
(string_is_equal(entry.value, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF))))
|
||||||
{
|
{
|
||||||
if (xmb->textures.list[XMB_TEXTURE_SWITCH_OFF])
|
if (xmb->textures.list[XMB_TEXTURE_SWITCH_OFF])
|
||||||
texture_switch = xmb->textures.list[XMB_TEXTURE_SWITCH_OFF];
|
texture_switch = xmb->textures.list[XMB_TEXTURE_SWITCH_OFF];
|
||||||
else
|
else
|
||||||
do_draw_text = true;
|
do_draw_text = true;
|
||||||
}
|
}
|
||||||
else if (string_is_equal(entry->value, msg_hash_to_str(MENU_ENUM_LABEL_ENABLED)) ||
|
else if (string_is_equal(entry.value, msg_hash_to_str(MENU_ENUM_LABEL_ENABLED)) ||
|
||||||
(string_is_equal(entry->value, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ON))))
|
(string_is_equal(entry.value, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ON))))
|
||||||
{
|
{
|
||||||
if (xmb->textures.list[XMB_TEXTURE_SWITCH_ON])
|
if (xmb->textures.list[XMB_TEXTURE_SWITCH_ON])
|
||||||
texture_switch = xmb->textures.list[XMB_TEXTURE_SWITCH_ON];
|
texture_switch = xmb->textures.list[XMB_TEXTURE_SWITCH_ON];
|
||||||
@ -2356,7 +2356,7 @@ static void xmb_draw_items(
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
enum msg_file_type type = msg_hash_to_file_type(msg_hash_calculate(entry->value));
|
enum msg_file_type type = msg_hash_to_file_type(msg_hash_calculate(entry.value));
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
@ -2379,7 +2379,7 @@ static void xmb_draw_items(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string_is_empty(entry->value))
|
if (string_is_empty(entry.value))
|
||||||
{
|
{
|
||||||
if (xmb->savestate_thumbnail ||
|
if (xmb->savestate_thumbnail ||
|
||||||
(!string_is_equal
|
(!string_is_equal
|
||||||
@ -2392,7 +2392,7 @@ static void xmb_draw_items(
|
|||||||
ticker_limit = 70;
|
ticker_limit = 70;
|
||||||
}
|
}
|
||||||
|
|
||||||
menu_entry_get_rich_label(entry, ticker_str, sizeof(ticker_str));
|
menu_entry_get_rich_label(&entry, ticker_str, sizeof(ticker_str));
|
||||||
|
|
||||||
ticker.s = tmp;
|
ticker.s = tmp;
|
||||||
ticker.len = ticker_limit;
|
ticker.len = ticker_limit;
|
||||||
@ -2404,7 +2404,7 @@ static void xmb_draw_items(
|
|||||||
|
|
||||||
label_offset = xmb->margins_label_top;
|
label_offset = xmb->margins_label_top;
|
||||||
if (i == current && width > 320 && height > 240
|
if (i == current && width > 320 && height > 240
|
||||||
&& !string_is_empty(entry->sublabel))
|
&& !string_is_empty(entry.sublabel))
|
||||||
{
|
{
|
||||||
char entry_sublabel[255];
|
char entry_sublabel[255];
|
||||||
|
|
||||||
@ -2412,7 +2412,7 @@ static void xmb_draw_items(
|
|||||||
|
|
||||||
label_offset = - xmb->margins_label_top;
|
label_offset = - xmb->margins_label_top;
|
||||||
|
|
||||||
word_wrap(entry_sublabel, entry->sublabel, 50, true);
|
word_wrap(entry_sublabel, entry.sublabel, 50, true);
|
||||||
|
|
||||||
xmb_draw_text(menu_disp_info, xmb, entry_sublabel,
|
xmb_draw_text(menu_disp_info, xmb, entry_sublabel,
|
||||||
node->x + xmb->margins_screen_left +
|
node->x + xmb->margins_screen_left +
|
||||||
@ -2434,7 +2434,7 @@ static void xmb_draw_items(
|
|||||||
ticker.s = tmp;
|
ticker.s = tmp;
|
||||||
ticker.len = 35;
|
ticker.len = 35;
|
||||||
ticker.idx = frame_count / 20;
|
ticker.idx = frame_count / 20;
|
||||||
ticker.str = entry->value;
|
ticker.str = entry.value;
|
||||||
ticker.selected = (i == current);
|
ticker.selected = (i == current);
|
||||||
|
|
||||||
menu_animation_ticker(&ticker);
|
menu_animation_ticker(&ticker);
|
||||||
@ -2460,7 +2460,7 @@ static void xmb_draw_items(
|
|||||||
math_matrix_4x4 mymat;
|
math_matrix_4x4 mymat;
|
||||||
menu_display_ctx_rotate_draw_t rotate_draw;
|
menu_display_ctx_rotate_draw_t rotate_draw;
|
||||||
uintptr_t texture = xmb_icon_get_id(xmb, core_node, node,
|
uintptr_t texture = xmb_icon_get_id(xmb, core_node, node,
|
||||||
entry->enum_idx, entry_type, (i == current));
|
entry.enum_idx, entry_type, (i == current));
|
||||||
float x = icon_x;
|
float x = icon_x;
|
||||||
float y = icon_y;
|
float y = icon_y;
|
||||||
float rotation = 0;
|
float rotation = 0;
|
||||||
@ -2510,8 +2510,7 @@ static void xmb_draw_items(
|
|||||||
&color[0],
|
&color[0],
|
||||||
xmb->shadow_offset);
|
xmb->shadow_offset);
|
||||||
|
|
||||||
menu_entry_free(entry);
|
menu_entry_free(&entry);
|
||||||
free(entry);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
menu_display_blend_end();
|
menu_display_blend_end();
|
||||||
|
@ -64,7 +64,8 @@ void filebrowser_parse(void *data, unsigned type_data)
|
|||||||
enum menu_displaylist_ctl_state type = (enum menu_displaylist_ctl_state)
|
enum menu_displaylist_ctl_state type = (enum menu_displaylist_ctl_state)
|
||||||
type_data;
|
type_data;
|
||||||
const char *path = info->path;
|
const char *path = info->path;
|
||||||
bool path_is_compressed = path ? path_is_compressed_file(path) : false;
|
bool path_is_compressed = (path && !string_is_empty(path))
|
||||||
|
? path_is_compressed_file(path) : false;
|
||||||
bool filter_ext =
|
bool filter_ext =
|
||||||
settings->bools.menu_navigation_browser_filter_supported_extensions_enable;
|
settings->bools.menu_navigation_browser_filter_supported_extensions_enable;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user