From e543aa25ae0c97cafbafa6c7b9c8190f9ac2698a Mon Sep 17 00:00:00 2001 From: libretroadmin Date: Sat, 20 Jul 2024 15:46:26 +0200 Subject: [PATCH] Silence some warnings --- file_path_special.c | 7 ++-- gfx/drivers/gl2.c | 6 +-- gfx/drivers/gx_gfx.c | 7 ++-- gfx/drivers/rsx_gfx.c | 4 -- gfx/drivers/switch_nx_gfx.c | 71 ++++++++++++++++------------------ input/drivers_hid/wiiusb_hid.c | 8 ++-- input/input_driver.c | 7 ++-- menu/cbs/menu_cbs_sublabel.c | 6 ++- menu/menu_displaylist.c | 8 ++-- retroarch.c | 18 ++++----- 10 files changed, 67 insertions(+), 75 deletions(-) diff --git a/file_path_special.c b/file_path_special.c index 91516971d2..60bc7ac134 100644 --- a/file_path_special.c +++ b/file_path_special.c @@ -263,7 +263,7 @@ void fill_pathname_application_special(char *s, else #endif #if defined(HAVE_MATERIALUI) || defined(HAVE_OZONE) - if ( string_is_equal(menu_ident, "glui") + if ( string_is_equal(menu_ident, "glui") || string_is_equal(menu_ident, "ozone")) { char s4[PATH_MAX_LENGTH]; @@ -283,8 +283,8 @@ void fill_pathname_application_special(char *s, case APPLICATION_SPECIAL_DIRECTORY_ASSETS_SYSICONS: { #ifdef HAVE_MENU - settings_t *settings = config_get_ptr(); #if defined(HAVE_XMB) || defined(HAVE_MATERIALUI) || defined(HAVE_OZONE) + settings_t *settings = config_get_ptr(); const char *menu_ident = settings->arrays.menu_driver; #endif @@ -321,8 +321,7 @@ void fill_pathname_application_special(char *s, } else #endif - if (len) - s[0] = '\0'; + if (len) s[0] = '\0'; #endif } diff --git a/gfx/drivers/gl2.c b/gfx/drivers/gl2.c index a6c3d29693..471fec2e5b 100644 --- a/gfx/drivers/gl2.c +++ b/gfx/drivers/gl2.c @@ -1274,7 +1274,7 @@ static void gl2_set_viewport(gl2_t *gl, { settings_t *settings = config_get_ptr(); float device_aspect = (float) viewport_width / (float)viewport_height; - + if (gl->ctx_driver->translate_aspect) device_aspect = gl->ctx_driver->translate_aspect( gl->ctx_data, viewport_width, viewport_height); @@ -3380,8 +3380,6 @@ static bool gl2_frame(void *data, const void *frame, bool use_rgba = (video_info->video_st_flags & VIDEO_FLAG_USE_RGBA) ? true : false; bool statistics_show = video_info->statistics_show; bool msg_bgcolor_enable = video_info->msg_bgcolor_enable; - int bfi_light_frames; - unsigned n; bool input_driver_nonblock_state = video_info->input_driver_nonblock_state; bool hard_sync = video_info->hard_sync; unsigned hard_sync_frames = video_info->hard_sync_frames; @@ -3667,6 +3665,8 @@ static bool gl2_frame(void *data, const void *frame, && !video_info->runloop_is_paused && !(gl->flags & GL2_FLAG_MENU_TEXTURE_ENABLE)) { + unsigned n; + int bfi_light_frames; if (video_info->bfi_dark_frames > video_info->black_frame_insertion) video_info->bfi_dark_frames = video_info->black_frame_insertion; diff --git a/gfx/drivers/gx_gfx.c b/gfx/drivers/gx_gfx.c index c82b589155..da7fce023e 100644 --- a/gfx/drivers/gx_gfx.c +++ b/gfx/drivers/gx_gfx.c @@ -990,7 +990,6 @@ static void gx_resize(gx_video_t *gx, float top = 1, bottom = -1, left = -1, right = 1; int x = 0, y = 0; const global_t *global = global_get_ptr(); - settings_t *settings = config_get_ptr(); unsigned width = gx->vp.full_width; unsigned height = gx->vp.full_height; @@ -1024,9 +1023,9 @@ static void gx_resize(gx_video_t *gx, || (gx->orientation == ORIENTATION_FLIPPED_ROTATED)) desired_aspect = 1.0 / desired_aspect; video_viewport_get_scaled_aspect2(&gx->vp, width, height, true, device_aspect, desired_aspect); - x = gx->vp.x; - y = gx->vp.y; - width = gx->vp.width; + x = gx->vp.x; + y = gx->vp.y; + width = gx->vp.width; height = gx->vp.height; } diff --git a/gfx/drivers/rsx_gfx.c b/gfx/drivers/rsx_gfx.c index 793e532838..27f37d5944 100644 --- a/gfx/drivers/rsx_gfx.c +++ b/gfx/drivers/rsx_gfx.c @@ -983,14 +983,10 @@ static void rsx_set_viewport(void *data, unsigned viewport_width, { int i; rsx_viewport_t vp; - int x = 0; - int y = 0; - float device_aspect = (float)viewport_width / viewport_height; struct video_ortho ortho = {0, 1, 0, 1, -1, 1}; settings_t *settings = config_get_ptr(); rsx_t *rsx = (rsx_t*)data; bool video_scale_integer = settings->bools.video_scale_integer; - unsigned aspect_ratio_idx = settings->uints.video_aspect_ratio_idx; if (video_scale_integer && !force_full) { diff --git a/gfx/drivers/switch_nx_gfx.c b/gfx/drivers/switch_nx_gfx.c index c679c7ebab..eb4db8bee7 100644 --- a/gfx/drivers/switch_nx_gfx.c +++ b/gfx/drivers/switch_nx_gfx.c @@ -549,20 +549,18 @@ static void switch_update_viewport(switch_video_t *sw, video_frame_info_t *video_info) { settings_t *settings = config_get_ptr(); - int x = 0; - int y = 0; float desired_aspect = 0.0f; float width = sw->vp.full_width; float height = sw->vp.full_height; if (sw->o_size) { - width = sw->o_width; - height = sw->o_height; - sw->vp.x = (int)(((float)sw->vp.full_width - width)) / 2; - sw->vp.y = (int)(((float)sw->vp.full_height - height)) / 2; + width = sw->o_width; + height = sw->o_height; + sw->vp.x = (int)(((float)sw->vp.full_width - width)) / 2; + sw->vp.y = (int)(((float)sw->vp.full_height - height)) / 2; - sw->vp.width = width; + sw->vp.width = width; sw->vp.height = height; return; @@ -570,19 +568,16 @@ static void switch_update_viewport(switch_video_t *sw, desired_aspect = video_driver_get_aspect_ratio(); + /* TODO/FIXME: Does nx use top-left or bottom-left origin? I'm assuming top left. */ if (settings->bools.video_scale_integer) - { - /* TODO: Does nx use top-left or bottom-left origin? I'm assuming top left. */ - video_viewport_get_scaled_integer(&sw->vp, sw->vp.full_width, sw->vp.full_height, desired_aspect, sw->keep_aspect, true); - } + video_viewport_get_scaled_integer(&sw->vp, sw->vp.full_width, sw->vp.full_height, + desired_aspect, sw->keep_aspect, true); else if (sw->keep_aspect) - { - video_viewport_get_scaled_aspect(&sw->vp, width, height, true); - } + video_viewport_get_scaled_aspect(&sw->vp, width, height, true); else { - sw->vp.x = sw->vp.y = 0; - sw->vp.width = width; + sw->vp.x = sw->vp.y = 0; + sw->vp.width = width; sw->vp.height = height; } } @@ -648,9 +643,9 @@ static bool switch_frame(void *data, const void *frame, return true; } - if ( sw->should_resize || - width != sw->last_width || - height != sw->last_height) + if ( sw->should_resize + || (width != sw->last_width) + || (height != sw->last_height)) { switch_update_viewport(sw, video_info); @@ -669,21 +664,21 @@ static bool switch_frame(void *data, const void *frame, if (!sw->smooth) { - sw->scaler.out_width = sw->vp.width; + sw->scaler.out_width = sw->vp.width; sw->scaler.out_height = sw->vp.height; sw->scaler.out_stride = sw->vp.full_width * sizeof(uint32_t); } else { - sw->scaler.out_width = width; + sw->scaler.out_width = width; sw->scaler.out_height = height; sw->scaler.out_stride = width * sizeof(uint32_t); - float screen_ratio = (float)sw->vp.full_width / sw->vp.full_height; - float tgt_ratio = (float)sw->vp.width / sw->vp.height; + float screen_ratio = (float)sw->vp.full_width / sw->vp.full_height; + float tgt_ratio = (float)sw->vp.width / sw->vp.height; - sw->hw_scale.width = ceil(screen_ratio / tgt_ratio * sw->scaler.out_width); - sw->hw_scale.height = sw->scaler.out_height; + sw->hw_scale.width = ceil(screen_ratio / tgt_ratio * sw->scaler.out_width); + sw->hw_scale.height = sw->scaler.out_height; sw->hw_scale.x_offset = ceil((sw->hw_scale.width - sw->scaler.out_width) / 2.0); #ifdef HAVE_MENU if (!menu_is_alive) @@ -693,20 +688,20 @@ static bool switch_frame(void *data, const void *frame, nwindowSetDimensions(sw->win, sw->hw_scale.width, sw->hw_scale.height); } } - sw->scaler.out_fmt = SCALER_FMT_ABGR8888; + sw->scaler.out_fmt = SCALER_FMT_ABGR8888; sw->scaler.scaler_type = SCALER_TYPE_POINT; if (!scaler_ctx_gen_filter(&sw->scaler)) return false; - sw->last_width = width; - sw->last_height = height; + sw->last_width = width; + sw->last_height = height; - sw->should_resize = false; + sw->should_resize = false; } - out_buffer = (uint32_t *)framebufferBegin(&sw->fb, &stride); + out_buffer = (uint32_t*)framebufferBegin(&sw->fb, &stride); sw->out_buffer = out_buffer; sw->stride = stride; @@ -726,7 +721,10 @@ static bool switch_frame(void *data, const void *frame, if (sw->menu_texture.pixels) { memset(out_buffer, 0, stride * sw->vp.full_height); - scaler_ctx_scale(&sw->menu_texture.scaler, sw->tmp_image + ((sw->vp.full_height - sw->menu_texture.tgth) / 2) * sw->vp.full_width + ((sw->vp.full_width - sw->menu_texture.tgtw) / 2), sw->menu_texture.pixels); + scaler_ctx_scale(&sw->menu_texture.scaler, + sw->tmp_image + ((sw->vp.full_height - sw->menu_texture.tgth) / 2) + * sw->vp.full_width + ((sw->vp.full_width - sw->menu_texture.tgtw) / 2), + sw->menu_texture.pixels); gfx_cpy_dsp_buf(out_buffer, sw->tmp_image, sw->vp.full_width, sw->vp.full_height, stride, true); } } @@ -821,9 +819,9 @@ static void switch_set_texture_frame( switch_video_t *sw = data; size_t sz = width * height * (rgb32 ? 4 : 2); - if (!sw->menu_texture.pixels || - sw->menu_texture.width != width || - sw->menu_texture.height != height) + if ( !sw->menu_texture.pixels + || (sw->menu_texture.width != width) + || (sw->menu_texture.height != height)) { int xsf, ysf, sf; struct scaler_ctx *sctx = NULL; @@ -869,10 +867,7 @@ static void switch_set_texture_frame( memcpy(sw->menu_texture.pixels, frame, sz); } -static void switch_apply_state_changes(void *data) -{ - (void)data; -} +static void switch_apply_state_changes(void *data) { } static void switch_set_texture_enable(void *data, bool enable, bool full_screen) { diff --git a/input/drivers_hid/wiiusb_hid.c b/input/drivers_hid/wiiusb_hid.c index 836f266288..4756d5e273 100644 --- a/input/drivers_hid/wiiusb_hid.c +++ b/input/drivers_hid/wiiusb_hid.c @@ -310,7 +310,7 @@ static int wiiusb_hid_add_adapter(void *data, usb_device_entry *dev) /* Allocate mem for the send control buffer, 32bit aligned */ adapter->send_control_type = WIIUSB_SC_NONE; - adapter->send_control_buffer = memalign(32, 128); + adapter->send_control_buffer = (uint8_t*)memalign(32, 128); if (!adapter->send_control_buffer) { @@ -333,7 +333,7 @@ static int wiiusb_hid_add_adapter(void *data, usb_device_entry *dev) goto error; } - adapter->data = memalign(32, 128); + adapter->data = (uint8_t*)memalign(32, 128); adapter->hid = hid; adapter->next = hid->adapters_head; hid->adapters_head = adapter; @@ -551,11 +551,11 @@ static int16_t wiiusb_hid_joypad_state( const uint32_t joyaxis = (binds[i].joyaxis != AXIS_NONE) ? binds[i].joyaxis : joypad_info->auto_binds[i].joyaxis; if ( - (uint16_t)joykey != NO_BTN + (uint16_t)joykey != NO_BTN && wiiusb_hid_joypad_button(data, port_idx, (uint16_t)joykey)) ret |= ( 1 << i); else if (joyaxis != AXIS_NONE && - ((float)abs(wiiusb_hid_joypad_axis(data, port_idx, joyaxis)) + ((float)abs(wiiusb_hid_joypad_axis(data, port_idx, joyaxis)) / 0x8000) > joypad_info->axis_threshold) ret |= (1 << i); } diff --git a/input/input_driver.c b/input/input_driver.c index 76a2c278cd..1f80f94db1 100644 --- a/input/input_driver.c +++ b/input/input_driver.c @@ -47,16 +47,17 @@ #include "../accessibility.h" #include "../command.h" #include "../config.def.keybinds.h" -#include "../driver.h" -#include "../retroarch.h" -#include "../verbosity.h" #include "../configuration.h" +#include "../driver.h" +#include "../frontend/frontend_driver.h" #include "../list_special.h" #include "../performance_counters.h" +#include "../retroarch.h" #ifdef HAVE_BSV_MOVIE #include "../tasks/task_content.h" #endif #include "../tasks/tasks_internal.h" +#include "../verbosity.h" #define HOLD_BTN_DELAY_SEC 2 diff --git a/menu/cbs/menu_cbs_sublabel.c b/menu/cbs/menu_cbs_sublabel.c index 43058d5ea7..cc74c0d446 100644 --- a/menu/cbs/menu_cbs_sublabel.c +++ b/menu/cbs/menu_cbs_sublabel.c @@ -104,7 +104,6 @@ static int menu_action_sublabel_contentless_core(file_list_t *list, const char *core_path = path; core_info_t *core_info = NULL; const contentless_core_info_entry_t *entry = NULL; - const char *menu_ident = menu_driver_ident(); bool display_runtime = true; settings_t *settings = config_get_ptr(); bool playlist_show_sublabels = settings->bools.playlist_show_sublabels; @@ -121,6 +120,9 @@ static int menu_action_sublabel_contentless_core(file_list_t *list, menu_timedate_date_separator = (enum playlist_sublabel_last_played_date_separator_type) settings->uints.menu_timedate_date_separator; +#if defined(HAVE_OZONE) || defined(HAVE_MATERIALUI) + const char *menu_ident = menu_driver_ident(); +#endif if (playlist_show_sublabels) { @@ -5056,7 +5058,7 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs, break; case MENU_ENUM_LABEL_CLOUD_SYNC_SYNC_CONFIGS: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_cloud_sync_sync_configs); - break; + break; case MENU_ENUM_LABEL_CLOUD_SYNC_DRIVER: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_cloud_sync_driver); break; diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index a7859c6660..887532c5d4 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -15095,20 +15095,20 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, _len += strlcpy(new_exts + _len, "bmp", sizeof(new_exts) - _len); #endif #ifdef HAVE_RPNG - if (new_exts[_len-1] != '\0') + if (_len > 0 && (new_exts[_len-1] != '\0')) _len += strlcpy(new_exts + _len, "|", sizeof(new_exts) - _len); _len += strlcpy(new_exts + _len, "png", sizeof(new_exts) - _len); #endif #ifdef HAVE_RJPEG - if (new_exts[_len-1] != '\0') + if (_len > 0 && (new_exts[_len-1] != '\0')) _len += strlcpy(new_exts + _len, "|", sizeof(new_exts) - _len); _len += strlcpy(new_exts + _len, "jpeg", sizeof(new_exts) - _len); - if (new_exts[_len-1] != '\0') + if (_len > 0 && (new_exts[_len-1] != '\0')) _len += strlcpy(new_exts + _len, "|", sizeof(new_exts) - _len); _len += strlcpy(new_exts + _len, "jpg", sizeof(new_exts) - _len); #endif #ifdef HAVE_RTGA - if (new_exts[_len-1] != '\0') + if (_len > 0 && (new_exts[_len-1] != '\0')) _len += strlcpy(new_exts + _len, "|", sizeof(new_exts) - _len); _len += strlcpy(new_exts + _len, "tga", sizeof(new_exts) - _len); #endif diff --git a/retroarch.c b/retroarch.c index 06821a8bc6..c12ccb27c8 100644 --- a/retroarch.c +++ b/retroarch.c @@ -2168,7 +2168,6 @@ struct string_list *dir_list_new_special(const char *input_dir, char ext_shaders[255]; #endif char ext_name[16]; - size_t _len = 0; const char *exts = NULL; bool recursive = false; @@ -2197,34 +2196,35 @@ struct string_list *dir_list_new_special(const char *input_dir, case DIR_LIST_SHADERS: #if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_SLANG) || defined(HAVE_HLSL) { - ext_shaders[0] = '\0'; + size_t _len = 0; + ext_shaders[0] = '\0'; if (video_shader_is_supported(RARCH_SHADER_CG)) { _len += strlcpy(ext_shaders + _len, "cgp", sizeof(ext_shaders) - _len); if (ext_shaders[_len-1] != '\0') _len += strlcpy(ext_shaders + _len, "|", sizeof(ext_shaders) - _len); - _len += strlcpy(ext_shaders + _len, "cg", sizeof(ext_shaders) - _len); + _len += strlcpy(ext_shaders + _len, "cg", sizeof(ext_shaders) - _len); } if (video_shader_is_supported(RARCH_SHADER_GLSL)) { if (ext_shaders[_len-1] != '\0') - _len += strlcpy(ext_shaders + _len, "|", sizeof(ext_shaders) - _len); + _len += strlcpy(ext_shaders + _len, "|", sizeof(ext_shaders) - _len); _len += strlcpy(ext_shaders + _len, "glslp", sizeof(ext_shaders) - _len); if (ext_shaders[_len-1] != '\0') - _len += strlcpy(ext_shaders + _len, "|", sizeof(ext_shaders) - _len); - _len += strlcpy(ext_shaders + _len, "glsl", sizeof(ext_shaders) - _len); + _len += strlcpy(ext_shaders + _len, "|", sizeof(ext_shaders) - _len); + _len += strlcpy(ext_shaders + _len, "glsl", sizeof(ext_shaders) - _len); } if (video_shader_is_supported(RARCH_SHADER_SLANG)) { if (ext_shaders[_len-1] != '\0') - _len += strlcpy(ext_shaders + _len, "|", sizeof(ext_shaders) - _len); + _len += strlcpy(ext_shaders + _len, "|", sizeof(ext_shaders) - _len); _len += strlcpy(ext_shaders + _len, "slangp", sizeof(ext_shaders) - _len); if (ext_shaders[_len-1] != '\0') - _len += strlcpy(ext_shaders + _len, "|", sizeof(ext_shaders) - _len); - _len += strlcpy(ext_shaders + _len, "slang", sizeof(ext_shaders) - _len); + _len += strlcpy(ext_shaders + _len, "|", sizeof(ext_shaders) - _len); + _len += strlcpy(ext_shaders + _len, "slang", sizeof(ext_shaders) - _len); } exts = ext_shaders;