Silence unused variable warnings

This commit is contained in:
libretroadmin 2024-09-11 15:48:25 +02:00
parent dd489312ea
commit 23bd9686e5
4 changed files with 95 additions and 90 deletions

View File

@ -2321,13 +2321,12 @@ static void rc_hash_reset_cdreader_hooks(void)
static void rcheevos_show_game_placard(void)
{
size_t len;
char msg[256];
int len;
const settings_t* settings = config_get_ptr();
rc_client_user_game_summary_t summary;
const settings_t* settings = config_get_ptr();
const rc_client_game_t* game = rc_client_get_game_info(rcheevos_locals.client);
if (!game) /* make sure there's actually a game loaded */
if (!game) /* Make sure there's actually a game loaded */
return;
rc_client_get_user_game_summary(rcheevos_locals.client, &summary);
@ -2342,18 +2341,14 @@ static void rcheevos_show_game_placard(void)
(int)summary.num_unofficial_achievements);
}
else if (rc_client_get_encore_mode_enabled(rcheevos_locals.client))
{
len = snprintf(msg, sizeof(msg),
msg_hash_to_str(MSG_CHEEVOS_ALL_ACHIEVEMENTS_ACTIVATED),
(int)summary.num_core_achievements);
}
else
{
len = snprintf(msg, sizeof(msg),
msg_hash_to_str(MSG_CHEEVOS_NUMBER_ACHIEVEMENTS_UNLOCKED),
(int)summary.num_unlocked_achievements,
(int)summary.num_core_achievements);
}
if (summary.num_unsupported_achievements)
{
@ -2377,21 +2372,23 @@ static void rcheevos_show_game_placard(void)
msg[sizeof(msg) - 1] = 0;
CHEEVOS_LOG(RCHEEVOS_TAG "%s\n", msg);
if (settings->uints.cheevos_visibility_summary == RCHEEVOS_SUMMARY_ALLGAMES ||
(settings->uints.cheevos_visibility_summary == RCHEEVOS_SUMMARY_HASCHEEVOS &&
(summary.num_core_achievements || summary.num_unofficial_achievements)))
if ( settings->uints.cheevos_visibility_summary == RCHEEVOS_SUMMARY_ALLGAMES
|| (settings->uints.cheevos_visibility_summary == RCHEEVOS_SUMMARY_HASCHEEVOS
&& (summary.num_core_achievements || summary.num_unofficial_achievements)))
{
#if defined (HAVE_GFX_WIDGETS)
if (gfx_widgets_ready())
{
char badge_name[32];
size_t _len = strlcpy(badge_name, "i", sizeof(badge_name));
_len += strlcpy(badge_name + _len, game->badge_name, sizeof(badge_name) - _len);
_len += strlcpy(badge_name + _len, game->badge_name,
sizeof(badge_name) - _len);
gfx_widgets_push_achievement(game->title, msg, badge_name);
}
else
#endif
runloop_msg_queue_push(msg, 0, 3 * 60, false, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
runloop_msg_queue_push(msg, 0, 3 * 60, false, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
}

View File

@ -910,7 +910,6 @@ static struct video_shader_parameter *video_shader_parse_find_parameter(
void video_shader_resolve_parameters(struct video_shader *shader)
{
size_t i;
struct video_shader_parameter *param = &shader->parameters[0];
shader->num_parameters = 0;
@ -919,6 +918,20 @@ void video_shader_resolve_parameters(struct video_shader *shader)
RARCH_DBG("[Shaders]: Finding parameters in shader passes (#pragma parameter)..\n");
#endif
#if defined(HAVE_SLANG) && defined(HAVE_SPIRV_CROSS)
for (i = 0; i < shader->passes; i++)
{
const char *path = shader->pass[i].source.path;
if (string_is_empty(path) || !path_is_valid(path))
continue;
/* Now uses the same slang parsing for parameters since
* it should be the same implementation, but supporting
* #include directives */
slang_preprocess_parse_parameters(path, shader);
}
#else
{
struct video_shader_parameter *param = &shader->parameters[0];
for (i = 0; i < shader->passes; i++)
{
const char *path = shader->pass[i].source.path;
@ -928,12 +941,6 @@ void video_shader_resolve_parameters(struct video_shader *shader)
if (string_is_empty(path) || !path_is_valid(path))
continue;
#if defined(HAVE_SLANG) && defined(HAVE_SPIRV_CROSS)
/* Now uses the same slang parsing for parameters since
* it should be the same implementation, but supporting
* #include directives */
slang_preprocess_parse_parameters(path, shader);
#else
/* Read file contents */
if (filestream_read_file(path, (void**)&buf, &buf_len))
{
@ -998,8 +1005,9 @@ void video_shader_resolve_parameters(struct video_shader *shader)
string_list_deinitialize(&lines);
}
#endif
}
}
#endif
}
@ -1127,9 +1135,9 @@ static bool video_shader_write_root_preset(const struct video_shader *shader,
char *tmp = (char*)malloc(3 * PATH_MAX_LENGTH);
char *tmp_rel = tmp + PATH_MAX_LENGTH;
char *tmp_base = tmp + 2 * PATH_MAX_LENGTH;
config_file_t *conf = NULL;
config_file_t *conf = config_file_new_alloc();
if (!(conf = config_file_new_alloc()))
if (!conf)
return false;
if (!tmp)
@ -1454,12 +1462,12 @@ static bool video_shader_write_referenced_preset(
const char *path_to_save)
{
size_t i;
char config_dir[DIR_MAX_LENGTH];
config_file_t *conf = NULL;
config_file_t *ref_conf = NULL;
struct video_shader *ref_shader = (struct video_shader*)
calloc(1, sizeof(*ref_shader));
bool ret = false;
char *config_dir = (char*)malloc(DIR_MAX_LENGTH);
char *path_to_ref = (char*)malloc(PATH_MAX_LENGTH);
char* path_to_save_conformed = (char*)malloc(PATH_MAX_LENGTH);
@ -1880,7 +1888,6 @@ end:
config_file_free(conf);
config_file_free(ref_conf);
free(ref_shader);
free(config_dir);
free(path_to_ref);
free(path_to_save_conformed);
@ -1929,8 +1936,7 @@ static bool video_shader_load_root_config_into_shader(
* the root preset and it is the path to the
* simple preset originally loaded, but that is set inside
* video_shader_load_preset_into_shader*/
strlcpy(shader->loaded_preset_path,
conf->path,
strlcpy(shader->loaded_preset_path, conf->path,
sizeof(shader->loaded_preset_path));
if (settings->bools.video_shader_watch_files)

View File

@ -1187,25 +1187,28 @@ const char *sanitize_path_part(const char *path_part, size_t size)
{
int i;
int j = 0;
int len = 0;
char *temp = NULL;
char *tmp = NULL;
const char *special_chars = "<>:\"/\\|?*";
if (string_is_empty(path_part))
return NULL;
temp = (char *)malloc((size + 1) * sizeof(char));
tmp = (char *)malloc((size + 1) * sizeof(char));
for (i = 0; path_part[i] != '\0'; i++)
/* Check if the current character is one of the special characters */
if (strchr(special_chars, path_part[i]) == NULL)
/* If not, copy it to the temporary array */
temp[j++] = path_part[i];
{
/* Check if the current character is
* one of the special characters */
temp[j] = '\0';
/* If not, copy it to the temporary array */
if (!strchr(special_chars, path_part[i]))
tmp[j++] = path_part[i];
}
tmp[j] = '\0';
/* Return the new string */
return temp;
return tmp;
}
/**

View File

@ -945,13 +945,12 @@ static int action_get_title_group_settings(const char *path, const char *label,
}
{
size_t _len;
char *tok, *save;
char *label_cpy = strdup(label);
if ((tok = strtok_r(label_cpy, "|", &save)))
{
_len = strlcpy(s, tok, len);
size_t _len = strlcpy(s, tok, len);
if ((tok = strtok_r(NULL, "|", &save)))
{
s[ _len] = ' ';