mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-01-18 00:32:46 +00:00
Start cutting down on the size of some char local variables - we
don't need PATH_MAX_LENGTH for everything
This commit is contained in:
parent
7d6b7b7729
commit
39e9d5c5ba
@ -96,7 +96,7 @@ static void event_save_files(void)
|
||||
**/
|
||||
static void event_disk_control_set_eject(bool new_state, bool print_log)
|
||||
{
|
||||
char msg[PATH_MAX_LENGTH] = {0};
|
||||
char msg[128] = {0};
|
||||
bool error = false;
|
||||
rarch_system_info_t *info = rarch_system_info_get_ptr();
|
||||
const struct retro_disk_control_callback *control =
|
||||
@ -155,11 +155,11 @@ static void event_check_disk_eject(
|
||||
static void event_disk_control_set_index(unsigned idx)
|
||||
{
|
||||
unsigned num_disks;
|
||||
char msg[PATH_MAX_LENGTH] = {0};
|
||||
bool error = false;
|
||||
char msg[128] = {0};
|
||||
rarch_system_info_t *info = rarch_system_info_get_ptr();
|
||||
const struct retro_disk_control_callback *control =
|
||||
info ? (const struct retro_disk_control_callback*)&info->disk_control : NULL;
|
||||
bool error = false;
|
||||
|
||||
if (!control || !control->get_num_images)
|
||||
return;
|
||||
@ -209,7 +209,7 @@ static void event_disk_control_set_index(unsigned idx)
|
||||
void event_disk_control_append_image(const char *path)
|
||||
{
|
||||
unsigned new_idx;
|
||||
char msg[PATH_MAX_LENGTH] = {0};
|
||||
char msg[128] = {0};
|
||||
struct retro_game_info info = {0};
|
||||
global_t *global = global_get_ptr();
|
||||
rarch_system_info_t *sysinfo = rarch_system_info_get_ptr();
|
||||
@ -333,7 +333,7 @@ static void event_check_disk_next(
|
||||
**/
|
||||
static void event_set_volume(float gain)
|
||||
{
|
||||
char msg[PATH_MAX_LENGTH] = {0};
|
||||
char msg[128] = {0};
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
settings->audio.volume += gain;
|
||||
@ -466,7 +466,7 @@ static bool event_load_save_files(void)
|
||||
static void event_load_auto_state(void)
|
||||
{
|
||||
bool ret;
|
||||
char msg[PATH_MAX_LENGTH] = {0};
|
||||
char msg[128] = {0};
|
||||
char savestate_name_auto[PATH_MAX_LENGTH] = {0};
|
||||
settings_t *settings = config_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
@ -526,7 +526,7 @@ static void event_set_savestate_auto_index(void)
|
||||
for (i = 0; i < dir_list->size; i++)
|
||||
{
|
||||
unsigned idx;
|
||||
char elem_base[PATH_MAX_LENGTH] = {0};
|
||||
char elem_base[128] = {0};
|
||||
const char *end = NULL;
|
||||
const char *dir_elem = dir_list->elems[i].data;
|
||||
|
||||
@ -670,7 +670,7 @@ static bool event_save_core_config(void)
|
||||
char config_dir[PATH_MAX_LENGTH] = {0};
|
||||
char config_name[PATH_MAX_LENGTH] = {0};
|
||||
char config_path[PATH_MAX_LENGTH] = {0};
|
||||
char msg[PATH_MAX_LENGTH] = {0};
|
||||
char msg[128] = {0};
|
||||
bool ret = false;
|
||||
bool found_path = false;
|
||||
bool overrides_active = false;
|
||||
@ -847,7 +847,7 @@ static void event_load_state(const char *path, char *s, size_t len)
|
||||
static void event_main_state(unsigned cmd)
|
||||
{
|
||||
char path[PATH_MAX_LENGTH] = {0};
|
||||
char msg[PATH_MAX_LENGTH] = {0};
|
||||
char msg[128] = {0};
|
||||
global_t *global = global_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
@ -933,9 +933,10 @@ bool event_command(enum event_command cmd)
|
||||
|
||||
if (video_driver_get_video_output_size(&width, &height))
|
||||
{
|
||||
char msg[128] = {0};
|
||||
|
||||
video_driver_set_video_mode(width, height, true);
|
||||
|
||||
char msg[PATH_MAX_LENGTH] = {0};
|
||||
snprintf(msg, sizeof(msg),"Resolution: %dx%d",width, height);
|
||||
rarch_main_msg_queue_push(msg, 1, 100, true);
|
||||
}
|
||||
|
2
driver.c
2
driver.c
@ -139,7 +139,7 @@ static const void *find_driver_nonempty(const char *label, int i,
|
||||
int find_driver_index(const char * label, const char *drv)
|
||||
{
|
||||
unsigned i;
|
||||
char str[PATH_MAX_LENGTH] = {0};
|
||||
char str[256];
|
||||
const void *obj = NULL;
|
||||
|
||||
for (i = 0; (obj = (const void*)
|
||||
|
10
dynamic.c
10
dynamic.c
@ -626,9 +626,9 @@ static bool rarch_game_specific_options(char **output)
|
||||
* Try config directory setting first,
|
||||
* fallback to the location of the current configuration file. */
|
||||
if (settings->menu_config_directory[0] != '\0')
|
||||
strlcpy(config_directory, settings->menu_config_directory, PATH_MAX_LENGTH);
|
||||
strlcpy(config_directory, settings->menu_config_directory, sizeof(config_directory));
|
||||
else if (global->path.config[0] != '\0')
|
||||
fill_pathname_basedir(config_directory, global->path.config, PATH_MAX_LENGTH);
|
||||
fill_pathname_basedir(config_directory, global->path.config, sizeof(config_directory));
|
||||
else
|
||||
{
|
||||
RARCH_WARN("Per-Game Options: no config directory set\n");
|
||||
@ -636,9 +636,9 @@ static bool rarch_game_specific_options(char **output)
|
||||
}
|
||||
|
||||
/* Concatenate strings into full paths for game_path */
|
||||
fill_pathname_join(game_path, config_directory, core_name, PATH_MAX_LENGTH);
|
||||
fill_pathname_join(game_path, game_path, game_name, PATH_MAX_LENGTH);
|
||||
strlcat(game_path, ".opt", PATH_MAX_LENGTH);
|
||||
fill_pathname_join(game_path, config_directory, core_name, sizeof(game_path));
|
||||
fill_pathname_join(game_path, game_path, game_name, sizeof(game_path));
|
||||
strlcat(game_path, ".opt", sizeof(game_path));
|
||||
|
||||
option_file = config_file_new(game_path);
|
||||
if (!option_file)
|
||||
|
@ -927,7 +927,7 @@ void video_driver_set_size(unsigned *width, unsigned *height)
|
||||
**/
|
||||
void video_monitor_set_refresh_rate(float hz)
|
||||
{
|
||||
char msg[PATH_MAX_LENGTH];
|
||||
char msg[128];
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
snprintf(msg, sizeof(msg), "Setting refresh rate to: %.3f Hz.", hz);
|
||||
|
@ -70,7 +70,7 @@ struct udev_joypad
|
||||
uint16_t strength[2];
|
||||
uint16_t configured_strength[2];
|
||||
|
||||
char ident[PATH_MAX_LENGTH];
|
||||
char ident[256];
|
||||
char *path;
|
||||
int32_t vid;
|
||||
int32_t pid;
|
||||
@ -341,7 +341,7 @@ static void udev_check_device(struct udev_device *dev, const char *path, bool ho
|
||||
default:
|
||||
if (hotplugged)
|
||||
{
|
||||
char msg[PATH_MAX_LENGTH] = {0};
|
||||
char msg[256];
|
||||
|
||||
snprintf(msg, sizeof(msg), "Device #%u (%s) connected.", pad, path);
|
||||
rarch_main_msg_queue_push(msg, 0, 60, false);
|
||||
|
@ -484,15 +484,12 @@ static void mui_render_label_value(mui_handle_t *mui,
|
||||
{
|
||||
char label_str[PATH_MAX_LENGTH];
|
||||
char value_str[PATH_MAX_LENGTH];
|
||||
int value_len = strlen(value);
|
||||
int ticker_limit = 0;
|
||||
size_t usable_width = 0;
|
||||
int value_len = strlen(value);
|
||||
int ticker_limit = 0;
|
||||
size_t usable_width = 0;
|
||||
uintptr_t texture_switch = 0;
|
||||
bool do_draw_text = false;
|
||||
uint32_t hash_value = 0;
|
||||
|
||||
label_str[0] = '\0';
|
||||
value_str[0] = '\0';
|
||||
bool do_draw_text = false;
|
||||
uint32_t hash_value = 0;
|
||||
|
||||
usable_width = width - (mui->margin * 2);
|
||||
|
||||
@ -728,9 +725,9 @@ static void mui_frame(void)
|
||||
0, 0, 0, 0.2,
|
||||
};
|
||||
unsigned width, height, ticker_limit, i;
|
||||
char msg[PATH_MAX_LENGTH];
|
||||
char title[PATH_MAX_LENGTH];
|
||||
char title_buf[PATH_MAX_LENGTH];
|
||||
char msg[256];
|
||||
char title[256];
|
||||
char title_buf[256];
|
||||
size_t selection;
|
||||
size_t title_margin;
|
||||
uint64_t *frame_count;
|
||||
|
@ -180,7 +180,7 @@ typedef struct xmb_handle
|
||||
} label;
|
||||
} margins;
|
||||
|
||||
char title_name[PATH_MAX_LENGTH];
|
||||
char title_name[256];
|
||||
|
||||
struct
|
||||
{
|
||||
|
2
movie.c
2
movie.c
@ -299,7 +299,7 @@ static void bsv_movie_init_state(void)
|
||||
}
|
||||
else if (bsv_movie_ctl(BSV_MOVIE_CTL_START_RECORDING, NULL))
|
||||
{
|
||||
char msg[PATH_MAX_LENGTH] = {0};
|
||||
char msg[256];
|
||||
snprintf(msg, sizeof(msg),
|
||||
"%s \"%s\".",
|
||||
msg_hash_to_str(MSG_STARTING_MOVIE_RECORD_TO),
|
||||
|
@ -318,7 +318,7 @@ bool shader_dir_init(void)
|
||||
static void check_shader_dir(bool pressed_next, bool pressed_prev)
|
||||
{
|
||||
uint32_t ext_hash;
|
||||
char msg[PATH_MAX_LENGTH];
|
||||
char msg[128];
|
||||
const char *shader = NULL;
|
||||
const char *ext = NULL;
|
||||
enum rarch_shader_type type = RARCH_SHADER_NONE;
|
||||
@ -636,7 +636,8 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
|
||||
if (bsv_movie_ctl(BSV_MOVIE_CTL_IS_INITED, NULL))
|
||||
return false;
|
||||
{
|
||||
char path[PATH_MAX_LENGTH], msg[PATH_MAX_LENGTH];
|
||||
char msg[128];
|
||||
char path[PATH_MAX_LENGTH];
|
||||
|
||||
settings->rewind_granularity = 1;
|
||||
|
||||
|
@ -57,7 +57,7 @@ static bool screenshot_dump(const char *folder, const void *frame,
|
||||
{
|
||||
bool ret;
|
||||
char filename[PATH_MAX_LENGTH] = {0};
|
||||
char shotname[PATH_MAX_LENGTH] = {0};
|
||||
char shotname[256] = {0};
|
||||
struct scaler_ctx scaler = {0};
|
||||
RFILE *file = NULL;
|
||||
uint8_t *out_buffer = NULL;
|
||||
|
Loading…
x
Reference in New Issue
Block a user