(macOS) Less warnings with static code analysis

This commit is contained in:
Twinaphex 2019-06-24 15:03:58 +02:00
parent c8486a5081
commit d2fd4d48ae
5 changed files with 22 additions and 18 deletions

View File

@ -320,7 +320,7 @@ unsigned ozone_get_selected_sidebar_y_position(ozone_handle_t *ozone)
unsigned ozone_get_sidebar_height(ozone_handle_t *ozone)
{
int entries = (ozone->system_tab_end + 1 + (ozone->horizontal_list ? ozone->horizontal_list->size : 0));
int entries = (int)(ozone->system_tab_end + 1 + (ozone->horizontal_list ? ozone->horizontal_list->size : 0));
return entries * ozone->dimensions.sidebar_entry_height + (entries - 1) * ozone->dimensions.sidebar_entry_padding_vertical + ozone->dimensions.sidebar_padding_vertical +
(ozone->horizontal_list && ozone->horizontal_list->size > 0 ? ozone->dimensions.sidebar_entry_padding_vertical + 1 : 0);
}

View File

@ -2973,8 +2973,8 @@ static void rgui_render_osk(rgui_t *rgui, menu_animation_ctx_ticker_t *ticker)
/* Draw keyboard 'keys' */
for (key_index = 0; key_index < 44; key_index++)
{
unsigned key_row = key_index / OSK_CHARS_PER_LINE;
unsigned key_column = key_index - (key_row * OSK_CHARS_PER_LINE);
unsigned key_row = (unsigned)(key_index / OSK_CHARS_PER_LINE);
unsigned key_column = (unsigned)(key_index - (key_row * OSK_CHARS_PER_LINE));
int key_text_x = osk_x + keyboard_offset_x + key_text_offset_x + (key_column * key_width);
int key_text_y = osk_y + keyboard_offset_y + key_text_offset_y + (key_row * key_height);
@ -3259,21 +3259,21 @@ static void rgui_render(void *data, bool is_idle)
else
{
/* Render usual text */
size_t selection = menu_navigation_get_selection();
size_t selection = menu_navigation_get_selection();
char title_buf[255];
size_t title_max_len;
size_t title_len;
unsigned title_x;
unsigned title_y = rgui_term_layout.start_y - FONT_HEIGHT_STRIDE;
unsigned term_end_x = rgui_term_layout.start_x + (rgui_term_layout.width * FONT_WIDTH_STRIDE);
unsigned timedate_x = term_end_x - (5 * FONT_WIDTH_STRIDE);
unsigned core_name_len = ((timedate_x - rgui_term_layout.start_x) / FONT_WIDTH_STRIDE) - 3;
bool show_mini_thumbnails = rgui->is_playlist && settings->bools.menu_rgui_inline_thumbnails;
bool show_thumbnail = false;
bool show_left_thumbnail = false;
unsigned title_y = rgui_term_layout.start_y - FONT_HEIGHT_STRIDE;
unsigned term_end_x = rgui_term_layout.start_x + (rgui_term_layout.width * FONT_WIDTH_STRIDE);
unsigned timedate_x = term_end_x - (5 * FONT_WIDTH_STRIDE);
unsigned core_name_len = ((timedate_x - rgui_term_layout.start_x) / FONT_WIDTH_STRIDE) - 3;
bool show_mini_thumbnails = rgui->is_playlist && settings->bools.menu_rgui_inline_thumbnails;
bool show_thumbnail = false;
bool show_left_thumbnail = false;
unsigned thumbnail_panel_width = 0;
unsigned term_mid_point = 0;
size_t powerstate_len = 0;
unsigned term_mid_point = 0;
size_t powerstate_len = 0;
/* Cache mini thumbnail related parameters, if required */
if (show_mini_thumbnails)
@ -3433,7 +3433,7 @@ static void rgui_render(void *data, bool is_idle)
if (show_mini_thumbnails)
{
unsigned term_offset = settings->bools.menu_rgui_swap_thumbnails ?
(rgui_term_layout.height - (i - new_start) - 1) : (i - new_start);
(unsigned)(rgui_term_layout.height - (i - new_start) - 1) : (i - new_start);
unsigned thumbnail_width = 0;
/* Note:

View File

@ -359,7 +359,7 @@ static void menu_animation_ticker_loop(uint64_t idx,
offset = (phase < (int)str_width) ? phase : 0;
width = (int)(str_width - phase);
width = (width < 0) ? 0 : width;
width = (width > (int)max_width) ? max_width : width;
width = (width > (int)max_width) ? (int)max_width : width;
*offset1 = offset;
*width1 = width;
@ -368,14 +368,14 @@ static void menu_animation_ticker_loop(uint64_t idx,
offset = (int)(phase - str_width);
offset = offset < 0 ? 0 : offset;
width = (int)(max_width - *width1);
width = (width > (int)spacer_width) ? spacer_width : width;
width = (width > (int)spacer_width) ? (int)spacer_width : width;
width = width - offset;
*offset2 = offset;
*width2 = width;
/* String 3 */
width = max_width - (*width1 + *width2);
width = (int)(max_width - (*width1 + *width2));
width = width < 0 ? 0 : width;
/* Note: offset is always zero here so offset3 is

View File

@ -521,6 +521,7 @@ static int setting_bind_action_start(rarch_setting_t *setting)
return 0;
}
#if 0
static void setting_get_string_representation_hex(rarch_setting_t *setting,
char *s, size_t len)
{
@ -528,6 +529,7 @@ static void setting_get_string_representation_hex(rarch_setting_t *setting,
snprintf(s, len, "%08x",
*setting->value.target.unsigned_integer);
}
#endif
void setting_get_string_representation_hex_and_uint(rarch_setting_t *setting,
char *s, size_t len)
@ -1512,6 +1514,7 @@ static rarch_setting_t setting_size_setting(const char* name,
*
* Returns: setting of type ST_HEX.
**/
#if 0
static rarch_setting_t setting_hex_setting(const char* name,
const char* short_description, unsigned int* target,
unsigned int default_value,
@ -1573,6 +1576,7 @@ static rarch_setting_t setting_hex_setting(const char* name,
return result;
}
#endif
/**
* setting_bind_setting:

View File

@ -557,7 +557,7 @@ static void menu_widgets_msg_queue_move(void)
if (current_msgs->size == 0)
return;
for (i = current_msgs->size-1; i >= 0; i--)
for (i = (int)(current_msgs->size-1); i >= 0; i--)
{
menu_widget_msg_t *msg = (menu_widget_msg_t*)
file_list_get_userdata_at_offset(current_msgs, i);