mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-27 02:00:41 +00:00
(menu) Start going through string_is_empty
This commit is contained in:
parent
1439a36174
commit
66449802e4
@ -14,6 +14,7 @@
|
||||
*/
|
||||
|
||||
#include <file/file_path.h>
|
||||
#include <string/stdstring.h>
|
||||
|
||||
#include "../menu_driver.h"
|
||||
#include "../menu_cbs.h"
|
||||
@ -189,7 +190,7 @@ static int deferred_push_cursor_manager_list_deferred_query_subsearch(menu_displ
|
||||
|
||||
database_info_build_query(query, sizeof(query), info->label, str_list->elems[0].data);
|
||||
|
||||
if (query[0] == '\0')
|
||||
if (string_is_empty(query))
|
||||
goto end;
|
||||
|
||||
strlcpy(info->path, str_list->elems[1].data, sizeof(info->path));
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
#include <file/file_path.h>
|
||||
#include <retro_stat.h>
|
||||
#include <string/stdstring.h>
|
||||
|
||||
#include "../menu_driver.h"
|
||||
#include "../menu_cbs.h"
|
||||
@ -228,10 +229,10 @@ int generic_action_ok_displaylist_push(const char *path,
|
||||
case ACTION_OK_DL_CONFIGURATIONS_LIST:
|
||||
info.type = type;
|
||||
info.directory_ptr = idx;
|
||||
if (settings->menu_config_directory[0] != '\0')
|
||||
info_path = settings->menu_config_directory;
|
||||
else
|
||||
if (string_is_empty(settings->menu_config_directory))
|
||||
info_path = label;
|
||||
else
|
||||
info_path = settings->menu_config_directory;
|
||||
info_label = label;
|
||||
break;
|
||||
case ACTION_OK_DL_COMPRESSED_ARCHIVE_PUSH_DETECT_CORE:
|
||||
@ -1317,9 +1318,9 @@ static int action_ok_option_create(const char *path,
|
||||
/* Config directory: config_directory.
|
||||
* Try config directory setting first,
|
||||
* fallback to the location of the current configuration file. */
|
||||
if (settings->menu_config_directory[0] != '\0')
|
||||
if (!string_is_empty(settings->menu_config_directory))
|
||||
strlcpy(config_directory, settings->menu_config_directory, PATH_MAX_LENGTH);
|
||||
else if (global->path.config[0] != '\0')
|
||||
else if (!string_is_empty(global->path.config))
|
||||
fill_pathname_basedir(config_directory, global->path.config, PATH_MAX_LENGTH);
|
||||
else
|
||||
{
|
||||
@ -1327,12 +1328,10 @@ static int action_ok_option_create(const char *path,
|
||||
return false;
|
||||
}
|
||||
|
||||
core_name = system ? system->info.library_name : NULL;
|
||||
core_name = system ? system->info.library_name : NULL;
|
||||
game_name = global ? path_basename(global->name.base) : NULL;
|
||||
|
||||
if (!core_name || !game_name)
|
||||
return false;
|
||||
if (core_name[0] == '\0' || game_name == '\0')
|
||||
if (string_is_empty(core_name) || string_is_empty(game_name))
|
||||
return false;
|
||||
|
||||
/* Concatenate strings into full paths for game_path */
|
||||
@ -1443,7 +1442,7 @@ static int generic_action_ok_network(const char *path,
|
||||
|
||||
menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh);
|
||||
|
||||
if (settings->network.buildbot_url[0] == '\0')
|
||||
if (string_is_empty(settings->network.buildbot_url))
|
||||
return -1;
|
||||
|
||||
event_command(EVENT_CMD_NETWORK_INIT);
|
||||
@ -1964,7 +1963,7 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs,
|
||||
{
|
||||
uint32_t elem0_hash = menu_hash_calculate(elem0);
|
||||
|
||||
if (elem0[0] != '\0' && (is_rdb_entry(elem0_hash) == 0))
|
||||
if (!string_is_empty(elem0) && (is_rdb_entry(elem0_hash) == 0))
|
||||
{
|
||||
BIND_ACTION_OK(cbs, action_ok_rdb_entry_submenu);
|
||||
return 0;
|
||||
|
@ -131,7 +131,7 @@ static int action_get_title_generic(char *s, size_t len, const char *path,
|
||||
{
|
||||
struct string_list *list_path = NULL;
|
||||
|
||||
if (path && path[0] != '\0')
|
||||
if (!string_is_empty(path))
|
||||
list_path = string_split(path, "|");
|
||||
|
||||
if (list_path)
|
||||
@ -141,7 +141,7 @@ static int action_get_title_generic(char *s, size_t len, const char *path,
|
||||
strlcpy(elem0_path, list_path->elems[0].data, sizeof(elem0_path));
|
||||
string_list_free(list_path);
|
||||
snprintf(s, len, "%s - %s", text,
|
||||
(elem0_path[0] != '\0') ? path_basename(elem0_path) : "");
|
||||
(string_is_empty(elem0_path)) ? "" : path_basename(elem0_path));
|
||||
}
|
||||
else
|
||||
strlcpy(s, "N/A", len);
|
||||
@ -284,7 +284,7 @@ static int action_get_title_group_settings(const char *path, const char *label,
|
||||
|
||||
strlcpy(s, elem0, len);
|
||||
|
||||
if (elem1[0] != '\0')
|
||||
if (!string_is_empty(elem1))
|
||||
{
|
||||
strlcat(s, " - ", len);
|
||||
strlcat(s, elem1, len);
|
||||
|
@ -19,13 +19,13 @@
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <string/stdstring.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include <compat/posix_string.h>
|
||||
#include <file/file_path.h>
|
||||
#include <formats/image.h>
|
||||
#include <gfx/math/matrix_4x4.h>
|
||||
#include <string/stdstring.h>
|
||||
#include <string/string_list.h>
|
||||
|
||||
#include "menu_generic.h"
|
||||
@ -154,7 +154,7 @@ static void mui_context_reset_textures(mui_handle_t *mui, const char *iconpath)
|
||||
break;
|
||||
}
|
||||
|
||||
if (path[0] == '\0' || !path_file_exists(path))
|
||||
if (string_is_empty(path) || !path_file_exists(path))
|
||||
continue;
|
||||
|
||||
texture_image_load(&ti, path);
|
||||
@ -862,7 +862,7 @@ static void mui_frame(void *data)
|
||||
mui_render_messagebox(msg);
|
||||
}
|
||||
|
||||
if (mui->box_message[0] != '\0')
|
||||
if (!string_is_empty(mui->box_message))
|
||||
{
|
||||
mui_render_quad(mui, 0, 0, width, height, width, height, &black_bg[0]);
|
||||
mui_render_messagebox(mui->box_message);
|
||||
|
@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
#include <compat/strl.h>
|
||||
#include <string/stdstring.h>
|
||||
|
||||
#include "menu_generic.h"
|
||||
|
||||
@ -355,7 +356,7 @@ int menu_iterate_render(void *data, void *userdata)
|
||||
if (BIT64_GET(menu->state, MENU_STATE_RENDER_FRAMEBUFFER))
|
||||
menu_display_ctl(MENU_DISPLAY_CTL_SET_FRAMEBUFFER_DIRTY_FLAG, NULL);
|
||||
|
||||
if (BIT64_GET(menu->state, MENU_STATE_RENDER_MESSAGEBOX) && menu->menu_state.msg[0] != '\0')
|
||||
if (BIT64_GET(menu->state, MENU_STATE_RENDER_MESSAGEBOX) && !string_is_empty(menu->menu_state.msg))
|
||||
{
|
||||
menu_driver_ctl(RARCH_MENU_CTL_RENDER_MESSAGEBOX, NULL);
|
||||
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include <string/stdstring.h>
|
||||
#include <string/string_list.h>
|
||||
#include <compat/posix_string.h>
|
||||
#include <file/file_path.h>
|
||||
@ -635,7 +636,7 @@ static void rgui_render(void *data)
|
||||
rgui_render_messagebox(msg);
|
||||
}
|
||||
|
||||
if (rgui->msgbox[0] != '\0')
|
||||
if (!string_is_empty(rgui->msgbox))
|
||||
{
|
||||
rgui_render_messagebox(rgui->msgbox);
|
||||
rgui->msgbox[0] = '\0';
|
||||
|
@ -1446,7 +1446,7 @@ static void xmb_draw_items(xmb_handle_t *xmb,
|
||||
}
|
||||
|
||||
ticker_limit = 35;
|
||||
if (entry.value[0] == '\0')
|
||||
if (string_is_empty(entry.value))
|
||||
{
|
||||
if (settings->menu.boxart_enable && xmb->boxart)
|
||||
ticker_limit = 40;
|
||||
@ -1759,7 +1759,7 @@ static void xmb_frame(void *data)
|
||||
render_background = true;
|
||||
}
|
||||
|
||||
if (xmb->box_message[0] != '\0')
|
||||
if (!string_is_empty(xmb->box_message))
|
||||
{
|
||||
strlcpy(msg, xmb->box_message,
|
||||
sizeof(msg));
|
||||
@ -2150,7 +2150,7 @@ static void xmb_context_reset_textures(xmb_handle_t *xmb, const char *iconpath)
|
||||
break;
|
||||
}
|
||||
|
||||
if (path[0] == '\0' || !path_file_exists(path))
|
||||
if (string_is_empty(path) || !path_file_exists(path))
|
||||
continue;
|
||||
|
||||
texture_image_load(&ti, path);
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include <file/dir_list.h>
|
||||
#include <compat/posix_string.h>
|
||||
#include <gfx/math/matrix_4x4.h>
|
||||
#include <string/stdstring.h>
|
||||
#include <formats/image.h>
|
||||
#include <compat/strl.h>
|
||||
#include <retro_stat.h>
|
||||
@ -691,7 +692,7 @@ static int zarch_zui_render_lay_root_load(zui_t *zui, zui_tabbed_t *tabbed)
|
||||
if (zui->load_dlist)
|
||||
{
|
||||
fill_pathname_parent_dir(parent_dir, zui->load_cwd, sizeof(parent_dir));
|
||||
if (parent_dir[0] != '\0' &&
|
||||
if (!string_is_empty(parent_dir) &&
|
||||
zarch_zui_list_item(zui, tabbed, 0, tabbed->tabline_size + 73, " ..", 0, NULL /* TODO/FIXME */))
|
||||
{
|
||||
zarch_zui_render_lay_root_load_set_new_path(zui, parent_dir);
|
||||
@ -1082,7 +1083,7 @@ static void *zarch_init(void **userdata)
|
||||
zui->header_height = 1000; /* dpi / 3; */
|
||||
zui->font_size = 28;
|
||||
|
||||
if (settings->menu.wallpaper[0] != '\0')
|
||||
if (!string_is_empty(settings->menu.wallpaper))
|
||||
rarch_task_push_image_load(settings->menu.wallpaper,
|
||||
"cb_menu_wallpaper", menu_display_handle_wallpaper_upload, NULL);
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include <compat/strl.h>
|
||||
#include <string/stdstring.h>
|
||||
|
||||
#include "../menu_hash.h"
|
||||
#include "../../configuration.h"
|
||||
@ -2710,7 +2711,7 @@ int menu_hash_get_help_us(uint32_t hash, char *s, size_t len)
|
||||
menu_hash_to_str(MENU_LABEL_VALUE_INPUT_OVERLAY_HIDE_IN_MENU)
|
||||
);
|
||||
default:
|
||||
if (s[0] == '\0')
|
||||
if (string_is_empty(s))
|
||||
strlcpy(s, menu_hash_to_str(MENU_LABEL_VALUE_NO_INFORMATION_AVAILABLE), len);
|
||||
return -1;
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include <compat/strl.h>
|
||||
#include <string/stdstring.h>
|
||||
|
||||
#include "../menu_hash.h"
|
||||
#include "../../configuration.h"
|
||||
@ -2576,7 +2577,7 @@ int menu_hash_get_help_us(uint32_t hash, char *s, size_t len)
|
||||
menu_hash_to_str(MENU_LABEL_VALUE_INPUT_OVERLAY_HIDE_IN_MENU)
|
||||
);
|
||||
default:
|
||||
if (s[0] == '\0')
|
||||
if (string_is_empty(s))
|
||||
strlcpy(s, menu_hash_to_str(MENU_LABEL_VALUE_NO_INFORMATION_AVAILABLE), len);
|
||||
return -1;
|
||||
}
|
||||
|
@ -14,6 +14,7 @@
|
||||
*/
|
||||
|
||||
#include <compat/strl.h>
|
||||
#include <string/stdstring.h>
|
||||
#include <string/string_list.h>
|
||||
|
||||
#include "menu_driver.h"
|
||||
@ -28,7 +29,7 @@
|
||||
static void menu_cbs_init_log(const char *entry_label, const char *bind_label, const char *label)
|
||||
{
|
||||
#ifdef DEBUG_LOG
|
||||
if (label && label[0] != '\0')
|
||||
if (!string_is_empty(label))
|
||||
RARCH_LOG("[%s]\t\t\tFound %s bind : [%s]\n", entry_label, bind_label, label);
|
||||
#endif
|
||||
}
|
||||
@ -73,7 +74,7 @@ void menu_cbs_init(void *data,
|
||||
RARCH_LOG("\n");
|
||||
#endif
|
||||
|
||||
repr_label = (label && label[0] != '\0') ? label : path;
|
||||
repr_label = (!string_is_empty(label)) ? label : path;
|
||||
|
||||
ret = menu_cbs_init_bind_ok(cbs, path, label, type, idx, elem0, elem1, menu_label, label_hash, menu_label_hash);
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include <file/file_extract.h>
|
||||
#include <file/dir_list.h>
|
||||
#include <retro_stat.h>
|
||||
#include <string/stdstring.h>
|
||||
|
||||
#include "menu_driver.h"
|
||||
#include "menu_navigation.h"
|
||||
@ -947,10 +948,10 @@ static int menu_displaylist_parse_playlist(menu_displaylist_info_t *info,
|
||||
fill_short_pathname_representation(path_short, path,
|
||||
sizeof(path_short));
|
||||
strlcpy(fill_buf,
|
||||
(label && label[0] != '\0') ? label : path_short,
|
||||
(!string_is_empty(label)) ? label : path_short,
|
||||
sizeof(fill_buf));
|
||||
|
||||
if (core_name && core_name[0] != '\0')
|
||||
if (!string_is_empty(core_name))
|
||||
{
|
||||
if (core_name_hash != MENU_VALUE_DETECT)
|
||||
{
|
||||
@ -1484,7 +1485,7 @@ static int menu_database_parse_query(file_list_t *list, const char *path,
|
||||
|
||||
for (i = 0; i < db_list->count; i++)
|
||||
{
|
||||
if (db_list->list[i].name && db_list->list[i].name[0] != '\0')
|
||||
if (!string_is_empty(db_list->list[i].name))
|
||||
menu_entries_push(list, db_list->list[i].name,
|
||||
path, MENU_FILE_RDB_ENTRY, 0, 0);
|
||||
}
|
||||
@ -1833,7 +1834,7 @@ static int menu_displaylist_parse_horizontal_content_actions(menu_displaylist_in
|
||||
content_playlist_get_index(playlist, idx,
|
||||
NULL, &label, &core_path, &core_name, NULL, &db_name);
|
||||
|
||||
if (db_name && db_name[0] != '\0')
|
||||
if (!string_is_empty(db_name))
|
||||
{
|
||||
char db_path[PATH_MAX_LENGTH] = {0};
|
||||
|
||||
@ -2156,7 +2157,7 @@ static int menu_displaylist_parse_generic(menu_displaylist_info_t *info, bool ho
|
||||
char out_dir[PATH_MAX_LENGTH];
|
||||
fill_pathname_parent_dir(out_dir, info->path, sizeof(out_dir));
|
||||
|
||||
if (out_dir[0] != '\0')
|
||||
if (!string_is_empty(out_dir))
|
||||
{
|
||||
menu_entries_push(info->list, "..", info->path,
|
||||
MENU_FILE_PARENT_DIRECTORY, 0, 0);
|
||||
@ -2900,7 +2901,7 @@ int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type)
|
||||
break;
|
||||
case DISPLAYLIST_DATABASE_QUERY:
|
||||
ret = menu_database_parse_query(info->list,
|
||||
info->path, (info->path_c[0] == '\0') ? NULL : info->path_c);
|
||||
info->path, string_is_empty(info->path_c) ? NULL : info->path_c);
|
||||
strlcpy(info->path, info->path_b, sizeof(info->path));
|
||||
|
||||
info->need_sort = true;
|
||||
@ -3313,14 +3314,7 @@ int menu_displaylist_push(file_list_t *list, file_list_t *menu_list)
|
||||
strlcpy(info.label, menu_hash_to_str(MENU_LABEL_CONTENT_COLLECTION_LIST),
|
||||
sizeof(info.label));
|
||||
|
||||
if (settings->playlist_directory[0] != '\0')
|
||||
{
|
||||
strlcpy(info.path, settings->playlist_directory,
|
||||
sizeof(info.path));
|
||||
if (menu_displaylist_push_list(&info, DISPLAYLIST_DATABASE_PLAYLISTS_HORIZONTAL) != 0)
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
if (string_is_empty(settings->playlist_directory))
|
||||
{
|
||||
menu_entries_clear(info.list);
|
||||
menu_entries_push(info.list,
|
||||
@ -3330,6 +3324,13 @@ int menu_displaylist_push(file_list_t *list, file_list_t *menu_list)
|
||||
info.need_refresh = true;
|
||||
info.need_push = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
strlcpy(info.path, settings->playlist_directory,
|
||||
sizeof(info.path));
|
||||
if (menu_displaylist_push_list(&info, DISPLAYLIST_DATABASE_PLAYLISTS_HORIZONTAL) != 0)
|
||||
return -1;
|
||||
}
|
||||
menu_displaylist_push_list_process(&info);
|
||||
return 0;
|
||||
case MENU_VALUE_HORIZONTAL_MENU:
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include <file/file_path.h>
|
||||
#include <string/stdstring.h>
|
||||
|
||||
#include "menu_driver.h"
|
||||
#include "menu_cbs.h"
|
||||
@ -604,9 +605,11 @@ void *menu_init(const void *data)
|
||||
menu->help_screen_type = MENU_HELP_WELCOME;
|
||||
settings->menu_show_start_screen = false;
|
||||
|
||||
if (settings->bundle_assets_extract_enable &&
|
||||
settings->bundle_assets_src_path[0] != '\0' && settings->bundle_assets_dst_path[0] != '\0' &&
|
||||
settings->bundle_assets_extract_version_current != settings->bundle_assets_extract_last_version
|
||||
if (
|
||||
settings->bundle_assets_extract_enable
|
||||
&& !string_is_empty(settings->bundle_assets_src_path)
|
||||
&& !string_is_empty(settings->bundle_assets_dst_path)
|
||||
&& settings->bundle_assets_extract_version_current != settings->bundle_assets_extract_last_version
|
||||
)
|
||||
{
|
||||
menu->help_screen_type = MENU_HELP_EXTRACT;
|
||||
@ -657,7 +660,7 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
|
||||
case RARCH_MENU_CTL_PLAYLIST_INIT:
|
||||
{
|
||||
const char *path = (const char*)data;
|
||||
if (!path || path[0] == '\0')
|
||||
if (!string_is_empty(path))
|
||||
return false;
|
||||
menu_driver_playlist = content_playlist_init(path,
|
||||
COLLECTION_SIZE);
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include <retro_inline.h>
|
||||
#include <string/stdstring.h>
|
||||
|
||||
#include "menu_driver.h"
|
||||
#include "menu_cbs.h"
|
||||
@ -359,7 +360,7 @@ void menu_entries_get(size_t i, menu_entry_t *entry)
|
||||
|
||||
menu_entries_get_last_stack(NULL, &label, NULL, NULL);
|
||||
|
||||
entry->path[0] = entry->value[0] = entry->label[0] = '\0';
|
||||
entry->path[0] = entry->value[0] = string_is_empty(entry->label);
|
||||
|
||||
menu_entries_get_at_offset(selection_buf, i,
|
||||
&path, &entry_label, &entry->type, &entry->entry_idx, NULL);
|
||||
@ -419,9 +420,9 @@ int menu_entries_get_core_title(char *s, size_t len)
|
||||
if (!settings->menu.core_enable)
|
||||
return -1;
|
||||
|
||||
if (!core_name || core_name[0] == '\0')
|
||||
if (string_is_empty(core_name))
|
||||
core_name = info->info.library_name;
|
||||
if (!core_name || core_name[0] == '\0')
|
||||
if (string_is_empty(core_name))
|
||||
core_name = menu_hash_to_str(MENU_VALUE_NO_CORE);
|
||||
|
||||
if (!core_version)
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include <file/file_list.h>
|
||||
#include <file/file_path.h>
|
||||
#include <file/config_file.h>
|
||||
#include <string/stdstring.h>
|
||||
|
||||
#include "menu_setting.h"
|
||||
|
||||
@ -1877,7 +1878,7 @@ rarch_setting_t *menu_setting_find(const char *label)
|
||||
if (strcmp(label, name) != 0)
|
||||
continue;
|
||||
|
||||
if (short_description[0] == '\0')
|
||||
if (string_is_empty(short_description))
|
||||
return NULL;
|
||||
|
||||
if (setting->read_handler)
|
||||
@ -2911,7 +2912,7 @@ void general_write_handler(void *data)
|
||||
break;
|
||||
case MENU_LABEL_NETPLAY_IP_ADDRESS:
|
||||
#ifdef HAVE_NETPLAY
|
||||
global->has_set.netplay_ip_address = (setting->value.string[0] != '\0');
|
||||
global->has_set.netplay_ip_address = (!string_is_empty(setting->value.string));
|
||||
#endif
|
||||
break;
|
||||
case MENU_LABEL_NETPLAY_MODE:
|
||||
|
Loading…
Reference in New Issue
Block a user