This commit is contained in:
twinaphex 2015-06-02 18:28:51 +02:00
parent 0825aa8ae3
commit 0cfeff8e1e
23 changed files with 372 additions and 383 deletions

View File

@ -840,58 +840,51 @@ static bool event_save_core_config(void)
/**
* event_save_state
* @path : Path to state.
* @msg : Message.
* @sizeof_msg : Size of @msg.
* @s : Message.
* @len : Size of @s.
*
* Saves a state with path being @path.
**/
static void event_save_state(const char *path,
char *msg, size_t sizeof_msg)
char *s, size_t len)
{
settings_t *settings = config_get_ptr();
if (!save_state(path))
{
snprintf(msg, sizeof_msg,
"Failed to save state to \"%s\".", path);
snprintf(s, len, "Failed to save state to \"%s\".", path);
return;
}
if (settings->state_slot < 0)
snprintf(msg, sizeof_msg,
"Saved state to slot #-1 (auto).");
snprintf(s, len, "Saved state to slot #-1 (auto).");
else
snprintf(msg, sizeof_msg,
"Saved state to slot #%d.", settings->state_slot);
snprintf(s, len, "Saved state to slot #%d.", settings->state_slot);
}
/**
* event_load_state
* @path : Path to state.
* @msg : Message.
* @sizeof_msg : Size of @msg.
* @s : Message.
* @len : Size of @s.
*
* Loads a state with path being @path.
**/
static void event_load_state(const char *path,
char *msg, size_t sizeof_msg)
static void event_load_state(const char *path, char *s, size_t len)
{
settings_t *settings = config_get_ptr();
if (!load_state(path))
{
snprintf(msg, sizeof_msg,
"Failed to load state from \"%s\".", path);
snprintf(s, len, "Failed to load state from \"%s\".", path);
return;
}
if (settings->state_slot < 0)
snprintf(msg, sizeof_msg,
"Loaded state from slot #-1 (auto).");
snprintf(s, len, "Loaded state from slot #-1 (auto).");
else
snprintf(msg, sizeof_msg,
"Loaded state from slot #%d.", settings->state_slot);
snprintf(s, len, "Loaded state from slot #%d.", settings->state_slot);
}
static void event_main_state(unsigned cmd)

View File

