From 7f87a46744b80ead62c00e150f1b8a1aca9518fc Mon Sep 17 00:00:00 2001 From: libretroadmin Date: Mon, 9 Sep 2024 16:18:32 +0200 Subject: [PATCH] More downsizing of variables --- disk_control_interface.c | 4 ++-- gfx/widgets/gfx_widget_volume.c | 4 ++-- libretro-common/file/config_file.c | 2 +- libretro-common/formats/m3u/m3u_file.c | 10 +++++----- libretro-common/include/formats/logiqx_dat.h | 6 +++--- menu/drivers/xmb.c | 2 +- menu/menu_displaylist.c | 2 +- menu/menu_setting.c | 4 ++-- steam/steam.c | 4 ++-- tasks/task_save.c | 2 +- 10 files changed, 20 insertions(+), 20 deletions(-) diff --git a/disk_control_interface.c b/disk_control_interface.c index 7864e95782..887e099a24 100644 --- a/disk_control_interface.c +++ b/disk_control_interface.c @@ -409,7 +409,7 @@ bool disk_control_set_index( bool error = false; unsigned num_images = 0; unsigned msg_duration = 0; - char msg[NAME_MAX_LENGTH]; + char msg[128]; msg[0] = '\0'; @@ -845,7 +845,7 @@ bool disk_control_verify_initial_index( if (disk_control->initial_num_images > 1) { unsigned msg_duration = 0; - char msg[PATH_MAX_LENGTH]; + char msg[128]; msg[0] = '\0'; diff --git a/gfx/widgets/gfx_widget_volume.c b/gfx/widgets/gfx_widget_volume.c index ff3f82c7da..8930eb04c8 100644 --- a/gfx/widgets/gfx_widget_volume.c +++ b/gfx/widgets/gfx_widget_volume.c @@ -94,8 +94,8 @@ static void gfx_widget_volume_frame(void* data, void *user_data) if (state->alpha > 0.0f) { - char msg[NAME_MAX_LENGTH]; - char percentage_msg[NAME_MAX_LENGTH]; + char msg[128]; + char percentage_msg[128]; video_frame_info_t *video_info = (video_frame_info_t*)data; dispgfx_widget_t *p_dispwidget = (dispgfx_widget_t*)user_data; gfx_widget_font_data_t *font_regular = &p_dispwidget->gfx_widget_fonts.regular; diff --git a/libretro-common/file/config_file.c b/libretro-common/file/config_file.c index c99097c247..1edbc2aef4 100644 --- a/libretro-common/file/config_file.c +++ b/libretro-common/file/config_file.c @@ -411,7 +411,7 @@ size_t config_file_add_reference(config_file_t *conf, char *path) { size_t len; /* It is expected that the conf has it's path already set */ - char short_path[PATH_MAX_LENGTH]; + char short_path[NAME_MAX_LENGTH]; if (!conf->references) conf->references = path_linked_list_new(); len = fill_pathname_abbreviated_or_relative(short_path, conf->path, path, sizeof(short_path)); diff --git a/libretro-common/formats/m3u/m3u_file.c b/libretro-common/formats/m3u/m3u_file.c index db3b37e2a9..7048577b1c 100644 --- a/libretro-common/formats/m3u/m3u_file.c +++ b/libretro-common/formats/m3u/m3u_file.c @@ -61,14 +61,14 @@ struct content_m3u_file * - Returns false in the event of an error */ static bool m3u_file_load(m3u_file_t *m3u_file) { + size_t i; + char entry_label[NAME_MAX_LENGTH]; + char entry_path[PATH_MAX_LENGTH]; const char *file_ext = NULL; int64_t file_len = 0; uint8_t *file_buf = NULL; struct string_list *lines = NULL; bool success = false; - size_t i; - char entry_path[PATH_MAX_LENGTH]; - char entry_label[PATH_MAX_LENGTH]; entry_path[0] = '\0'; entry_label[0] = '\0'; @@ -85,8 +85,8 @@ static bool m3u_file_load(m3u_file_t *m3u_file) /* > File must have the correct extension */ file_ext = path_get_extension(m3u_file->path); - if (string_is_empty(file_ext) || - !string_is_equal_noncase(file_ext, M3U_FILE_EXT)) + if ( string_is_empty(file_ext) + || !string_is_equal_noncase(file_ext, M3U_FILE_EXT)) goto end; /* > If file does not exist, no action diff --git a/libretro-common/include/formats/logiqx_dat.h b/libretro-common/include/formats/logiqx_dat.h index fc7b64a71f..bd835711bf 100644 --- a/libretro-common/include/formats/logiqx_dat.h +++ b/libretro-common/include/formats/logiqx_dat.h @@ -50,8 +50,8 @@ typedef struct logiqx_dat logiqx_dat_t; * if required) */ typedef struct { - char name[PATH_MAX_LENGTH]; - char description[PATH_MAX_LENGTH]; + char name[NAME_MAX_LENGTH]; + char description[NAME_MAX_LENGTH]; char year[8]; char manufacturer[128]; bool is_bios; @@ -66,7 +66,7 @@ typedef struct * Also provides access to file size (DAT files can * be very large, so it is useful to have this information * on hand - i.e. so we can check that the system has - * enough free memory to load the file). */ + * enough free memory to load the file). */ bool logiqx_dat_path_is_valid(const char *path, uint64_t *file_size); /* File initialisation/de-initialisation */ diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 1eca06e49e..c8bc506df2 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -6446,8 +6446,8 @@ static void xmb_frame(void *data, video_frame_info_t *video_info) { math_matrix_4x4 mymat; unsigned i; + char title_msg[128]; char msg[1024]; - char title_msg[NAME_MAX_LENGTH]; char title_truncated[NAME_MAX_LENGTH]; gfx_thumbnail_shadow_t thumbnail_shadow; size_t selection = 0; diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 6fe762c902..20e0dd00eb 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -528,7 +528,7 @@ static int menu_displaylist_parse_core_info( { char tmp[PATH_MAX_LENGTH]; #if IOS - char shortened_path[PATH_MAX_LENGTH] = {0}; + char shortened_path[NAME_MAX_LENGTH] = {0}; #endif unsigned i, count = 0; core_info_t *core_info = NULL; diff --git a/menu/menu_setting.c b/menu/menu_setting.c index c05b587a7c..7fa2149f4c 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -2569,8 +2569,8 @@ static int setting_action_ok_bind_all_save_autoconfig( if (!string_is_empty(name) && config_save_autoconf_profile(name, index_offset)) { - char buf[PATH_MAX_LENGTH]; - char msg[PATH_MAX_LENGTH]; + char msg[256]; + char buf[128]; config_get_autoconf_profile_filename(name, index_offset, buf, sizeof(buf)); snprintf(msg, sizeof(msg),msg_hash_to_str(MSG_AUTOCONFIG_FILE_SAVED_SUCCESSFULLY_NAMED),buf); runloop_msg_queue_push( diff --git a/steam/steam.c b/steam/steam.c index e29221e655..da7ee03bee 100644 --- a/steam/steam.c +++ b/steam/steam.c @@ -267,7 +267,7 @@ steam_core_dlc_t* steam_get_core_dlc_by_name( void steam_install_core_dlc(steam_core_dlc_t *core_dlc) { - char msg[PATH_MAX_LENGTH] = { 0 }; + char msg[128] = { 0 }; bool downloading = false; bool installed = false; uint64_t bytes_downloaded = 0; @@ -309,7 +309,7 @@ error: void steam_uninstall_core_dlc(steam_core_dlc_t *core_dlc) { - char msg[PATH_MAX_LENGTH] = { 0 }; + char msg[128] = { 0 }; MistResult result = mist_steam_apps_uninstall_dlc(core_dlc->app_id); diff --git a/tasks/task_save.c b/tasks/task_save.c index 93b1c6620e..734fcb68b3 100644 --- a/tasks/task_save.c +++ b/tasks/task_save.c @@ -537,7 +537,7 @@ static void task_save_handler(retro_task_t *task) if (task_get_cancelled(task) || written != remaining) { - char msg[PATH_MAX_LENGTH]; + char msg[128]; if (state->flags & SAVE_TASK_FLAG_UNDO_SAVE) {