mirror of
https://github.com/libretro/RetroArch
synced 2025-02-21 09:39:56 +00:00
Try to fix Coverity warnings
This commit is contained in:
parent
62d2b9a54e
commit
72dc03a1c6
@ -1964,7 +1964,7 @@ static void cheevos_test_cheevo_set(const cheevoset_t *set)
|
|||||||
task_push_http_transfer(url, true, NULL,
|
task_push_http_transfer(url, true, NULL,
|
||||||
cheevos_unlocked, cheevo);
|
cheevos_unlocked, cheevo);
|
||||||
|
|
||||||
if(settings->bools.cheevos_auto_screenshot)
|
if (settings && settings->bools.cheevos_auto_screenshot)
|
||||||
{
|
{
|
||||||
char shotname[256];
|
char shotname[256];
|
||||||
|
|
||||||
@ -1974,7 +1974,8 @@ static void cheevos_test_cheevo_set(const cheevoset_t *set)
|
|||||||
cheevo->id);
|
cheevo->id);
|
||||||
shotname[sizeof(shotname) - 1] = '\0';
|
shotname[sizeof(shotname) - 1] = '\0';
|
||||||
|
|
||||||
if(take_screenshot(shotname, true, video_driver_cached_frame_has_valid_framebuffer()))
|
if (take_screenshot(shotname, true,
|
||||||
|
video_driver_cached_frame_has_valid_framebuffer()))
|
||||||
RARCH_LOG("[CHEEVOS]: got a screenshot for cheevo %u\n", cheevo->id);
|
RARCH_LOG("[CHEEVOS]: got a screenshot for cheevo %u\n", cheevo->id);
|
||||||
else
|
else
|
||||||
RARCH_LOG("[CHEEVOS]: failed to get screenshot for cheevo %u\n", cheevo->id);
|
RARCH_LOG("[CHEEVOS]: failed to get screenshot for cheevo %u\n", cheevo->id);
|
||||||
|
@ -729,7 +729,7 @@ static void check_proc_acpi_battery(const char * node, bool * have_battery,
|
|||||||
{
|
{
|
||||||
char *endptr = NULL;
|
char *endptr = NULL;
|
||||||
|
|
||||||
if (*endptr == ' ')
|
if (endptr && *endptr == ' ')
|
||||||
remaining = (int)strtol(val, &endptr, 10);
|
remaining = (int)strtol(val, &endptr, 10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -741,7 +741,7 @@ static void check_proc_acpi_battery(const char * node, bool * have_battery,
|
|||||||
char *endptr = NULL;
|
char *endptr = NULL;
|
||||||
|
|
||||||
if (string_is_equal(key, "design capacity"))
|
if (string_is_equal(key, "design capacity"))
|
||||||
if (*endptr == ' ')
|
if (endptr && *endptr == ' ')
|
||||||
maximum = (int)strtol(val, &endptr, 10);
|
maximum = (int)strtol(val, &endptr, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1155,17 +1155,23 @@ static int generic_action_ok(const char *path,
|
|||||||
struct video_shader *shader = menu_shader_get();
|
struct video_shader *shader = menu_shader_get();
|
||||||
struct video_shader_pass *shader_pass = shader ? &shader->pass[(unsigned)hack_shader_pass] : NULL;
|
struct video_shader_pass *shader_pass = shader ? &shader->pass[(unsigned)hack_shader_pass] : NULL;
|
||||||
flush_char = msg_hash_to_str((enum msg_hash_enums)flush_id);
|
flush_char = msg_hash_to_str((enum msg_hash_enums)flush_id);
|
||||||
|
|
||||||
|
if (shader_pass)
|
||||||
|
{
|
||||||
strlcpy(
|
strlcpy(
|
||||||
shader_pass->source.path,
|
shader_pass->source.path,
|
||||||
action_path,
|
action_path,
|
||||||
sizeof(shader_pass->source.path));
|
sizeof(shader_pass->source.path));
|
||||||
video_shader_resolve_parameters(NULL, menu_shader_get());
|
video_shader_resolve_parameters(NULL, shader);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ACTION_OK_LOAD_RECORD_CONFIGFILE:
|
case ACTION_OK_LOAD_RECORD_CONFIGFILE:
|
||||||
{
|
{
|
||||||
global_t *global = global_get_ptr();
|
global_t *global = global_get_ptr();
|
||||||
flush_char = msg_hash_to_str(flush_id);
|
flush_char = msg_hash_to_str(flush_id);
|
||||||
|
|
||||||
|
if (global)
|
||||||
strlcpy(global->record.config, action_path,
|
strlcpy(global->record.config, action_path,
|
||||||
sizeof(global->record.config));
|
sizeof(global->record.config));
|
||||||
}
|
}
|
||||||
|
@ -837,14 +837,6 @@ static void materialui_render_label_value(
|
|||||||
const char *value, float *label_color,
|
const char *value, float *label_color,
|
||||||
uint32_t sublabel_color)
|
uint32_t sublabel_color)
|
||||||
{
|
{
|
||||||
/* This will be used instead of label_color if texture_switch is 'off' icon */
|
|
||||||
float pure_white[16]= {
|
|
||||||
1.00, 1.00, 1.00, 1.00,
|
|
||||||
1.00, 1.00, 1.00, 1.00,
|
|
||||||
1.00, 1.00, 1.00, 1.00,
|
|
||||||
1.00, 1.00, 1.00, 1.00,
|
|
||||||
};
|
|
||||||
|
|
||||||
menu_entry_t entry;
|
menu_entry_t entry;
|
||||||
menu_animation_ctx_ticker_t ticker;
|
menu_animation_ctx_ticker_t ticker;
|
||||||
char label_str[255];
|
char label_str[255];
|
||||||
@ -999,6 +991,16 @@ static void materialui_render_label_value(
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (texture_switch)
|
if (texture_switch)
|
||||||
|
{
|
||||||
|
/* This will be used instead of label_color if
|
||||||
|
* texture_switch is 'off' icon */
|
||||||
|
float pure_white[16]= {
|
||||||
|
1.00, 1.00, 1.00, 1.00,
|
||||||
|
1.00, 1.00, 1.00, 1.00,
|
||||||
|
1.00, 1.00, 1.00, 1.00,
|
||||||
|
1.00, 1.00, 1.00, 1.00,
|
||||||
|
};
|
||||||
|
|
||||||
materialui_draw_icon(video_info,
|
materialui_draw_icon(video_info,
|
||||||
mui->icon_size,
|
mui->icon_size,
|
||||||
(uintptr_t)texture_switch,
|
(uintptr_t)texture_switch,
|
||||||
@ -1010,6 +1012,7 @@ static void materialui_render_label_value(
|
|||||||
1,
|
1,
|
||||||
switch_is_on ? &label_color[0] : &pure_white[0]
|
switch_is_on ? &label_color[0] : &pure_white[0]
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
menu_entry_free(&entry);
|
menu_entry_free(&entry);
|
||||||
}
|
}
|
||||||
@ -1176,36 +1179,35 @@ static void materialui_frame(void *data, video_frame_info_t *video_info)
|
|||||||
char title[255];
|
char title[255];
|
||||||
char title_buf[255];
|
char title_buf[255];
|
||||||
char title_msg[255];
|
char title_msg[255];
|
||||||
|
|
||||||
float black_bg[16] = {
|
float black_bg[16] = {
|
||||||
0, 0, 0, 0.75,
|
0, 0, 0, 0.75,
|
||||||
0, 0, 0, 0.75,
|
0, 0, 0, 0.75,
|
||||||
0, 0, 0, 0.75,
|
0, 0, 0, 0.75,
|
||||||
0, 0, 0, 0.75,
|
0, 0, 0, 0.75,
|
||||||
};
|
};
|
||||||
float pure_white[16] = {
|
|
||||||
1.00, 1.00, 1.00, 1.00,
|
|
||||||
1.00, 1.00, 1.00, 1.00,
|
|
||||||
1.00, 1.00, 1.00, 1.00,
|
|
||||||
1.00, 1.00, 1.00, 1.00,
|
|
||||||
};
|
|
||||||
float white_bg[16] = {
|
float white_bg[16] = {
|
||||||
0.98, 0.98, 0.98, 1.00,
|
0.98, 0.98, 0.98, 1.00,
|
||||||
0.98, 0.98, 0.98, 1.00,
|
0.98, 0.98, 0.98, 1.00,
|
||||||
0.98, 0.98, 0.98, 1.00,
|
0.98, 0.98, 0.98, 1.00,
|
||||||
0.98, 0.98, 0.98, 1.00,
|
0.98, 0.98, 0.98, 1.00,
|
||||||
};
|
};
|
||||||
|
|
||||||
float white_transp_bg[16] = {
|
float white_transp_bg[16] = {
|
||||||
0.98, 0.98, 0.98, 0.90,
|
0.98, 0.98, 0.98, 0.90,
|
||||||
0.98, 0.98, 0.98, 0.90,
|
0.98, 0.98, 0.98, 0.90,
|
||||||
0.98, 0.98, 0.98, 0.90,
|
0.98, 0.98, 0.98, 0.90,
|
||||||
0.98, 0.98, 0.98, 0.90,
|
0.98, 0.98, 0.98, 0.90,
|
||||||
};
|
};
|
||||||
|
|
||||||
float grey_bg[16] = {
|
float grey_bg[16] = {
|
||||||
0.78, 0.78, 0.78, 0.90,
|
0.78, 0.78, 0.78, 0.90,
|
||||||
0.78, 0.78, 0.78, 0.90,
|
0.78, 0.78, 0.78, 0.90,
|
||||||
0.78, 0.78, 0.78, 0.90,
|
0.78, 0.78, 0.78, 0.90,
|
||||||
0.78, 0.78, 0.78, 0.90,
|
0.78, 0.78, 0.78, 0.90,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* TODO/FIXME convert this over to new hex format */
|
/* TODO/FIXME convert this over to new hex format */
|
||||||
float greyish_blue[16] = {
|
float greyish_blue[16] = {
|
||||||
0.22, 0.28, 0.31, 1.00,
|
0.22, 0.28, 0.31, 1.00,
|
||||||
@ -1227,10 +1229,6 @@ static void materialui_frame(void *data, video_frame_info_t *video_info)
|
|||||||
0.00, 0.00, 0.00, 0.20,
|
0.00, 0.00, 0.00, 0.20,
|
||||||
};
|
};
|
||||||
|
|
||||||
uint32_t black_opaque_54 = 0x0000008a;
|
|
||||||
uint32_t black_opaque_87 = 0x000000de;
|
|
||||||
uint32_t white_opaque_70 = 0xffffffb3;
|
|
||||||
|
|
||||||
/* https://material.google.com/style/color.html#color-color-palette */
|
/* https://material.google.com/style/color.html#color-color-palette */
|
||||||
/* Hex values converted to RGB normalized decimals, alpha set to 1 */
|
/* Hex values converted to RGB normalized decimals, alpha set to 1 */
|
||||||
float blue_500[16] = {0};
|
float blue_500[16] = {0};
|
||||||
@ -1249,19 +1247,6 @@ static void materialui_frame(void *data, video_frame_info_t *video_info)
|
|||||||
float footer_bg_color_real[16] = {0};
|
float footer_bg_color_real[16] = {0};
|
||||||
float header_bg_color_real[16] = {0};
|
float header_bg_color_real[16] = {0};
|
||||||
|
|
||||||
file_list_t *list = NULL;
|
|
||||||
materialui_node_t *node = NULL;
|
|
||||||
unsigned width = video_info->width;
|
|
||||||
unsigned height = video_info->height;
|
|
||||||
unsigned ticker_limit = 0;
|
|
||||||
unsigned i = 0;
|
|
||||||
unsigned header_height = 0;
|
|
||||||
size_t selection = 0;
|
|
||||||
size_t title_margin = 0;
|
|
||||||
materialui_handle_t *mui = (materialui_handle_t*)data;
|
|
||||||
bool background_rendered = false;
|
|
||||||
bool libretro_running = video_info->libretro_running;
|
|
||||||
|
|
||||||
/* Default is blue theme */
|
/* Default is blue theme */
|
||||||
float *header_bg_color = NULL;
|
float *header_bg_color = NULL;
|
||||||
float *highlighted_entry_color = NULL;
|
float *highlighted_entry_color = NULL;
|
||||||
@ -1270,15 +1255,37 @@ static void materialui_frame(void *data, video_frame_info_t *video_info)
|
|||||||
float *active_tab_marker_color = NULL;
|
float *active_tab_marker_color = NULL;
|
||||||
float *passive_tab_icon_color = grey_bg;
|
float *passive_tab_icon_color = grey_bg;
|
||||||
|
|
||||||
|
file_list_t *list = NULL;
|
||||||
|
materialui_node_t *node = NULL;
|
||||||
|
|
||||||
|
unsigned width = video_info->width;
|
||||||
|
unsigned height = video_info->height;
|
||||||
|
unsigned ticker_limit = 0;
|
||||||
|
unsigned i = 0;
|
||||||
|
unsigned header_height = 0;
|
||||||
uint32_t sublabel_color = 0x888888ff;
|
uint32_t sublabel_color = 0x888888ff;
|
||||||
uint32_t font_normal_color = 0;
|
uint32_t font_normal_color = 0;
|
||||||
uint32_t font_hover_color = 0;
|
uint32_t font_hover_color = 0;
|
||||||
uint32_t font_header_color = 0;
|
uint32_t font_header_color = 0;
|
||||||
size_t usable_width = width - (mui->margin * 2);
|
|
||||||
|
uint32_t black_opaque_54 = 0x0000008a;
|
||||||
|
uint32_t black_opaque_87 = 0x000000de;
|
||||||
|
uint32_t white_opaque_70 = 0xffffffb3;
|
||||||
|
|
||||||
|
size_t usable_width = 0;
|
||||||
|
size_t selection = 0;
|
||||||
|
size_t title_margin = 0;
|
||||||
|
|
||||||
|
bool background_rendered = false;
|
||||||
|
bool libretro_running = video_info->libretro_running;
|
||||||
|
|
||||||
|
materialui_handle_t *mui = (materialui_handle_t*)data;
|
||||||
|
|
||||||
if (!mui)
|
if (!mui)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
usable_width = width - (mui->margin * 2);
|
||||||
|
|
||||||
mui->frame_count++;
|
mui->frame_count++;
|
||||||
|
|
||||||
msg[0] = title[0] = title_buf[0] = title_msg[0] = '\0';
|
msg[0] = title[0] = title_buf[0] = title_msg[0] = '\0';
|
||||||
@ -1449,7 +1456,7 @@ static void materialui_frame(void *data, video_frame_info_t *video_info)
|
|||||||
draw.matrix_data = NULL;
|
draw.matrix_data = NULL;
|
||||||
draw.texture = menu_display_white_texture;
|
draw.texture = menu_display_white_texture;
|
||||||
draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP;
|
draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP;
|
||||||
draw.color = &body_bg_color[0];
|
draw.color = body_bg_color ? &body_bg_color[0] : NULL;
|
||||||
draw.vertex = NULL;
|
draw.vertex = NULL;
|
||||||
draw.tex_coord = NULL;
|
draw.tex_coord = NULL;
|
||||||
draw.vertex_count = 4;
|
draw.vertex_count = 4;
|
||||||
@ -1520,7 +1527,7 @@ static void materialui_frame(void *data, video_frame_info_t *video_info)
|
|||||||
node->line_height,
|
node->line_height,
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
&highlighted_entry_color[0]
|
highlighted_entry_color ? &highlighted_entry_color[0] : NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
font_driver_bind_block(mui->font, &mui->raster_block);
|
font_driver_bind_block(mui->font, &mui->raster_block);
|
||||||
@ -1534,7 +1541,7 @@ static void materialui_frame(void *data, video_frame_info_t *video_info)
|
|||||||
height,
|
height,
|
||||||
font_normal_color,
|
font_normal_color,
|
||||||
font_hover_color,
|
font_hover_color,
|
||||||
&active_tab_marker_color[0],
|
active_tab_marker_color ? &active_tab_marker_color[0] : NULL,
|
||||||
sublabel_color
|
sublabel_color
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -1542,7 +1549,9 @@ static void materialui_frame(void *data, video_frame_info_t *video_info)
|
|||||||
video_info);
|
video_info);
|
||||||
font_driver_bind_block(mui->font, NULL);
|
font_driver_bind_block(mui->font, NULL);
|
||||||
|
|
||||||
font_driver_flush(video_info->width, video_info->height, mui->font2,
|
font_driver_flush(video_info->width,
|
||||||
|
video_info->height,
|
||||||
|
mui->font2,
|
||||||
video_info);
|
video_info);
|
||||||
font_driver_bind_block(mui->font2, NULL);
|
font_driver_bind_block(mui->font2, NULL);
|
||||||
|
|
||||||
@ -1557,7 +1566,7 @@ static void materialui_frame(void *data, video_frame_info_t *video_info)
|
|||||||
header_height,
|
header_height,
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
&header_bg_color[0]);
|
header_bg_color ? &header_bg_color[0] : NULL);
|
||||||
|
|
||||||
mui->tabs_height = 0;
|
mui->tabs_height = 0;
|
||||||
|
|
||||||
@ -1592,6 +1601,13 @@ static void materialui_frame(void *data, video_frame_info_t *video_info)
|
|||||||
|
|
||||||
if (menu_entries_ctl(MENU_ENTRIES_CTL_SHOW_BACK, NULL))
|
if (menu_entries_ctl(MENU_ENTRIES_CTL_SHOW_BACK, NULL))
|
||||||
{
|
{
|
||||||
|
float pure_white[16] = {
|
||||||
|
1.00, 1.00, 1.00, 1.00,
|
||||||
|
1.00, 1.00, 1.00, 1.00,
|
||||||
|
1.00, 1.00, 1.00, 1.00,
|
||||||
|
1.00, 1.00, 1.00, 1.00,
|
||||||
|
};
|
||||||
|
|
||||||
title_margin = mui->icon_size;
|
title_margin = mui->icon_size;
|
||||||
materialui_draw_icon(video_info,
|
materialui_draw_icon(video_info,
|
||||||
mui->icon_size,
|
mui->icon_size,
|
||||||
|
@ -141,19 +141,19 @@ bool menu_shader_manager_init(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string_is_empty(new_path))
|
if (
|
||||||
{
|
!string_is_empty(new_path) && conf &&
|
||||||
if (conf)
|
video_shader_read_conf_cgp(conf, menu_driver_shader)
|
||||||
{
|
)
|
||||||
if (video_shader_read_conf_cgp(conf, menu_driver_shader))
|
|
||||||
{
|
{
|
||||||
video_shader_resolve_relative(menu_driver_shader, new_path);
|
video_shader_resolve_relative(menu_driver_shader, new_path);
|
||||||
video_shader_resolve_parameters(conf, menu_driver_shader);
|
video_shader_resolve_parameters(conf, menu_driver_shader);
|
||||||
}
|
}
|
||||||
config_file_free(conf);
|
|
||||||
}
|
if (new_path)
|
||||||
free(new_path);
|
free(new_path);
|
||||||
}
|
if (conf)
|
||||||
|
config_file_free(conf);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user