From 39495ced67db928a073472c622498c208762d7a1 Mon Sep 17 00:00:00 2001 From: pstef <3462925+pstef@users.noreply.github.com> Date: Sat, 22 Mar 2025 10:35:37 +0000 Subject: [PATCH 1/6] Silence a type-limits warning Before this change, an 8-bit value was guaranteed to be lesser than the size of this array (256). Instead of removing the check, I make it meaningful by reducing the size of the array. --- libretro-common/net/net_http.c | 137 +-------------------------------- 1 file changed, 2 insertions(+), 135 deletions(-) diff --git a/libretro-common/net/net_http.c b/libretro-common/net/net_http.c index 48092c8a99..d64aaeb2e3 100644 --- a/libretro-common/net/net_http.c +++ b/libretro-common/net/net_http.c @@ -152,7 +152,7 @@ static slock_t *dns_cache_lock = NULL; **/ void net_http_urlencode(char **dest, const char *source) { - static const char urlencode_lut[256] = + static const char urlencode_lut[] = { 0, /* 0 */ 0, /* 1 */ @@ -276,140 +276,7 @@ void net_http_urlencode(char **dest, const char *source) 'w', /* 119 */ 'x', /* 120 */ 'y', /* 121 */ - 'z', /* 122 */ - 0, /* 123 */ - 0, /* 124 */ - 0, /* 125 */ - 0, /* 126 */ - 0, /* 127 */ - 0, /* 128 */ - 0, /* 129 */ - 0, /* 130 */ - 0, /* 131 */ - 0, /* 132 */ - 0, /* 133 */ - 0, /* 134 */ - 0, /* 135 */ - 0, /* 136 */ - 0, /* 137 */ - 0, /* 138 */ - 0, /* 139 */ - 0, /* 140 */ - 0, /* 141 */ - 0, /* 142 */ - 0, /* 143 */ - 0, /* 144 */ - 0, /* 145 */ - 0, /* 146 */ - 0, /* 147 */ - 0, /* 148 */ - 0, /* 149 */ - 0, /* 150 */ - 0, /* 151 */ - 0, /* 152 */ - 0, /* 153 */ - 0, /* 154 */ - 0, /* 155 */ - 0, /* 156 */ - 0, /* 157 */ - 0, /* 158 */ - 0, /* 159 */ - 0, /* 160 */ - 0, /* 161 */ - 0, /* 162 */ - 0, /* 163 */ - 0, /* 164 */ - 0, /* 165 */ - 0, /* 166 */ - 0, /* 167 */ - 0, /* 168 */ - 0, /* 169 */ - 0, /* 170 */ - 0, /* 171 */ - 0, /* 172 */ - 0, /* 173 */ - 0, /* 174 */ - 0, /* 175 */ - 0, /* 176 */ - 0, /* 177 */ - 0, /* 178 */ - 0, /* 179 */ - 0, /* 180 */ - 0, /* 181 */ - 0, /* 182 */ - 0, /* 183 */ - 0, /* 184 */ - 0, /* 185 */ - 0, /* 186 */ - 0, /* 187 */ - 0, /* 188 */ - 0, /* 189 */ - 0, /* 190 */ - 0, /* 191 */ - 0, /* 192 */ - 0, /* 193 */ - 0, /* 194 */ - 0, /* 195 */ - 0, /* 196 */ - 0, /* 197 */ - 0, /* 198 */ - 0, /* 199 */ - 0, /* 200 */ - 0, /* 201 */ - 0, /* 202 */ - 0, /* 203 */ - 0, /* 204 */ - 0, /* 205 */ - 0, /* 206 */ - 0, /* 207 */ - 0, /* 208 */ - 0, /* 209 */ - 0, /* 210 */ - 0, /* 211 */ - 0, /* 212 */ - 0, /* 213 */ - 0, /* 214 */ - 0, /* 215 */ - 0, /* 216 */ - 0, /* 217 */ - 0, /* 218 */ - 0, /* 219 */ - 0, /* 220 */ - 0, /* 221 */ - 0, /* 222 */ - 0, /* 223 */ - 0, /* 224 */ - 0, /* 225 */ - 0, /* 226 */ - 0, /* 227 */ - 0, /* 228 */ - 0, /* 229 */ - 0, /* 230 */ - 0, /* 231 */ - 0, /* 232 */ - 0, /* 233 */ - 0, /* 234 */ - 0, /* 235 */ - 0, /* 236 */ - 0, /* 237 */ - 0, /* 238 */ - 0, /* 239 */ - 0, /* 240 */ - 0, /* 241 */ - 0, /* 242 */ - 0, /* 243 */ - 0, /* 244 */ - 0, /* 245 */ - 0, /* 246 */ - 0, /* 247 */ - 0, /* 248 */ - 0, /* 249 */ - 0, /* 250 */ - 0, /* 251 */ - 0, /* 252 */ - 0, /* 253 */ - 0, /* 254 */ - 0 /* 255 */ + 'z' /* 122 */ }; /* Assume every character will be encoded, so we need 3 times the space. */ From 281dff895647a416ace2bd4a16b1ec251cff65d8 Mon Sep 17 00:00:00 2001 From: pstef <3462925+pstef@users.noreply.github.com> Date: Sat, 22 Mar 2025 14:40:49 +0000 Subject: [PATCH 2/6] Silence a stringop-overflow warning Guard against an unlikely case. --- libretro-common/file/file_path.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libretro-common/file/file_path.c b/libretro-common/file/file_path.c index a9a36b84c8..c352b4f26e 100644 --- a/libretro-common/file/file_path.c +++ b/libretro-common/file/file_path.c @@ -1055,6 +1055,8 @@ size_t fill_pathname_join_delim(char *s, const char *dir, _len = strlen(dir); else _len = strlcpy(s, dir, len); + if (len - _len < 2) + return _len; s[_len++] = delim; s[_len ] = '\0'; if (path) From a4bfd84cc774e298e95fdfae3f694ba4b383753f Mon Sep 17 00:00:00 2001 From: pstef <3462925+pstef@users.noreply.github.com> Date: Mon, 24 Mar 2025 20:53:42 +0000 Subject: [PATCH 3/6] Silence warnings about sign mismatch --- tasks/task_cloudsync.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/task_cloudsync.c b/tasks/task_cloudsync.c index 74450d3657..a238b9351e 100644 --- a/tasks/task_cloudsync.c +++ b/tasks/task_cloudsync.c @@ -872,7 +872,7 @@ static void task_cloud_sync_delete_server_file(task_cloud_sync_state_t *sync_sta static void task_cloud_sync_maybe_ignore(task_cloud_sync_state_t *sync_state) { struct string_list *dirlist = task_cloud_sync_directory_map(); - int i; + size_t i; bool found; if (sync_state->local_manifest) From ac38cfe8da75c7a7a73509f811e5dd2f1c8e23b6 Mon Sep 17 00:00:00 2001 From: pstef <3462925+pstef@users.noreply.github.com> Date: Tue, 25 Mar 2025 20:06:33 +0000 Subject: [PATCH 4/6] Silence -Waddress This is a continuation of c9149895f5c --- input/drivers/linuxraw_input.c | 2 +- input/drivers/wayland_input.c | 2 +- input/drivers/x11_input.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/input/drivers/linuxraw_input.c b/input/drivers/linuxraw_input.c index 1788c1f283..4ad7615460 100644 --- a/input/drivers/linuxraw_input.c +++ b/input/drivers/linuxraw_input.c @@ -120,7 +120,7 @@ static int16_t linuxraw_input_state( } break; case RETRO_DEVICE_ANALOG: - if (binds[port]) + if (binds) { int id_minus_key = 0; int id_plus_key = 0; diff --git a/input/drivers/wayland_input.c b/input/drivers/wayland_input.c index f1c86ef455..fdea597066 100644 --- a/input/drivers/wayland_input.c +++ b/input/drivers/wayland_input.c @@ -214,7 +214,7 @@ static int16_t input_wl_state( } break; case RETRO_DEVICE_ANALOG: - if (binds[port]) + if (binds) { int id_minus_key = 0; int id_plus_key = 0; diff --git a/input/drivers/x11_input.c b/input/drivers/x11_input.c index 23a7e4d8de..b97c97f25f 100644 --- a/input/drivers/x11_input.c +++ b/input/drivers/x11_input.c @@ -175,7 +175,7 @@ static int16_t x_input_state( } break; case RETRO_DEVICE_ANALOG: - if (binds[port]) + if (binds) { int id_minus_key = 0; int id_plus_key = 0; From 052acd4e38e31fc0b14c919ea6120fb08599a0cb Mon Sep 17 00:00:00 2001 From: pstef <3462925+pstef@users.noreply.github.com> Date: Tue, 25 Mar 2025 20:15:20 +0000 Subject: [PATCH 5/6] Reorder arguments in calls to calloc to silence calloc-tran sposed-args warnings. --- gfx/drivers/gl2.c | 4 ++-- libretro-common/lists/linked_list.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gfx/drivers/gl2.c b/gfx/drivers/gl2.c index c0915e3383..247667865d 100644 --- a/gfx/drivers/gl2.c +++ b/gfx/drivers/gl2.c @@ -4554,9 +4554,9 @@ static void *gl2_init(const video_info_t *video, /* Empty buffer that we use to clear out * the texture with on res change. */ - gl->empty_buf = calloc(sizeof(uint32_t), gl->tex_w * gl->tex_h); + gl->empty_buf = calloc(gl->tex_w * gl->tex_h, sizeof(uint32_t)); - gl->conv_buffer = calloc(sizeof(uint32_t), gl->tex_w * gl->tex_h); + gl->conv_buffer = calloc(gl->tex_w * gl->tex_h, sizeof(uint32_t)); if (!gl->conv_buffer) goto error; diff --git a/libretro-common/lists/linked_list.c b/libretro-common/lists/linked_list.c index fce754d5eb..18b0631840 100644 --- a/libretro-common/lists/linked_list.c +++ b/libretro-common/lists/linked_list.c @@ -51,7 +51,7 @@ linked_list_t *linked_list_new(void) { linked_list_t *list; - list = (linked_list_t *)calloc(sizeof(linked_list_t), 1); + list = (linked_list_t *)calloc(1, sizeof(linked_list_t)); return list; } From 870d57445a17021c580d7b3645e212ce176e3629 Mon Sep 17 00:00:00 2001 From: pstef <3462925+pstef@users.noreply.github.com> Date: Tue, 25 Mar 2025 20:20:37 +0000 Subject: [PATCH 6/6] Move INLINE earlier in function declarations to silence a warning. --- menu/drivers/materialui.c | 2 +- menu/drivers/ozone.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/menu/drivers/materialui.c b/menu/drivers/materialui.c index c932eef42d..a2ab277cee 100644 --- a/menu/drivers/materialui.c +++ b/menu/drivers/materialui.c @@ -3348,7 +3348,7 @@ static float materialui_get_scroll(materialui_handle_t *mui, /* Returns true if specified entry is currently * displayed on screen */ -static bool INLINE materialui_entry_onscreen( +static INLINE bool materialui_entry_onscreen( materialui_handle_t *mui, size_t idx) { return (idx >= mui->first_onscreen_entry) diff --git a/menu/drivers/ozone.c b/menu/drivers/ozone.c index e732e36ff5..a8f3937c31 100644 --- a/menu/drivers/ozone.c +++ b/menu/drivers/ozone.c @@ -7684,7 +7684,7 @@ static void ozone_set_thumbnail_content(void *data, const char *s) /* Returns true if specified category is currently * displayed on screen */ -static bool INLINE ozone_category_onscreen( +static INLINE bool ozone_category_onscreen( ozone_handle_t *ozone, size_t idx) { @@ -7731,7 +7731,7 @@ static void ozone_auto_select_onscreen_entry( } } -static bool INLINE ozone_metadata_override_available(ozone_handle_t *ozone, +static INLINE bool ozone_metadata_override_available(ozone_handle_t *ozone, unsigned menu_left_thumbnails) { /* Ugly construct... @@ -7759,7 +7759,7 @@ static bool INLINE ozone_metadata_override_available(ozone_handle_t *ozone, (ozone->thumbnails_right_status_prev <= GFX_THUMBNAIL_STATUS_AVAILABLE))); } -static bool INLINE ozone_fullscreen_thumbnails_available(ozone_handle_t *ozone, +static INLINE bool ozone_fullscreen_thumbnails_available(ozone_handle_t *ozone, struct menu_state *menu_st) { bool ret = @@ -9523,7 +9523,7 @@ static void ozone_unload_thumbnail_textures(void *data) gfx_thumbnail_reset(&ozone->thumbnails.savestate); } -static void INLINE ozone_font_free(font_data_impl_t *font_data) +static INLINE void ozone_font_free(font_data_impl_t *font_data) { if (font_data->font) font_driver_free(font_data->font);