@ -66,7 +66,7 @@ driver_t *driver_get_ptr(void)
* @i : index of driver.
* @str : identifier name of the found driver
* gets written to this string.
* @sizeof_str : size of @str.
* @len : size of @str.
*
* Find driver based on @label.
*
@ -74,7 +74,7 @@ driver_t *driver_get_ptr(void)
* pointer to driver.
**/
static const void *find_driver_nonempty(const char *label, int i,
char *str, size_t sizeof_str)
char *s, size_t len)
{
const void *drv = NULL;
@ -82,57 +82,57 @@ static const void *find_driver_nonempty(const char *label, int i,
{
drv = camera_driver_find_handle(i);
if (drv)
strlcpy(str, camera_driver_find_ident(i), sizeof_str);
strlcpy(s, camera_driver_find_ident(i), len);
}
else if (!strcmp(label, "location_driver"))
{
drv = location_driver_find_handle(i);
if (drv)
strlcpy(str, location_driver_find_ident(i), sizeof_str);
strlcpy(s, location_driver_find_ident(i), len);
}
#ifdef HAVE_MENU
else if (!strcmp(label, "menu_driver"))
{
drv = menu_driver_find_handle(i);
if (drv)
strlcpy(str, menu_driver_find_ident(i), sizeof_str);
strlcpy(s, menu_driver_find_ident(i), len);
}
#endif
else if (!strcmp(label, "input_driver"))
{
drv = input_driver_find_handle(i);
if (drv)
strlcpy(str, input_driver_find_ident(i), sizeof_str);
strlcpy(s, input_driver_find_ident(i), len);
}
else if (!strcmp(label, "input_joypad_driver"))
{
drv = joypad_driver_find_handle(i);
if (drv)
strlcpy(str, joypad_driver_find_ident(i), sizeof_str);
strlcpy(s, joypad_driver_find_ident(i), len);
}
else if (!strcmp(label, "video_driver"))
{
drv = video_driver_find_handle(i);
if (drv)
strlcpy(str, video_driver_find_ident(i), sizeof_str);
strlcpy(s, video_driver_find_ident(i), len);
}
else if (!strcmp(label, "audio_driver"))
{
drv = audio_driver_find_handle(i);
if (drv)
strlcpy(str, audio_driver_find_ident(i), sizeof_str);
strlcpy(s, audio_driver_find_ident(i), len);
}
else if (!strcmp(label, "record_driver"))
{
drv = record_driver_find_handle(i);
if (drv)
strlcpy(str, record_driver_find_ident(i), sizeof_str);
strlcpy(s, record_driver_find_ident(i), len);
}
else if (!strcmp(label, "audio_resampler_driver"))
{
drv = audio_resampler_driver_find_handle(i);
if (drv)
strlcpy(str, audio_resampler_driver_find_ident(i), sizeof_str);
strlcpy(s, audio_resampler_driver_find_ident(i), len);
}
return drv;
@ -168,29 +168,29 @@ int find_driver_index(const char * label, const char *drv)
return -1;
}
bool find_first_driver(const char *label, char *str, size_t sizeof_str)
bool find_first_driver(const char *label, char *s, size_t len)
{
find_driver_nonempty(label, 0, str, sizeof_str);
find_driver_nonempty(label, 0, s, len);
return true;
}
/**
* find_prev_driver:
* @label : string of driver type to be found.
* @str : identifier of driver to be found.
* @sizeof_str : size of @str.
* @s : identifier of driver to be found.
* @len : size of @s.
*
* Find previous driver in driver array.
**/
bool find_prev_driver(const char *label, char *str, size_t sizeof_str)
bool find_prev_driver(const char *label, char *s, size_t len)
{
int i = find_driver_index(label, str);
int i = find_driver_index(label, s);
if (i > 0)
find_driver_nonempty(label, i - 1, str, sizeof_str);
find_driver_nonempty(label, i - 1, s, len);
else
{
RARCH_WARN(
"Couldn't find any previous driver (current one: \"%s\").\n", str);
"Couldn't find any previous driver (current one: \"%s\").\n", s);
return false;
}
return true;
@ -199,19 +199,19 @@ bool find_prev_driver(const char *label, char *str, size_t sizeof_str)
/**
* find_next_driver:
* @label : string of driver type to be found.
* @str : identifier of driver to be found.
* @sizeof_str : size of @str.
* @s : identifier of driver to be found.
* @len : size of @s.
*
* Find next driver in driver array.
**/
bool find_next_driver(const char *label, char *str, size_t sizeof_str)
bool find_next_driver(const char *label, char *s, size_t len)
{
int i = find_driver_index(label, str);
if (i >= 0 && (strcmp(str, "null") != 0))
find_driver_nonempty(label, i + 1, str, sizeof_str);
int i = find_driver_index(label, s);
if (i >= 0 && (strcmp(s, "null") != 0))
find_driver_nonempty(label, i + 1, s, len);
else
{
RARCH_WARN("Couldn't find any next driver (current one: \"%s\").\n", str);
RARCH_WARN("Couldn't find any next driver (current one: \"%s\").\n", s);
return false;
}
return true;

View File

@ -330,31 +330,31 @@ void init_drivers_pre(void);
**/
void uninit_drivers(int flags);
bool find_first_driver(const char *label, char *str, size_t sizeof_str);
bool find_first_driver(const char *label, char *s, size_t len);
/**
* find_prev_driver:
* @label : string of driver type to be found.
* @str : identifier of driver to be found.
* @sizeof_str : size of @str.
* @s : identifier of driver to be found.
* @len : size of @s.
*
* Find previous driver in driver array.
*
* Returns: true (1) if successful, otherwise false (0).
**/
bool find_prev_driver(const char *label, char *str, size_t sizeof_str);
bool find_prev_driver(const char *label, char *s, size_t len);
/**
* find_next_driver:
* @label : string of driver type to be found.
* @str : identifier of driver to be found.
* @sizeof_str : size of @str.
* @s : identifier of driver to be found.
* @len : size of @.
*
* Find next driver in driver array.
*
* Returns: true (1) if successful, otherwise false (0).
**/
bool find_next_driver(const char *label, char *str, size_t sizeof_str);
bool find_next_driver(const char *label, char *s, size_t len);
/**
* driver_set_nonblock_state:

View File

@ -354,9 +354,9 @@ int system_property_get(const char *name, char *value)
return length;
}
static void frontend_android_get_name(char *name, size_t sizeof_name)
static void frontend_android_get_name(char *s, size_t len)
{
int len = system_property_get("ro.product.model", name);
int len = system_property_get("ro.product.model", s);
(void)len;
}
@ -386,13 +386,13 @@ static void frontend_android_get_version(int32_t *major, int32_t *minor, int32_t
}
}
static void frontend_android_get_os(char *name, size_t sizeof_name, int *major, int *minor)
static void frontend_android_get_os(char *s, size_t len, int *major, int *minor)
{
int rel;
frontend_android_get_version(major, minor, &rel);
strlcpy(name, "Android", sizeof_name);
strlcpy(s, "Android", len);
}
static void frontend_android_get_version_sdk(int32_t *sdk)

View File

@ -131,7 +131,7 @@ static NSSearchPathDomainMask NSConvertDomainFlagsCF(unsigned flags)
static void CFSearchPathForDirectoriesInDomains(unsigned flags,
unsigned domain_mask, unsigned expand_tilde,
char *buf, size_t sizeof_buf)
char *s, size_t len)
{
CFTypeRef array_val = (CFTypeRef)CFBridgingRetainCompat(
NSSearchPathForDirectoriesInDomains(NSConvertFlagsCF(flags),
@ -142,19 +142,19 @@ static void CFSearchPathForDirectoriesInDomains(unsigned flags,
if (!path || !array)
return;
CFStringGetCString(path, buf, sizeof_buf, kCFStringEncodingUTF8);
CFStringGetCString(path, s, len, kCFStringEncodingUTF8);
CFRelease(path);
CFRelease(array);
}
static void CFTemporaryDirectory(char *buf, size_t sizeof_buf)
static void CFTemporaryDirectory(char *s, size_t len)
{
#if __has_feature(objc_arc)
CFStringRef path = (__bridge_retained CFStringRef)NSTemporaryDirectory();
#else
CFStringRef path = (CFStringRef)NSTemporaryDirectory();
#endif
CFStringGetCString(path, buf, sizeof_buf, kCFStringEncodingUTF8);
CFStringGetCString(path, s, len, kCFStringEncodingUTF8);
}
#if defined(IOS)
@ -266,7 +266,7 @@ static void checkps(CFDictionaryRef dict, bool * have_ac, bool * have_battery,
}
#endif
static void frontend_darwin_get_name(char *name, size_t sizeof_name)
static void frontend_darwin_get_name(char *s, size_t len)
{
#if defined(IOS)
struct utsname buffer;
@ -274,25 +274,25 @@ static void frontend_darwin_get_name(char *name, size_t sizeof_name)
if (uname(&buffer) != 0)
return;
strlcpy(name, buffer.machine, sizeof_name);
strlcpy(s, buffer.machine, len);
#elif defined(OSX)
size_t length = 0;
sysctlbyname("hw.model", name, &length, NULL, 0);
sysctlbyname("hw.model", s, &length, NULL, 0);
#endif
}
static void frontend_darwin_get_os(char *name, size_t sizeof_name, int *major, int *minor)
static void frontend_darwin_get_os(char *s, size_t len, int *major, int *minor)
{
(void)name;
(void)sizeof_name;
(void)s;
(void)len;
(void)major;
(void)minor;
#if defined(IOS)
get_ios_version(major, minor);
strlcpy(name, "iOS", sizeof_name);
strlcpy(s, "iOS", len);
#elif defined(OSX)
strlcpy(name, "OSX", sizeof_name);
strlcpy(s, "OSX", len);
#endif
}

View File

@ -314,7 +314,7 @@ static void frontend_gx_init(void *data)
static void frontend_gx_exec(const char *path, bool should_load_game);
static void frontend_gx_exitspawn(char *core_path, size_t sizeof_core_path)
static void frontend_gx_exitspawn(char *s, size_t len)
{
bool should_load_game = false;
#if defined(IS_SALAMANDER)
@ -326,15 +326,15 @@ static void frontend_gx_exitspawn(char *core_path, size_t sizeof_core_path)
if (!exit_spawn)
return;
frontend_gx_exec(core_path, should_load_game);
frontend_gx_exec(s, should_load_game);
/* FIXME/TODO - hack
* direct loading failed (out of memory), try to jump to Salamander,
* then load the correct core */
fill_pathname_join(core_path, g_defaults.core_dir,
"boot.dol", sizeof_core_path);
fill_pathname_join(s, g_defaults.core_dir,
"boot.dol", len);
#endif
frontend_gx_exec(core_path, should_load_game);
frontend_gx_exec(s, should_load_game);
}
static void frontend_gx_process_args(int *argc, char *argv[])

View File

@ -410,7 +410,7 @@ enum frontend_architecture frontend_linux_get_architecture(void)
return FRONTEND_ARCH_NONE;
}
static void frontend_linux_get_os(char *name, size_t sizeof_name, int *major, int *minor)
static void frontend_linux_get_os(char *s, size_t len, int *major, int *minor)
{
unsigned krel;
struct utsname buffer;
@ -419,7 +419,7 @@ static void frontend_linux_get_os(char *name, size_t sizeof_name, int *major, in
return;
sscanf(buffer.release, "%u.%u.%u", major, minor, &krel);
strlcpy(name, "Linux", sizeof_name);
strlcpy(s, "Linux", len);
}
const frontend_ctx_driver_t frontend_ctx_linux = {

View File

@ -219,7 +219,7 @@ static void frontend_psp_set_fork(bool exit, bool start_game)
exitspawn_start_game = start_game;
}
static void frontend_psp_exitspawn(char *core_path, size_t sizeof_core_path)
static void frontend_psp_exitspawn(char *s, size_t len)
{
bool should_load_game = false;
#ifndef IS_SALAMANDER
@ -228,7 +228,7 @@ static void frontend_psp_exitspawn(char *core_path, size_t sizeof_core_path)
if (!exit_spawn)
return;
#endif
frontend_psp_exec(core_path, should_load_game);
frontend_psp_exec(s, should_load_game);
}
static int frontend_psp_get_rating(void)

View File

@ -97,7 +97,7 @@ static void gfx_set_dwm(void)
}
#endif
static void frontend_win32_get_os(char *name, size_t sizeof_name, int *major, int *minor)
static void frontend_win32_get_os(char *s, size_t len, int *major, int *minor)
{
uint32_t version = GetVersion();
@ -110,16 +110,16 @@ static void frontend_win32_get_os(char *name, size_t sizeof_name, int *major, in
switch (*minor)
{
case 3:
strlcpy(name, "Windows 8.1", sizeof_name);
strlcpy(s, "Windows 8.1", len);
break;
case 2:
strlcpy(name, "Windows 8", sizeof_name);
strlcpy(s, "Windows 8", len);
break;
case 1:
strlcpy(name, "Windows 7/2008 R2", sizeof_name);
strlcpy(s, "Windows 7/2008 R2", len);
break;
case 0:
strlcpy(name, "Windows Vista/2008", sizeof_name);
strlcpy(s, "Windows Vista/2008", len);
break;
default:
break;
@ -129,13 +129,13 @@ static void frontend_win32_get_os(char *name, size_t sizeof_name, int *major, in
switch (*minor)
{
case 2:
strlcpy(name, "Windows 2003", sizeof_name);
strlcpy(s, "Windows 2003", len);
break;
case 1:
strlcpy(name, "Windows XP", sizeof_name);
strlcpy(s, "Windows XP", len);
break;
case 0:
strlcpy(name, "Windows 2000", sizeof_name);
strlcpy(s, "Windows 2000", len);
break;
}
break;
@ -143,13 +143,13 @@ static void frontend_win32_get_os(char *name, size_t sizeof_name, int *major, in
switch (*minor)
{
case 0:
strlcpy(name, "Windows NT 4.0", sizeof_name);
strlcpy(s, "Windows NT 4.0", len);
break;
case 90:
strlcpy(name, "Windows ME", sizeof_name);
strlcpy(s, "Windows ME", len);
break;
case 10:
strlcpy(name, "Windows 98", sizeof_name);
strlcpy(s, "Windows 98", len);
break;
}
break;

View File

@ -305,8 +305,7 @@ static void frontend_xdk_set_fork(bool exit, bool start_game)
exitspawn_start_game = start_game;
}
static void frontend_xdk_exitspawn(char *core_path,
size_t sizeof_core_path)
static void frontend_xdk_exitspawn(char *s, size_t len)
{
bool should_load_game = false;
#ifndef IS_SALAMANDER
@ -315,7 +314,7 @@ static void frontend_xdk_exitspawn(char *core_path,
if (!exit_spawn)
return;
#endif
frontend_xdk_exec(core_path, should_load_game);
frontend_xdk_exec(s, should_load_game);
}
static void frontend_xdk_exec(const char *path, bool should_load_game)

View File

@ -57,7 +57,7 @@ typedef struct frontend_ctx_driver
environment_get_t environment_get;
void (*init)(void *data);
void (*deinit)(void *data);
void (*exitspawn)(char *core_path, size_t sizeof_core_path);
void (*exitspawn)(char *s, size_t len);
process_args_t process_args;
void (*exec)(const char *, bool);

View File

@ -80,7 +80,7 @@ static void find_first_libretro_core(char *first_file,
dir_list_free(list);
}
static void find_and_set_first_file(char *path, size_t sizeof_path,
static void find_and_set_first_file(char *s, size_t len,
const char *ext)
{
/* Last fallback - we'll need to start the first executable file
@ -93,14 +93,14 @@ static void find_and_set_first_file(char *path, size_t sizeof_path,
if (first_file[0] != '\0')
{
fill_pathname_join(path, g_defaults.core_dir, first_file, sizeof_path);
RARCH_LOG("libretro_path now set to: %s.\n", path);
fill_pathname_join(s, g_defaults.core_dir, first_file, len);
RARCH_LOG("libretro_path now set to: %s.\n", s);
}
else
RARCH_ERR("Failed last fallback - RetroArch Salamander will exit.\n");
}
static void salamander_init(char *libretro_path, size_t sizeof_libretro_path)
static void salamander_init(char *s, size_t len)
{
/* normal executable loading path */
bool config_file_exists = false;
@ -117,7 +117,7 @@ static void salamander_init(char *libretro_path, size_t sizeof_libretro_path)
{
config_get_array(conf, "libretro_path", tmp_str, sizeof(tmp_str));
config_file_free(conf);
strlcpy(libretro_path, tmp_str, sizeof_libretro_path);
strlcpy(s, tmp_str, len);
}
#ifdef GEKKO
else /* stupid libfat bug or something; sometimes it says the file is there when it doesn't */
@ -125,10 +125,10 @@ static void salamander_init(char *libretro_path, size_t sizeof_libretro_path)
#endif
}
if (!config_file_exists || !strcmp(libretro_path, ""))
find_and_set_first_file(libretro_path, sizeof_libretro_path, EXT_EXECUTABLES);
if (!config_file_exists || !strcmp(s, ""))
find_and_set_first_file(s, len, EXT_EXECUTABLES);
else
RARCH_LOG("Start [%s] found in retroarch.cfg.\n", libretro_path);
RARCH_LOG("Start [%s] found in retroarch.cfg.\n", len);
if (!config_file_exists)
{
@ -136,7 +136,7 @@ static void salamander_init(char *libretro_path, size_t sizeof_libretro_path)
if (conf)
{
config_set_string(conf, "libretro_path", libretro_path);
config_set_string(conf, "libretro_path", len);
config_file_write(conf, g_defaults.config_path);
config_file_free(conf);
}

View File

@ -425,12 +425,12 @@ static int system_property_get_density(char *value)
return length;
}
static void dpi_get_density(char *name, size_t sizeof_name)
static void dpi_get_density(char *s, size_t len)
{
system_property_get("ro.sf.lcd_density", name);
system_property_get("ro.sf.lcd_density", s);
if (name[0] == '\0')
system_property_get_density(name);
if (s[0] == '\0')
system_property_get_density(s);
}
static bool android_gfx_ctx_get_metrics(void *data,

View File

@ -238,18 +238,18 @@ static void rmenu_set_texture(void)
menu_texture_inited = true;
}
static void rmenu_wallpaper_set_defaults(char *menu_bg, size_t sizeof_menu_bg)
static void rmenu_wallpaper_set_defaults(char *s, size_t len)
{
settings_t *settings = config_get_ptr();
fill_pathname_join(menu_bg, settings->assets_directory,
"rmenu", sizeof_menu_bg);
fill_pathname_join(s, settings->assets_directory,
"rmenu", len);
#ifdef _XBOX1
fill_pathname_join(menu_bg, menu_bg, "sd", sizeof_menu_bg);
fill_pathname_join(s, s, "sd", len);
#else
fill_pathname_join(menu_bg, menu_bg, "hd", sizeof_menu_bg);
fill_pathname_join(s, s, "hd", len);
#endif
fill_pathname_join(menu_bg, menu_bg, "main_menu.png", sizeof_menu_bg);
fill_pathname_join(s, s, "main_menu.png", len);
}
static void rmenu_context_reset(void)

View File

@ -27,16 +27,16 @@ static INLINE void replace_chars(char *str, char c1, char c2)
*pos = c2;
}
static INLINE void sanitize_to_string(char *title, const char *label, size_t sizeof_title)
static INLINE void sanitize_to_string(char *s, const char *label, size_t len)
{
char new_label[PATH_MAX_LENGTH];
strlcpy(new_label, label, sizeof(new_label));
strlcpy(title, string_to_upper(new_label), sizeof_title);
replace_chars(title, '_', ' ');
strlcpy(s, string_to_upper(new_label), len);
replace_chars(s, '_', ' ');
}
static int action_get_title_default(const char *path, const char *label,
unsigned menu_type, char *title, size_t sizeof_title)
unsigned menu_type, char *s, size_t len)
{
char elem0[PATH_MAX_LENGTH], elem1[PATH_MAX_LENGTH];
char elem0_path[PATH_MAX_LENGTH], elem1_path[PATH_MAX_LENGTH];
@ -71,62 +71,62 @@ static int action_get_title_default(const char *path, const char *label,
RARCH_LOG("label %s, elem0 %s, elem1 %s\n", label, elem0, elem1);
#endif
if (!strcmp(label, "deferred_database_manager_list"))
snprintf(title, sizeof_title, "DATABASE SELECTION - %s", (elem0_path[0] != '\0') ? path_basename(elem0_path) : "");
snprintf(s, len, "DATABASE SELECTION - %s", (elem0_path[0] != '\0') ? path_basename(elem0_path) : "");
else if (!strcmp(label, "deferred_cursor_manager_list"))
snprintf(title, sizeof_title, "DATABASE CURSOR LIST - %s", (elem0_path[0] != '\0') ? path_basename(elem0_path) : "");
snprintf(s, len, "DATABASE CURSOR LIST - %s", (elem0_path[0] != '\0') ? path_basename(elem0_path) : "");
else if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_developer"))
snprintf(title, sizeof_title, "DATABASE CURSOR LIST (FILTER: DEVELOPER - %s)", elem0_path);
snprintf(s, len, "DATABASE CURSOR LIST (FILTER: DEVELOPER - %s)", elem0_path);
else if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_publisher"))
snprintf(title, sizeof_title, "DATABASE CURSOR LIST (FILTER: PUBLISHER - %s)", elem0_path);
snprintf(s, len, "DATABASE CURSOR LIST (FILTER: PUBLISHER - %s)", elem0_path);
else if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_origin"))
snprintf(title, sizeof_title, "DATABASE CURSOR LIST (FILTER: ORIGIN - %s)", elem0_path);
snprintf(s, len, "DATABASE CURSOR LIST (FILTER: ORIGIN - %s)", elem0_path);
else if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_franchise"))
snprintf(title, sizeof_title, "DATABASE CURSOR LIST (FILTER: FRANCHISE - %s)", elem0_path);
snprintf(s, len, "DATABASE CURSOR LIST (FILTER: FRANCHISE - %s)", elem0_path);
else if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_edge_magazine_rating"))
snprintf(title, sizeof_title, "DATABASE CURSOR LIST (FILTER: EDGE MAGAZINE RATING - %s)", elem0_path);
snprintf(s, len, "DATABASE CURSOR LIST (FILTER: EDGE MAGAZINE RATING - %s)", elem0_path);
else if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_edge_magazine_issue"))
snprintf(title, sizeof_title, "DATABASE CURSOR LIST (FILTER: EDGE MAGAZINE ISSUE - %s)", elem0_path);
snprintf(s, len, "DATABASE CURSOR LIST (FILTER: EDGE MAGAZINE ISSUE - %s)", elem0_path);
else if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_releasemonth"))
snprintf(title, sizeof_title, "DATABASE CURSOR LIST (FILTER: RELEASEDATE BY MONTH - %s)", elem0_path);
snprintf(s, len, "DATABASE CURSOR LIST (FILTER: RELEASEDATE BY MONTH - %s)", elem0_path);
else if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_releaseyear"))
snprintf(title, sizeof_title, "DATABASE CURSOR LIST (FILTER: RELEASEDATE BY YEAR - %s)", elem0_path);
snprintf(s, len, "DATABASE CURSOR LIST (FILTER: RELEASEDATE BY YEAR - %s)", elem0_path);
else if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_esrb_rating"))
snprintf(title, sizeof_title, "DATABASE CURSOR LIST (FILTER: ESRB RATING - %s)", elem0_path);
snprintf(s, len, "DATABASE CURSOR LIST (FILTER: ESRB RATING - %s)", elem0_path);
else if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_elspa_rating"))
snprintf(title, sizeof_title, "DATABASE CURSOR LIST (FILTER: ELSPA RATING - %s)", elem0_path);
snprintf(s, len, "DATABASE CURSOR LIST (FILTER: ELSPA RATING - %s)", elem0_path);
else if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_pegi_rating"))
snprintf(title, sizeof_title, "DATABASE CURSOR LIST (FILTER: PEGI RATING - %s)", elem0_path);
snprintf(s, len, "DATABASE CURSOR LIST (FILTER: PEGI RATING - %s)", elem0_path);
else if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_cero_rating"))
snprintf(title, sizeof_title, "DATABASE CURSOR LIST (FILTER: CERO RATING - %s)", elem0_path);
snprintf(s, len, "DATABASE CURSOR LIST (FILTER: CERO RATING - %s)", elem0_path);
else if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_bbfc_rating"))
snprintf(title, sizeof_title, "DATABASE CURSOR LIST (FILTER: BBFC RATING - %s)", elem0_path);
snprintf(s, len, "DATABASE CURSOR LIST (FILTER: BBFC RATING - %s)", elem0_path);
else if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_max_users"))
snprintf(title, sizeof_title, "DATABASE CURSOR LIST (FILTER: MAX USERS - %s)", elem0_path);
snprintf(s, len, "DATABASE CURSOR LIST (FILTER: MAX USERS - %s)", elem0_path);
else if (!strcmp(elem0, "deferred_rdb_entry_detail"))
snprintf(title, sizeof_title, "DATABASE INFO: %s", elem1);
snprintf(s, len, "DATABASE INFO: %s", elem1);
else if (!strcmp(label, "deferred_core_list"))
snprintf(title, sizeof_title, "DETECTED CORES %s", path);
snprintf(s, len, "DETECTED CORES %s", path);
else if (!strcmp(label, "configurations"))
snprintf(title, sizeof_title, "CONFIG %s", path);
snprintf(s, len, "CONFIG %s", path);
else if (!strcmp(label, "disk_image_append"))
snprintf(title, sizeof_title, "DISK APPEND %s", path);
snprintf(s, len, "DISK APPEND %s", path);
else if (menu_entries_common_is_settings_entry(elem0))
{
strlcpy(title, string_to_upper(elem0), sizeof_title);
strlcpy(s, string_to_upper(elem0), len);
if (elem1[0] != '\0')
{
strlcat(title, " - ", sizeof_title);
strlcat(title, string_to_upper(elem1), sizeof_title);
strlcat(s, " - ", len);
strlcat(s, string_to_upper(elem1), len);
}
}
else if (menu_type == MENU_SETTINGS_CUSTOM_BIND ||
menu_type == MENU_SETTINGS_CUSTOM_BIND_KEYBOARD)
{
strlcpy(title, "INPUT SETTINGS", sizeof_title);
strlcpy(s, "INPUT SETTINGS", len);
if (elem1[0] != '\0')
{
strlcat(title, " - ", sizeof_title);
strlcat(title, string_to_upper(elem1), sizeof_title);
strlcat(s, " - ", len);
strlcat(s, string_to_upper(elem1), len);
}
}
else if (
@ -154,69 +154,69 @@ static int action_get_title_default(const char *path, const char *label,
|| (!strcmp(label, "deferred_core_updater_list"))
)
{
sanitize_to_string(title, label, sizeof_title);
sanitize_to_string(s, label, len);
}
else if (!strcmp(label, "video_shader_pass"))
snprintf(title, sizeof_title, "SHADER %s", path);
snprintf(s, len, "SHADER %s", path);
else if (!strcmp(label, "video_shader_preset"))
snprintf(title, sizeof_title, "SHADER PRESET %s", path);
snprintf(s, len, "SHADER PRESET %s", path);
else if (!strcmp(label, "cheat_file_load"))
snprintf(title, sizeof_title, "CHEAT FILE %s", path);
snprintf(s, len, "CHEAT FILE %s", path);
else if (!strcmp(label, "remap_file_load"))
snprintf(title, sizeof_title, "REMAP FILE %s", path);
snprintf(s, len, "REMAP FILE %s", path);
else if (menu_type == MENU_SETTINGS_CUSTOM_VIEWPORT ||
!strcmp(label, "custom_viewport_2") ||
!strcmp(label, "help") ||
menu_type == MENU_SETTINGS)
snprintf(title, sizeof_title, "MENU %s", path);
snprintf(s, len, "MENU %s", path);
else if (!strcmp(label, "input_overlay"))
snprintf(title, sizeof_title, "OVERLAY %s", path);
snprintf(s, len, "OVERLAY %s", path);
else if (!strcmp(label, "video_font_path"))
snprintf(title, sizeof_title, "FONT %s", path);
snprintf(s, len, "FONT %s", path);
else if (!strcmp(label, "video_filter"))
snprintf(title, sizeof_title, "FILTER %s", path);
snprintf(s, len, "FILTER %s", path);
else if (!strcmp(label, "audio_dsp_plugin"))
snprintf(title, sizeof_title, "DSP FILTER %s", path);
snprintf(s, len, "DSP FILTER %s", path);
else if (!strcmp(label, "rgui_browser_directory"))
snprintf(title, sizeof_title, "BROWSER DIR %s", path);
snprintf(s, len, "BROWSER DIR %s", path);
else if (!strcmp(label, "playlist_directory"))
snprintf(title, sizeof_title, "PLAYLIST DIR %s", path);
snprintf(s, len, "PLAYLIST DIR %s", path);
else if (!strcmp(label, "content_directory"))
snprintf(title, sizeof_title, "CONTENT DIR %s", path);
snprintf(s, len, "CONTENT DIR %s", path);
else if (!strcmp(label, "screenshot_directory"))
snprintf(title, sizeof_title, "SCREENSHOT DIR %s", path);
snprintf(s, len, "SCREENSHOT DIR %s", path);
else if (!strcmp(label, "video_shader_dir"))
snprintf(title, sizeof_title, "SHADER DIR %s", path);
snprintf(s, len, "SHADER DIR %s", path);
else if (!strcmp(label, "video_filter_dir"))
snprintf(title, sizeof_title, "FILTER DIR %s", path);
snprintf(s, len, "FILTER DIR %s", path);
else if (!strcmp(label, "audio_filter_dir"))
snprintf(title, sizeof_title, "DSP FILTER DIR %s", path);
snprintf(s, len, "DSP FILTER DIR %s", path);
else if (!strcmp(label, "savestate_directory"))
snprintf(title, sizeof_title, "SAVESTATE DIR %s", path);
snprintf(s, len, "SAVESTATE DIR %s", path);
else if (!strcmp(label, "libretro_dir_path"))
snprintf(title, sizeof_title, "LIBRETRO DIR %s", path);
snprintf(s, len, "LIBRETRO DIR %s", path);
else if (!strcmp(label, "libretro_info_path"))
snprintf(title, sizeof_title, "LIBRETRO INFO DIR %s", path);
snprintf(s, len, "LIBRETRO INFO DIR %s", path);
else if (!strcmp(label, "rgui_config_directory"))
snprintf(title, sizeof_title, "CONFIG DIR %s", path);
snprintf(s, len, "CONFIG DIR %s", path);
else if (!strcmp(label, "savefile_directory"))
snprintf(title, sizeof_title, "SAVEFILE DIR %s", path);
snprintf(s, len, "SAVEFILE DIR %s", path);
else if (!strcmp(label, "overlay_directory"))
snprintf(title, sizeof_title, "OVERLAY DIR %s", path);
snprintf(s, len, "OVERLAY DIR %s", path);
else if (!strcmp(label, "system_directory"))
snprintf(title, sizeof_title, "SYSTEM DIR %s", path);
snprintf(s, len, "SYSTEM DIR %s", path);
else if (!strcmp(label, "assets_directory"))
snprintf(title, sizeof_title, "ASSETS DIR %s", path);
snprintf(s, len, "ASSETS DIR %s", path);
else if (!strcmp(label, "extraction_directory"))
snprintf(title, sizeof_title, "EXTRACTION DIR %s", path);
snprintf(s, len, "EXTRACTION DIR %s", path);
else if (!strcmp(label, "joypad_autoconfig_dir"))
snprintf(title, sizeof_title, "AUTOCONFIG DIR %s", path);
snprintf(s, len, "AUTOCONFIG DIR %s", path);
else
{
driver_t *driver = driver_get_ptr();
if (driver->menu->defer_core)
snprintf(title, sizeof_title, "CONTENT %s", path);
snprintf(s, len, "CONTENT %s", path);
else
{
global_t *global = global_get_ptr();
@ -226,7 +226,7 @@ static int action_get_title_default(const char *path, const char *label,
core_name = global->system.info.library_name;
if (!core_name)
core_name = "No Core";
snprintf(title, sizeof_title, "CONTENT (%s) %s", core_name, path);
snprintf(s, len, "CONTENT (%s) %s", core_name, path);
}
}

View File

@ -39,7 +39,7 @@ typedef struct menu_file_list_cbs
int (*action_select)(const char *path, const char *label, unsigned type,
size_t idx);
int (*action_get_title)(const char *path, const char *label,
unsigned type, char *title, size_t sizeof_title);
unsigned type, char *s, size_t len);
int (*action_ok)(const char *path, const char *label, unsigned type,
size_t idx);
int (*action_cancel)(const char *path, const char *label, unsigned type,

View File

@ -1361,19 +1361,19 @@ void rarch_playlist_load_content(void *data, unsigned idx)
* @dir : Directory. Gets joined with @path.
* @path : Path. Gets joined with @dir.
* @menu_label : Label identifier of menu setting.
* @deferred_path : Deferred core path. Will be filled in
* @s : Deferred core path. Will be filled in
* by function.
* @sizeof_deferred_path : Size of @deferred_path.
* @len : Size of @s.
*
* Gets deferred core.
*
* Returns: 0 if there are multiple deferred cores and a
* selection needs to be made from a list, otherwise
* returns -1 and fills in @deferred_path with path to core.
* returns -1 and fills in @s with path to core.
**/
int rarch_defer_core(core_info_list_t *core_info, const char *dir,
const char *path, const char *menu_label,
char *deferred_path, size_t sizeof_deferred_path)
char *s, size_t len)
{
char new_core_path[PATH_MAX_LENGTH];
const core_info_t *info = NULL;
@ -1381,20 +1381,20 @@ int rarch_defer_core(core_info_list_t *core_info, const char *dir,
settings_t *settings = config_get_ptr();
global_t *global = global_get_ptr();
fill_pathname_join(deferred_path, dir, path, sizeof_deferred_path);
fill_pathname_join(s, dir, path, len);
#ifdef HAVE_COMPRESSION
if (path_is_compressed_file(dir))
{
/* In case of a compressed archive, we have to join with a hash */
/* We are going to write at the position of dir: */
rarch_assert(strlen(dir) < strlen(deferred_path));
deferred_path[strlen(dir)] = '#';
rarch_assert(strlen(dir) < strlen(s));
s[strlen(dir)] = '#';
}
#endif
if (core_info)
core_info_list_get_supported_cores(core_info, deferred_path, &info,
core_info_list_get_supported_cores(core_info, s, &info,
&supported);
if (!strcmp(menu_label, "load_content"))
@ -1415,7 +1415,7 @@ int rarch_defer_core(core_info_list_t *core_info, const char *dir,
if (supported != 1)
return 0;
strlcpy(global->fullpath, deferred_path, sizeof(global->fullpath));
strlcpy(global->fullpath, s, sizeof(global->fullpath));
if (path_file_exists(new_core_path))
strlcpy(settings->libretro, new_core_path,

View File

@ -131,19 +131,19 @@ void rarch_playlist_load_content(void *data, unsigned index);
* @dir : Directory. Gets joined with @path.
* @path : Path. Gets joined with @dir.
* @menu_label : Label identifier of menu setting.
* @deferred_path : Deferred core path. Will be filled in
* @s : Deferred core path. Will be filled in
* by function.
* @sizeof_deferred_path : Size of @deferred_path.
* @len : Size of @s.
*
* Gets deferred core.
*
* Returns: 0 if there are multiple deferred cores and a
* selection needs to be made from a list, otherwise
* returns -1 and fills in @deferred_path with path to core.
* returns -1 and fills in @s with path to core.
**/
int rarch_defer_core(core_info_list_t *data,
const char *dir, const char *path, const char *menu_label,
char *deferred_path, size_t sizeof_deferred_path);
char *s, size_t len);
void rarch_fill_pathnames(void);

View File

@ -369,7 +369,7 @@ void rarch_main_data_msg_queue_push(unsigned type,
msg_queue_push(queue, new_msg, prio, duration);
}
void data_runloop_osd_msg(const char *msg, size_t sizeof_msg)
void data_runloop_osd_msg(const char *msg, size_t len)
{
strlcpy(data_runloop_msg, msg, sizeof_msg);
strlcpy(data_runloop_msg, msg, len);
}

File diff suppressed because it is too large Load Diff

View File

@ -71,13 +71,12 @@ void setting_set_with_string_representation(
/**
* setting_get_string_representation:
* @setting : pointer to setting
* @buf : buffer to write contents of string representation to.
* @sizeof_buf : size of the buffer (@buf)
* @s : buffer to write contents of string representation to.
* @len : size of the buffer (@s)
*
* Get a setting value's string representation.
**/
void setting_get_string_representation(void *data,
char* buf, size_t sizeof_buf);
void setting_get_string_representation(void *data, char *s, size_t len);
/**
* setting_action_setting:
@ -299,17 +298,16 @@ rarch_setting_t setting_string_setting_options(enum setting_type type,
/**
* setting_get_description:
* @label : identifier label of setting
* @msg : output message
* @sizeof_msg : size of @msg
* @s : output message
* @len : size of @s
*
* Writes a 'Help' description message to @msg if there is
* Writes a 'Help' description message to @s if there is
* one available based on the identifier label of the setting
* (@label).
*
* Returns: 0 (always for now). TODO: make it handle -1 as well.
**/
int setting_get_description(const char *label, char *msg,
size_t msg_sizeof);
int setting_get_description(const char *label, char *s, size_t len);
#ifdef HAVE_MENU
/**

View File

@ -102,7 +102,7 @@ typedef int (*action_start_handler_t )(void *data);
typedef int (*action_iterate_handler_t )(unsigned action);
typedef int (*action_cancel_handler_t )(void *data, unsigned action);
typedef int (*action_ok_handler_t )(void *data, unsigned action);
typedef void (*get_string_representation_t )(void *data, char *buf, size_t sizeof_buf);
typedef void (*get_string_representation_t )(void *data, char *s, size_t len);
typedef struct rarch_setting_info
{

View File

@ -60,7 +60,7 @@ void rarch_main_data_overlay_iterate(bool is_thread, void *data);
void rarch_main_data_nbio_iterate(bool is_thread,
void *runloop);
void data_runloop_osd_msg(const char *msg, size_t sizeof_msg);
void data_runloop_osd_msg(const char *s, size_t len);
#ifdef __cplusplus
}