From 29639b98b3f36e25f484ef20e6edb660eac66d91 Mon Sep 17 00:00:00 2001 From: pstef <3462925+pstef@users.noreply.github.com> Date: Wed, 19 Mar 2025 22:50:49 +0000 Subject: [PATCH 1/6] Use the return value of rbtree_insert to silence a warning The function prototype wants us to be warned when the result is not used, but it's not clear why - I assume to check for failure. --- ctr/ctr_linear.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ctr/ctr_linear.cpp b/ctr/ctr_linear.cpp index 1c906260a8..c8c0cb85a4 100644 --- a/ctr/ctr_linear.cpp +++ b/ctr/ctr_linear.cpp @@ -191,10 +191,13 @@ void* linearMemAlign(size_t len, size_t alignment) sLinearPool.Deallocate(chunk); return nullptr; } - if (rbtree_insert(&sAddrMap, &node->node)); + if (!rbtree_insert(&sAddrMap, &node->node)) { + sLinearPool.Deallocate(chunk); + return nullptr; + } - if (sLinearPool_maxaddr < (u32)sLinearPool.last->base) - sLinearPool_maxaddr = (u32)sLinearPool.last->base; + if (sLinearPool_maxaddr < (u32)sLinearPool.last->base) + sLinearPool_maxaddr = (u32)sLinearPool.last->base; return chunk.addr; } From c978717b61545dfe6a6d4bf1354223c863b8fd3e Mon Sep 17 00:00:00 2001 From: pstef <3462925+pstef@users.noreply.github.com> Date: Wed, 19 Mar 2025 23:01:07 +0000 Subject: [PATCH 2/6] Silence a warning about no return value from non-void function It seems the idea is to continue with installation, regardless of what happened within deleteCia, so I just change its return type to void. --- ctr/exec-3dsx/exec_cia.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ctr/exec-3dsx/exec_cia.c b/ctr/exec-3dsx/exec_cia.c index 8cbf66f606..43567ef66d 100644 --- a/ctr/exec-3dsx/exec_cia.c +++ b/ctr/exec-3dsx/exec_cia.c @@ -63,7 +63,7 @@ static int isCiaInstalled(u64 titleId, u16 version) return 0; } -static int deleteCia(u64 TitleId) +static void deleteCia(u64 TitleId) { u64 currTitleId = 0; From ce6cd0000c7e1658047d64d361539aa9a8067d30 Mon Sep 17 00:00:00 2001 From: pstef <3462925+pstef@users.noreply.github.com> Date: Thu, 20 Mar 2025 16:12:12 +0000 Subject: [PATCH 3/6] Don't free members of struct before init --- menu/cbs/menu_cbs_ok.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index 3ed4f29945..452f7825a4 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -707,10 +707,7 @@ int generic_action_ok_displaylist_push( recording_state_t *recording_st = recording_state_get_ptr(); if (!menu || string_is_equal(menu_ident, "null")) - { - menu_displaylist_info_free(&info); return -1; - } #ifdef HAVE_AUDIOMIXER if (audio_enable_menu && audio_enable_menu_ok) From b85bcb8e486d5cf5365abfd3862d26405478b4c3 Mon Sep 17 00:00:00 2001 From: pstef <3462925+pstef@users.noreply.github.com> Date: Thu, 20 Mar 2025 16:21:27 +0000 Subject: [PATCH 4/6] Adjust types of index and maxindex to unsigned --- libretro-common/audio/dsp_filters/tremolo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libretro-common/audio/dsp_filters/tremolo.c b/libretro-common/audio/dsp_filters/tremolo.c index 5bdf52ed32..c7a5d6a143 100644 --- a/libretro-common/audio/dsp_filters/tremolo.c +++ b/libretro-common/audio/dsp_filters/tremolo.c @@ -35,8 +35,8 @@ struct tremolo_core float *wavetable; float freq; float depth; - int index; - int maxindex; + unsigned index; + unsigned maxindex; }; struct tremolo From 3fb7d190bf87041cb5a4dafff07bac17acdb0475 Mon Sep 17 00:00:00 2001 From: pstef <3462925+pstef@users.noreply.github.com> Date: Thu, 20 Mar 2025 16:51:58 +0000 Subject: [PATCH 5/6] Silence warning about possible truncation Also simplify this part; the point here is to start the copy later, but otherwise the buffer size is the same, and it's still a string, so needs no special handling. --- tasks/task_database_cue.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tasks/task_database_cue.c b/tasks/task_database_cue.c index 2490bf9881..b8ceacffb2 100644 --- a/tasks/task_database_cue.c +++ b/tasks/task_database_cue.c @@ -722,8 +722,7 @@ int detect_sat_game(intfstream_t *fd, char *s, size_t len, const char *filename) && raw_game_id[1] == 'K' && raw_game_id[2] == '-') { - strncpy(s, &raw_game_id[3], __len - 3); - s[__len - 3] = '\0'; + strlcpy(s, &raw_game_id[3], len); } else strlcpy(s, raw_game_id, len); From a28b79215f5227d3c81abc09d0aa048f17f4300a Mon Sep 17 00:00:00 2001 From: pstef <3462925+pstef@users.noreply.github.com> Date: Thu, 20 Mar 2025 18:24:55 +0000 Subject: [PATCH 6/6] Silence warning about type sign mismatch Make this enum act like a type, use it and let the compiler choose and handle signedness so that it all matches. --- dynamic.h | 2 +- retroarch_types.h | 2 +- runloop.c | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dynamic.h b/dynamic.h index 79ed70ab16..af4a0cdd15 100644 --- a/dynamic.h +++ b/dynamic.h @@ -66,7 +66,7 @@ struct retro_core_t void *(*retro_get_memory_data)(unsigned); size_t (*retro_get_memory_size)(unsigned); - unsigned poll_type; + enum poll_type poll_type; uint8_t flags; }; diff --git a/retroarch_types.h b/retroarch_types.h index f50d7b51e2..2d0aac5120 100644 --- a/retroarch_types.h +++ b/retroarch_types.h @@ -20,7 +20,7 @@ RETRO_BEGIN_DECLS -enum +enum poll_type { /* Polling is performed before * call to retro_run. */ diff --git a/runloop.c b/runloop.c index 846a5ccc9a..ad53bbdfd8 100644 --- a/runloop.c +++ b/runloop.c @@ -4518,7 +4518,7 @@ static void core_input_state_poll_maybe(void) runloop_state_t *runloop_st = &runloop_state; const enum poll_type_override_t core_poll_type_override = runloop_st->core_poll_type_override; - unsigned new_poll_type = (core_poll_type_override > POLL_TYPE_OVERRIDE_DONTCARE) + enum poll_type new_poll_type = (core_poll_type_override > POLL_TYPE_OVERRIDE_DONTCARE) ? (core_poll_type_override - 1) : runloop_st->current_core.poll_type; if (new_poll_type == POLL_TYPE_NORMAL) @@ -4531,7 +4531,7 @@ static retro_input_state_t core_input_state_poll_return_cb(void) runloop_state_t *runloop_st = &runloop_state; const enum poll_type_override_t core_poll_type_override = runloop_st->core_poll_type_override; - unsigned new_poll_type = (core_poll_type_override > POLL_TYPE_OVERRIDE_DONTCARE) + enum poll_type new_poll_type = (core_poll_type_override > POLL_TYPE_OVERRIDE_DONTCARE) ? (core_poll_type_override - 1) : runloop_st->current_core.poll_type; if (new_poll_type == POLL_TYPE_LATE) @@ -7715,7 +7715,7 @@ void core_run(void) current_core = &runloop_st->current_core; const enum poll_type_override_t core_poll_type_override = runloop_st->core_poll_type_override; - unsigned new_poll_type = (core_poll_type_override != POLL_TYPE_OVERRIDE_DONTCARE) + enum poll_type new_poll_type = (core_poll_type_override != POLL_TYPE_OVERRIDE_DONTCARE) ? (core_poll_type_override - 1) : current_core->poll_type; bool early_polling = new_poll_type == POLL_TYPE_EARLY;