mirror of
https://github.com/libretro/RetroArch.git
synced 2026-11-07 08:36:02 -10:00
Replace string_is_empty
This commit is contained in:
1 parent
b702a72ec4
commit
6603fe2369
50 files changed
+174
-178
No files matched your search
+3
-2
@@ -873,8 +873,9 @@ database_info_handle_t *database_info_dir_init(const char *dir,
|
||||
if (!db)
|
||||
return NULL;
|
||||
|
||||
/* File list will include all supported files, unless extension list is given */
|
||||
if (string_is_empty(file_exts))
|
||||
/* File list will include all supported files,
|
||||
* unless extension list is given */
|
||||
if (!file_exts || !*file_exts)
|
||||
core_info_get_list(&core_info_list);
|
||||
|
||||
if (!(list = dir_list_new(dir, core_info_list ? core_info_list->all_ext : file_exts,
|
||||
|
||||
@@ -293,8 +293,7 @@ static size_t disk_control_get_index_set_msg(
|
||||
image_label[0] = '\0';
|
||||
disk_control_get_image_label(
|
||||
disk_control, index, image_label, sizeof(image_label));
|
||||
|
||||
has_label = !string_is_empty(image_label);
|
||||
has_label = *image_label;
|
||||
|
||||
/* Get message duration
|
||||
* > Default is 60
|
||||
@@ -595,12 +594,12 @@ bool disk_control_append_image(
|
||||
|| !disk_control->cb.get_eject_state)
|
||||
return false;
|
||||
|
||||
if (string_is_empty(image_path))
|
||||
if (!image_path || !*image_path)
|
||||
return false;
|
||||
|
||||
image_filename = path_basename(image_path);
|
||||
|
||||
if (string_is_empty(image_filename))
|
||||
if (!image_filename || !*image_filename)
|
||||
return false;
|
||||
|
||||
/* Get initial disk eject state */
|
||||
@@ -699,7 +698,7 @@ bool disk_control_set_initial_index(
|
||||
if (!disk_control)
|
||||
return false;
|
||||
|
||||
if (string_is_empty(content_path))
|
||||
if (!content_path || !*content_path)
|
||||
goto error;
|
||||
|
||||
/* Check that 'initial index' functionality is enabled */
|
||||
@@ -800,7 +799,7 @@ bool disk_control_verify_initial_index(
|
||||
if ( (image_index == disk_control->index_record.image_index)
|
||||
&& (string_is_equal(image_path, disk_control->index_record.image_path)
|
||||
|| ((disk_control->index_record.image_index == 0)
|
||||
&& string_is_empty(disk_control->index_record.image_path))))
|
||||
&& !*disk_control->index_record.image_path)))
|
||||
success = true;
|
||||
}
|
||||
|
||||
@@ -837,7 +836,7 @@ bool disk_control_verify_initial_index(
|
||||
/* If current disk is correct and recorded image
|
||||
* path is empty (i.e. first run), need to register
|
||||
* current image path */
|
||||
else if (string_is_empty(disk_control->index_record.image_path))
|
||||
else if (!*disk_control->index_record.image_path)
|
||||
disk_index_file_set(
|
||||
&disk_control->index_record, image_index, image_path);
|
||||
|
||||
|
||||
+3
-3
@@ -200,7 +200,7 @@ size_t fill_pathname_application_special(char *s,
|
||||
|
||||
/* Try config directory setting first,
|
||||
* fallback to the location of the current configuration file. */
|
||||
if (!string_is_empty(dir_menu_config))
|
||||
if (dir_menu_config && *dir_menu_config)
|
||||
_len = strlcpy(s, dir_menu_config, len);
|
||||
else if (!path_is_empty(RARCH_PATH_CONFIG))
|
||||
_len = fill_pathname_basedir(s, path_get(RARCH_PATH_CONFIG), len);
|
||||
@@ -225,7 +225,7 @@ size_t fill_pathname_application_special(char *s,
|
||||
settings_t *settings = config_get_ptr();
|
||||
const char *path_menu_wallpaper = settings->paths.path_menu_wallpaper;
|
||||
|
||||
if (!string_is_empty(path_menu_wallpaper))
|
||||
if (path_menu_wallpaper && *path_menu_wallpaper)
|
||||
_len = strlcpy(s, path_menu_wallpaper, len);
|
||||
else
|
||||
{
|
||||
@@ -375,7 +375,7 @@ size_t fill_pathname_application_special(char *s,
|
||||
settings_t *settings = config_get_ptr();
|
||||
const char *path_menu_xmb_font = settings->paths.path_menu_xmb_font;
|
||||
|
||||
if (!string_is_empty(path_menu_xmb_font))
|
||||
if (path_menu_xmb_font && *path_menu_xmb_font)
|
||||
_len = strlcpy(s, path_menu_xmb_font, len);
|
||||
else
|
||||
{
|
||||
|
||||
@@ -250,7 +250,7 @@ static void frontend_wiiu_exec(const char *path, bool should_load_content)
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (!string_is_empty(content))
|
||||
if (content && *content)
|
||||
{
|
||||
param->argc = 2;
|
||||
param->argv[1] = arg;
|
||||
|
||||
@@ -458,10 +458,8 @@ static size_t frontend_win32_get_os(char *s, size_t len, int *major, int *minor)
|
||||
/* The first Win10 release doesn't provide DisplayVersion/ReleaseId,
|
||||
* so use build number to insert version label */
|
||||
if (!server && vi.dwMajorVersion == 10 && vi.dwBuildNumber == 10240
|
||||
&& string_is_empty(display_version) && string_is_empty(release_id))
|
||||
{
|
||||
&& !*display_version && !*release_id)
|
||||
strlcpy(release_id, "1507", sizeof(release_id));
|
||||
}
|
||||
}
|
||||
|
||||
/* Detect Windows version from build number, NT version, or platform ID.
|
||||
@@ -611,13 +609,13 @@ static size_t frontend_win32_get_os(char *s, size_t len, int *major, int *minor)
|
||||
/* OS display formatting */
|
||||
if (vi.dwMajorVersion >= 10)
|
||||
{
|
||||
if (!string_is_empty(display_version))
|
||||
if (*display_version)
|
||||
{
|
||||
_len += strlcpy(s + _len, " (", len - _len);
|
||||
_len += strlcpy(s + _len, display_version, len - _len);
|
||||
_len += strlcpy(s + _len, ")", len - _len);
|
||||
}
|
||||
else if (!string_is_empty(release_id))
|
||||
else if (*release_id)
|
||||
{
|
||||
_len += strlcpy(s + _len, " (", len - _len);
|
||||
_len += strlcpy(s + _len, release_id, len - _len);
|
||||
@@ -626,10 +624,10 @@ static size_t frontend_win32_get_os(char *s, size_t len, int *major, int *minor)
|
||||
}
|
||||
/* Hide x86/x64 for XP x64 ("x64" is already shown in the OS name)
|
||||
* and OSes older than XP x86, since they are all x86 only */
|
||||
if (!string_is_empty(arch) &&
|
||||
(vi.dwMajorVersion > 5 ||
|
||||
(vi.dwMajorVersion == 5 && vi.dwMinorVersion >= 1)) &&
|
||||
!(vi.dwMajorVersion == 5 && vi.dwMinorVersion == 2))
|
||||
if ((arch && *arch)
|
||||
&& (vi.dwMajorVersion > 5 ||
|
||||
(vi.dwMajorVersion == 5 && vi.dwMinorVersion >= 1))
|
||||
&& !(vi.dwMajorVersion == 5 && vi.dwMinorVersion == 2))
|
||||
{
|
||||
_len += strlcpy(s + _len, " ", len - _len);
|
||||
_len += strlcpy(s + _len, arch, len - _len);
|
||||
@@ -638,7 +636,7 @@ static size_t frontend_win32_get_os(char *s, size_t len, int *major, int *minor)
|
||||
_len += strlcpy(s + _len, " - Build ", len - _len);
|
||||
_len += strlcpy(s + _len, build_str, len - _len);
|
||||
|
||||
if (!string_is_empty(vi.szCSDVersion))
|
||||
if (*vi.szCSDVersion)
|
||||
{
|
||||
_len += strlcpy(s + _len, " ", len - _len);
|
||||
strlcpy(s + _len, vi.szCSDVersion, len - _len);
|
||||
@@ -793,13 +791,13 @@ static void frontend_win32_env_get(int *argc, char *argv[],
|
||||
const char* libretro_system_directory = getenv("LIBRETRO_SYSTEM_DIRECTORY");
|
||||
const char* libretro_video_filter_directory = getenv("LIBRETRO_VIDEO_FILTER_DIRECTORY");
|
||||
const char* libretro_video_shader_directory = getenv("LIBRETRO_VIDEO_SHADER_DIRECTORY");
|
||||
if (!string_is_empty(tmp_dir))
|
||||
if (tmp_dir && *tmp_dir)
|
||||
fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_CACHE],
|
||||
tmp_dir, sizeof(g_defaults.dirs[DEFAULT_DIR_CACHE]));
|
||||
|
||||
gfx_set_dwm();
|
||||
|
||||
if (!string_is_empty(libretro_assets_directory))
|
||||
if (libretro_assets_directory && *libretro_assets_directory)
|
||||
strlcpy(g_defaults.dirs[DEFAULT_DIR_ASSETS], libretro_assets_directory,
|
||||
sizeof(g_defaults.dirs[DEFAULT_DIR_ASSETS]));
|
||||
else
|
||||
@@ -808,21 +806,21 @@ static void frontend_win32_env_get(int *argc, char *argv[],
|
||||
":\\assets", sizeof(g_defaults.dirs[DEFAULT_DIR_ASSETS]));
|
||||
fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_AUDIO_FILTER],
|
||||
":\\filters\\audio", sizeof(g_defaults.dirs[DEFAULT_DIR_AUDIO_FILTER]));
|
||||
if (!string_is_empty(libretro_video_filter_directory))
|
||||
if (libretro_video_filter_directory && *libretro_video_filter_directory)
|
||||
strlcpy(g_defaults.dirs[DEFAULT_DIR_VIDEO_FILTER],
|
||||
libretro_video_filter_directory,
|
||||
sizeof(g_defaults.dirs[DEFAULT_DIR_VIDEO_FILTER]));
|
||||
else
|
||||
fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_VIDEO_FILTER],
|
||||
":\\filters\\video", sizeof(g_defaults.dirs[DEFAULT_DIR_VIDEO_FILTER]));
|
||||
if (!string_is_empty(libretro_cheats_directory))
|
||||
if (libretro_cheats_directory && *libretro_cheats_directory)
|
||||
strlcpy(g_defaults.dirs[DEFAULT_DIR_CHEATS],
|
||||
libretro_cheats_directory,
|
||||
sizeof(g_defaults.dirs[DEFAULT_DIR_CHEATS]));
|
||||
else
|
||||
fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_CHEATS],
|
||||
":\\cheats", sizeof(g_defaults.dirs[DEFAULT_DIR_CHEATS]));
|
||||
if (!string_is_empty(libretro_database_directory))
|
||||
if (libretro_database_directory && *libretro_database_directory)
|
||||
strlcpy(g_defaults.dirs[DEFAULT_DIR_DATABASE],
|
||||
libretro_database_directory,
|
||||
sizeof(g_defaults.dirs[DEFAULT_DIR_DATABASE]));
|
||||
@@ -847,26 +845,26 @@ static void frontend_win32_env_get(int *argc, char *argv[],
|
||||
":\\overlays", sizeof(g_defaults.dirs[DEFAULT_DIR_OVERLAY]));
|
||||
fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_OSK_OVERLAY],
|
||||
":\\overlays\\keyboards", sizeof(g_defaults.dirs[DEFAULT_DIR_OSK_OVERLAY]));
|
||||
if (!string_is_empty(libretro_directory))
|
||||
if (libretro_directory && *libretro_directory)
|
||||
strlcpy(g_defaults.dirs[DEFAULT_DIR_CORE], libretro_directory,
|
||||
sizeof(g_defaults.dirs[DEFAULT_DIR_CORE]));
|
||||
else
|
||||
fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_CORE],
|
||||
":\\cores", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE]));
|
||||
if (!string_is_empty(libretro_directory))
|
||||
if (libretro_directory && *libretro_directory)
|
||||
strlcpy(g_defaults.dirs[DEFAULT_DIR_CORE_INFO], libretro_directory,
|
||||
sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_INFO]));
|
||||
else
|
||||
fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_CORE_INFO],
|
||||
":\\info", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_INFO]));
|
||||
if (!string_is_empty(libretro_autoconfig_directory))
|
||||
if (libretro_autoconfig_directory && *libretro_autoconfig_directory)
|
||||
strlcpy(g_defaults.dirs[DEFAULT_DIR_AUTOCONFIG],
|
||||
libretro_autoconfig_directory,
|
||||
sizeof(g_defaults.dirs[DEFAULT_DIR_AUTOCONFIG]));
|
||||
else
|
||||
fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_AUTOCONFIG],
|
||||
":\\autoconfig", sizeof(g_defaults.dirs[DEFAULT_DIR_AUTOCONFIG]));
|
||||
if (!string_is_empty(libretro_video_filter_directory))
|
||||
if (libretro_video_filter_directory && *libretro_video_filter_directory)
|
||||
strlcpy(g_defaults.dirs[DEFAULT_DIR_SHADER],
|
||||
libretro_video_shader_directory,
|
||||
sizeof(g_defaults.dirs[DEFAULT_DIR_SHADER]));
|
||||
@@ -881,7 +879,7 @@ static void frontend_win32_env_get(int *argc, char *argv[],
|
||||
":\\saves", sizeof(g_defaults.dirs[DEFAULT_DIR_SRAM]));
|
||||
fill_pathname_expand_special(g_defaults.dirs[DEFAULT_DIR_SAVESTATE],
|
||||
":\\states", sizeof(g_defaults.dirs[DEFAULT_DIR_SAVESTATE]));
|
||||
if (!string_is_empty(libretro_system_directory))
|
||||
if (libretro_system_directory && *libretro_system_directory)
|
||||
strlcpy(g_defaults.dirs[DEFAULT_DIR_SYSTEM],
|
||||
libretro_system_directory,
|
||||
sizeof(g_defaults.dirs[DEFAULT_DIR_SYSTEM]));
|
||||
|
||||
@@ -740,7 +740,7 @@ static void d3d9_init_singlepass(d3d9_video_t *d3d)
|
||||
pass->fbo.scale_x = pass->fbo.scale_y;
|
||||
pass->fbo.type_x = pass->fbo.type_y;
|
||||
|
||||
if (!string_is_empty(d3d->shader_path))
|
||||
if (d3d->shader_path && *d3d->shader_path)
|
||||
strlcpy(pass->source.path, d3d->shader_path,
|
||||
sizeof(pass->source.path));
|
||||
}
|
||||
@@ -798,7 +798,7 @@ static bool d3d9_init_multipass(d3d9_video_t *d3d, const char *shader_path)
|
||||
bool d3d9_process_shader(d3d9_video_t *d3d)
|
||||
{
|
||||
const char *shader_path = d3d->shader_path;
|
||||
if (!string_is_empty(shader_path))
|
||||
if (shader_path && *shader_path)
|
||||
{
|
||||
RARCH_ERR("[D3D9] Failed to parse shader preset.\n");
|
||||
return d3d9_init_multipass(d3d, shader_path);
|
||||
|
||||
@@ -667,7 +667,7 @@ static bool win32_browser(
|
||||
new_file[0] = '\0';
|
||||
new_dir[0] = '\0';
|
||||
|
||||
if (!string_is_empty(title))
|
||||
if (title && *title)
|
||||
strlcpy(new_title, title, sizeof(new_title));
|
||||
|
||||
if (filename && *filename)
|
||||
|
||||
@@ -53,7 +53,7 @@ static void android_display_dpi_get_density(char *s, size_t len)
|
||||
inited_once = true;
|
||||
}
|
||||
|
||||
if (!string_is_empty(string))
|
||||
if (string && *string)
|
||||
{
|
||||
strlcpy(s, string, len);
|
||||
return;
|
||||
@@ -83,7 +83,7 @@ bool android_display_get_metrics(void *data,
|
||||
{
|
||||
char density[PROP_VALUE_MAX];
|
||||
android_display_dpi_get_density(density, sizeof(density));
|
||||
if (string_is_empty(density))
|
||||
if (!density || !*density)
|
||||
goto dpi_fallback;
|
||||
if ((dpi = atoi(density)) <= 0)
|
||||
goto dpi_fallback;
|
||||
|
||||
@@ -126,7 +126,7 @@ static void caca_font_render_msg(
|
||||
float video_msg_pos_x = settings->floats.video_msg_pos_x;
|
||||
float video_msg_pos_y = settings->floats.video_msg_pos_y;
|
||||
|
||||
if (!font || string_is_empty(msg))
|
||||
if (!font || !msg || !*msg)
|
||||
return;
|
||||
|
||||
if (params)
|
||||
|
||||
+3
-1
@@ -1557,7 +1557,7 @@ static bool d3d10_gfx_set_shader(void* data,
|
||||
d3d10->device->lpVtbl->Flush(d3d10->device);
|
||||
d3d10_free_shader_preset(d3d10);
|
||||
|
||||
if (string_is_empty(path))
|
||||
if (!path || !*path)
|
||||
return true;
|
||||
|
||||
if (type != RARCH_SHADER_SLANG)
|
||||
@@ -2095,6 +2095,7 @@ static void *d3d10_gfx_init(const video_info_t* video,
|
||||
goto error;
|
||||
}
|
||||
|
||||
#ifdef HAVE_XMB
|
||||
if (string_is_equal(settings->arrays.menu_driver, "xmb"))
|
||||
{
|
||||
{
|
||||
@@ -2161,6 +2162,7 @@ static void *d3d10_gfx_init(const video_info_t* video,
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
{
|
||||
D3D10_BLEND_DESC blend_desc = { 0 };
|
||||
|
||||
+1
-1
@@ -1935,7 +1935,7 @@ static bool d3d11_gfx_set_shader(void* data, enum rarch_shader_type type, const
|
||||
d3d11->context->lpVtbl->Flush(d3d11->context);
|
||||
d3d11_free_shader_preset(d3d11);
|
||||
|
||||
if (string_is_empty(path))
|
||||
if (!path || !*path)
|
||||
{
|
||||
#ifdef HAVE_DXGI_HDR
|
||||
if (d3d11->flags & D3D11_ST_FLAG_HDR_ENABLE)
|
||||
|
||||
+1
-1
@@ -2196,7 +2196,7 @@ static bool d3d12_gfx_set_shader(void* data, enum rarch_shader_type type, const
|
||||
D3D12_GFX_SYNC();
|
||||
d3d12_free_shader_preset(d3d12);
|
||||
|
||||
if (string_is_empty(path))
|
||||
if (!path || !*path)
|
||||
{
|
||||
#ifdef HAVE_DXGI_HDR
|
||||
if (d3d12->flags & D3D12_ST_FLAG_HDR_ENABLE)
|
||||
|
||||
+3
-3
@@ -1568,7 +1568,7 @@ static bool d3d8_init_internal(d3d8_video_t *d3d,
|
||||
pass->fbo.type_x = pass->fbo.type_y;
|
||||
pass->fbo.flags |= FBO_SCALE_FLAG_VALID;
|
||||
|
||||
if (!string_is_empty(d3d->shader_path))
|
||||
if (d3d->shader_path && *d3d->shader_path)
|
||||
strlcpy(pass->source.path, d3d->shader_path,
|
||||
sizeof(pass->source.path));
|
||||
|
||||
@@ -1671,7 +1671,7 @@ static void d3d8_free(void *data)
|
||||
|
||||
d3d8_deinitialize(d3d);
|
||||
|
||||
if (!string_is_empty(d3d->shader_path))
|
||||
if (d3d->shader_path && *d3d->shader_path)
|
||||
free(d3d->shader_path);
|
||||
|
||||
IDirect3DDevice8_Release(d3d->dev);
|
||||
@@ -1939,7 +1939,7 @@ static bool d3d8_frame(void *data, const void *frame,
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!string_is_empty(msg))
|
||||
if (msg && *msg)
|
||||
{
|
||||
IDirect3DDevice8_SetViewport(d3d->dev, (D3DVIEWPORT8*)&screen_vp);
|
||||
IDirect3DDevice8_BeginScene(d3d->dev);
|
||||
|
||||
@@ -241,7 +241,7 @@ static void gdi_font_render_msg(
|
||||
SIZE text_size = {0};
|
||||
struct string_list msg_list = {0};
|
||||
|
||||
if (!font || string_is_empty(msg) || !gdi)
|
||||
if (!font || !msg || !*msg || !gdi)
|
||||
return;
|
||||
|
||||
if (params)
|
||||
|
||||
+5
-5
@@ -782,7 +782,7 @@ static void gl1_raster_font_render_msg(
|
||||
gl1_raster_t *font = (gl1_raster_t*)data;
|
||||
gl1_t *gl = (gl1_t*)userdata;
|
||||
|
||||
if (!font || string_is_empty(msg) || !gl)
|
||||
if (!font || !msg || !*msg || !gl)
|
||||
return;
|
||||
|
||||
if (params)
|
||||
@@ -844,7 +844,7 @@ static void gl1_raster_font_render_msg(
|
||||
if (!font->block)
|
||||
gl1_raster_font_setup_viewport(gl, width, height, font, full_screen);
|
||||
|
||||
if (!string_is_empty(msg)
|
||||
if (msg && *msg
|
||||
&& font->font_data && font->font_driver)
|
||||
{
|
||||
if (drop_x || drop_y)
|
||||
@@ -1210,17 +1210,17 @@ static void *gl1_init(const video_info_t *video,
|
||||
version = (const char*)glGetString(GL_VERSION);
|
||||
extensions = (const char*)glGetString(GL_EXTENSIONS);
|
||||
|
||||
if (!string_is_empty(version))
|
||||
if (version && *version)
|
||||
sscanf(version, "%d.%d", &gl1->version_major, &gl1->version_minor);
|
||||
|
||||
if (!string_is_empty(extensions))
|
||||
if (extensions && *extensions)
|
||||
gl1->extensions = string_split(extensions, " ");
|
||||
|
||||
RARCH_LOG("[GL1] Vendor: %s, Renderer: %s.\n", vendor, renderer);
|
||||
RARCH_LOG("[GL1] Version: %s.\n", version);
|
||||
RARCH_LOG("[GL1] Extensions: %s.\n", extensions);
|
||||
|
||||
if (!string_is_empty(version))
|
||||
if (version && *version)
|
||||
video_driver_set_gpu_api_version_string(version);
|
||||
|
||||
if (gl1->ctx_driver->input_driver)
|
||||
|
||||
+8
-8
@@ -991,7 +991,7 @@ static void gl2_raster_font_render_msg(
|
||||
unsigned height = gl->video_height;
|
||||
bool video_scale_integer = config_get_ptr()->bools.video_scale_integer;
|
||||
|
||||
if (!font || string_is_empty(msg) || !gl)
|
||||
if (!font || !msg || !*msg || !gl)
|
||||
return;
|
||||
|
||||
if (params)
|
||||
@@ -1046,7 +1046,7 @@ static void gl2_raster_font_render_msg(
|
||||
gl2_raster_font_setup_viewport(gl, font, width, height, full_screen,
|
||||
video_scale_integer);
|
||||
|
||||
if ( !string_is_empty(msg)
|
||||
if ( (msg && *msg)
|
||||
&& font->font_data
|
||||
&& font->font_driver)
|
||||
{
|
||||
@@ -2957,7 +2957,7 @@ static bool gl2_shader_init(gl2_t *gl, const gfx_ctx_driver_t *ctx_driver,
|
||||
|
||||
if (type != parse_type)
|
||||
{
|
||||
if (!string_is_empty(shader_path))
|
||||
if (shader_path && *shader_path)
|
||||
RARCH_WARN("[GL] Shader preset %s is using unsupported shader type %s, falling back to stock %s.\n",
|
||||
shader_path, video_shader_type_to_str(parse_type), video_shader_type_to_str(type));
|
||||
|
||||
@@ -3682,7 +3682,7 @@ static bool gl2_frame(void *data, const void *frame,
|
||||
gfx_widgets_frame(video_info);
|
||||
#endif
|
||||
|
||||
if (!string_is_empty(msg))
|
||||
if (msg && *msg)
|
||||
{
|
||||
if (msg_bgcolor_enable)
|
||||
gl2_render_osd_background(gl, video_scale_integer, msg);
|
||||
@@ -4387,7 +4387,7 @@ static void *gl2_init(const video_info_t *video,
|
||||
if (string_is_equal(ctx_driver->ident, "null"))
|
||||
goto error;
|
||||
|
||||
if (!string_is_empty(version))
|
||||
if (version && *version)
|
||||
{
|
||||
if (string_starts_with(version, "OpenGL ES "))
|
||||
sscanf(version, "OpenGL ES %d.%d", &gl->version_major, &gl->version_minor);
|
||||
@@ -4400,17 +4400,17 @@ static void *gl2_init(const video_info_t *video,
|
||||
{
|
||||
size_t _len = 0;
|
||||
|
||||
if (!string_is_empty(vendor))
|
||||
if (vendor && *vendor)
|
||||
{
|
||||
_len = strlcpy(gl->device_str, vendor, sizeof(gl->device_str));
|
||||
gl->device_str[ _len] = ' ';
|
||||
gl->device_str[++_len] = '\0';
|
||||
}
|
||||
|
||||
if (!string_is_empty(renderer))
|
||||
if (renderer && *renderer)
|
||||
strlcpy(gl->device_str + _len, renderer, sizeof(gl->device_str) - _len);
|
||||
|
||||
if (!string_is_empty(version))
|
||||
if (version && *version)
|
||||
video_driver_set_gpu_api_version_string(version);
|
||||
}
|
||||
|
||||
|
||||
+6
-6
@@ -1204,7 +1204,7 @@ static void gl3_raster_font_render_msg(
|
||||
float video_msg_color_g = settings->floats.video_msg_color_g;
|
||||
float video_msg_color_b = settings->floats.video_msg_color_b;
|
||||
|
||||
if (!font || string_is_empty(msg) || !gl)
|
||||
if (!font || !msg || !*msg || !gl)
|
||||
return;
|
||||
|
||||
if (params)
|
||||
@@ -1252,7 +1252,7 @@ static void gl3_raster_font_render_msg(
|
||||
else
|
||||
gl3_raster_font_setup_viewport(gl, width, height, font, full_screen);
|
||||
|
||||
if (!string_is_empty(msg)
|
||||
if ( (msg && *msg)
|
||||
&& font->font_data && font->font_driver)
|
||||
{
|
||||
if (drop_x || drop_y)
|
||||
@@ -2571,7 +2571,7 @@ static bool gl3_init_filter_chain_with_path(gl3_t *gl, const char *shader_path)
|
||||
|
||||
if (type != parse_type)
|
||||
{
|
||||
if (!string_is_empty(shader_path))
|
||||
if (shader_path && *shader_path)
|
||||
RARCH_WARN("[GLCore] Shader preset %s is using unsupported shader type %s, falling back to stock %s.\n",
|
||||
shader_path, video_shader_type_to_str(parse_type), video_shader_type_to_str(type));
|
||||
|
||||
@@ -2602,7 +2602,7 @@ static bool gl3_init_filter_chain_with_path(gl3_t *gl, const char *shader_path)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (string_is_empty(shader_path))
|
||||
if (!shader_path || !*shader_path)
|
||||
{
|
||||
RARCH_LOG("[GLCore] Loading stock shader.\n");
|
||||
return gl3_init_default_filter_chain(gl);
|
||||
@@ -2910,7 +2910,7 @@ static void *gl3_init(const video_info_t *video,
|
||||
if (string_is_equal(ctx_driver->ident, "null"))
|
||||
goto error;
|
||||
|
||||
if (!string_is_empty(version))
|
||||
if (version && *version)
|
||||
{
|
||||
if (string_starts_with(version, "OpenGL ES "))
|
||||
sscanf(version, "OpenGL ES %u.%u", &gl->version_major, &gl->version_minor);
|
||||
@@ -4177,7 +4177,7 @@ static bool gl3_frame(void *data, const void *frame,
|
||||
gfx_widgets_frame(video_info);
|
||||
#endif
|
||||
|
||||
if (!string_is_empty(msg))
|
||||
if (msg && *msg)
|
||||
{
|
||||
#if 0
|
||||
if (msg_bgcolor_enable)
|
||||
|
||||
@@ -237,7 +237,7 @@ static bool gx2_set_shader(void *data,
|
||||
if (wiiu->shader_preset)
|
||||
gx2_free_shader_preset(wiiu);
|
||||
|
||||
if (!string_is_empty(path))
|
||||
if (path && *path)
|
||||
{
|
||||
if (type != RARCH_SHADER_SLANG)
|
||||
{
|
||||
|
||||
@@ -907,7 +907,7 @@ static void rsx_font_render_msg(
|
||||
float video_msg_color_b = settings->floats.video_msg_color_b;
|
||||
rsx_t *rsx = (rsx_t*)userdata;
|
||||
|
||||
if (!font || string_is_empty(msg) || !rsx)
|
||||
if (!font || !msg || !*msg || !rsx)
|
||||
return;
|
||||
|
||||
width = rsx->width;
|
||||
@@ -958,7 +958,7 @@ static void rsx_font_render_msg(
|
||||
else
|
||||
rsx_font_setup_viewport(rsx, font, width, height, full_screen);
|
||||
|
||||
if ( !string_is_empty(msg)
|
||||
if ( (msg && *msg)
|
||||
&& font->font_data
|
||||
&& font->font_driver)
|
||||
{
|
||||
|
||||
@@ -133,7 +133,7 @@ static void sdl_dingux_blit_text16(
|
||||
screen_height - vid->frame_padding_y)
|
||||
return;
|
||||
|
||||
while (!string_is_empty(str))
|
||||
while (str && *str)
|
||||
{
|
||||
/* Check for out of bounds x coordinates */
|
||||
if (x_pos + FONT_WIDTH_STRIDE + 1 >=
|
||||
@@ -216,7 +216,7 @@ static void sdl_dingux_blit_text32(
|
||||
screen_height - vid->frame_padding_y)
|
||||
return;
|
||||
|
||||
while (!string_is_empty(str))
|
||||
while (str && *str)
|
||||
{
|
||||
/* Check for out of bounds x coordinates */
|
||||
if (x_pos + FONT_WIDTH_STRIDE + 1 >=
|
||||
@@ -349,7 +349,7 @@ static void sdl_dingux_input_driver_init(
|
||||
|
||||
/* If input driver name is empty, cannot
|
||||
* initialise anything... */
|
||||
if (string_is_empty(input_drv_name))
|
||||
if (!input_drv_name || !*input_drv_name)
|
||||
return;
|
||||
|
||||
if (string_is_equal(input_drv_name, "sdl_dingux"))
|
||||
|
||||
@@ -531,7 +531,7 @@ static void sdl_rs90_blit_text16(
|
||||
screen_height - vid->frame_padding_y)
|
||||
return;
|
||||
|
||||
while (!string_is_empty(str))
|
||||
while (str && *str)
|
||||
{
|
||||
/* Check for out of bounds x coordinates */
|
||||
if (x_pos + FONT_WIDTH_STRIDE + 1 >=
|
||||
@@ -614,7 +614,7 @@ static void sdl_rs90_blit_text32(
|
||||
screen_height - vid->frame_padding_y)
|
||||
return;
|
||||
|
||||
while (!string_is_empty(str))
|
||||
while (str && *str)
|
||||
{
|
||||
/* Check for out of bounds x coordinates */
|
||||
if (x_pos + FONT_WIDTH_STRIDE + 1 >=
|
||||
@@ -734,7 +734,7 @@ static void sdl_rs90_input_driver_init(
|
||||
|
||||
/* If input driver name is empty, cannot
|
||||
* initialise anything... */
|
||||
if (string_is_empty(input_drv_name))
|
||||
if (!input_drv_name || !*input_drv_name)
|
||||
return;
|
||||
|
||||
if (string_is_equal(input_drv_name, "sdl_dingux"))
|
||||
|
||||
@@ -839,8 +839,7 @@ static bool vita2d_frame(void *data, const void *frame,
|
||||
if (widgets_active)
|
||||
gfx_widgets_frame(video_info);
|
||||
#endif
|
||||
|
||||
if (!string_is_empty(msg))
|
||||
if (msg && *msg)
|
||||
font_driver_render_msg(vita, msg, NULL, NULL);
|
||||
|
||||
vita2d_end_drawing();
|
||||
|
||||
@@ -3478,7 +3478,7 @@ static bool vulkan_init_filter_chain(vk_t *vk)
|
||||
const char *shader_path = video_shader_get_current_shader_preset();
|
||||
enum rarch_shader_type type = video_shader_parse_type(shader_path);
|
||||
|
||||
if (string_is_empty(shader_path))
|
||||
if (!shader_path || !*shader_path)
|
||||
{
|
||||
RARCH_LOG("[Vulkan] Loading stock shader.\n");
|
||||
|
||||
@@ -4308,13 +4308,13 @@ static bool vulkan_set_shader(void *data,
|
||||
vulkan_filter_chain_free((vulkan_filter_chain_t*)vk->filter_chain);
|
||||
vk->filter_chain = NULL;
|
||||
|
||||
if (!string_is_empty(path) && type != RARCH_SHADER_SLANG)
|
||||
if (path && *path && type != RARCH_SHADER_SLANG)
|
||||
{
|
||||
RARCH_WARN("[Vulkan] Only Slang shaders are supported. Falling back to stock.\n");
|
||||
path = NULL;
|
||||
}
|
||||
|
||||
if (string_is_empty(path))
|
||||
if (!path || !*path)
|
||||
{
|
||||
vulkan_init_default_filter_chain(vk);
|
||||
return true;
|
||||
@@ -5424,7 +5424,7 @@ static bool vulkan_frame(void *data, const void *frame,
|
||||
end_main_pass = false;
|
||||
}
|
||||
|
||||
const bool message_visible = !string_is_empty(msg);
|
||||
const bool message_visible = msg && *msg;
|
||||
|
||||
#ifdef HAVE_GFX_WIDGETS
|
||||
const bool widgets_visible = gfx_widgets_visible(video_info);
|
||||
|
||||
@@ -116,7 +116,7 @@ bitmapfont_lut_t *bitmapfont_10x10_load(unsigned language)
|
||||
break;
|
||||
}
|
||||
|
||||
if (string_is_empty(font_file))
|
||||
if (!font_file || !*font_file)
|
||||
goto error;
|
||||
|
||||
/* Get font path */
|
||||
|
||||
@@ -112,7 +112,7 @@ bitmapfont_lut_t *bitmapfont_6x10_load(unsigned language)
|
||||
}
|
||||
|
||||
/* Sanity check: should only trigger on bug */
|
||||
if (string_is_empty(font_file))
|
||||
if (!font_file || !*font_file)
|
||||
goto error;
|
||||
|
||||
/* Get font path */
|
||||
|
||||
@@ -1445,9 +1445,9 @@ bool vulkan_filter_chain::init()
|
||||
#ifdef VULKAN_DEBUG
|
||||
const char *name = passes[i]->get_name().c_str();
|
||||
RARCH_LOG("[Vulkan] Building pass #%u (%s)\n", i,
|
||||
string_is_empty(name) ?
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE) :
|
||||
name);
|
||||
(name && *name)
|
||||
? name
|
||||
: msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE));
|
||||
#endif
|
||||
source = passes[i]->set_pass_info(max_input_size,
|
||||
source, swapchain_info, pass_info[i]);
|
||||
|
||||
+2
-2
@@ -1115,7 +1115,7 @@ bool gfx_display_reset_textures_list(
|
||||
ti.pixels = NULL;
|
||||
ti.supports_rgba = video_driver_supports_rgba();
|
||||
|
||||
if (string_is_empty(texture_path))
|
||||
if (!texture_path || !*texture_path)
|
||||
return false;
|
||||
|
||||
fill_pathname_join_special(texpath,
|
||||
@@ -1154,7 +1154,7 @@ bool gfx_display_reset_icon_texture(
|
||||
ti.pixels = NULL;
|
||||
ti.supports_rgba = video_driver_supports_rgba();
|
||||
|
||||
if (string_is_empty(texture_path))
|
||||
if (!texture_path || !*texture_path)
|
||||
return false;
|
||||
if (!image_texture_load(&ti, texture_path))
|
||||
return false;
|
||||
|
||||
+4
-4
@@ -228,7 +228,7 @@ void gfx_widgets_msg_queue_push(
|
||||
msg_widget->msg_new = strdup(msg_title);
|
||||
msg_widget->msg_len = len;
|
||||
|
||||
if (!string_is_empty(task->error))
|
||||
if (task->error && *task->error)
|
||||
msg_widget->flags |= DISPWIDG_FLAG_TASK_ERROR;
|
||||
if ((task->flags & RETRO_TASK_FLG_CANCELLED) != 0)
|
||||
msg_widget->flags |= DISPWIDG_FLAG_TASK_CANCELLED;
|
||||
@@ -390,7 +390,7 @@ void gfx_widgets_msg_queue_push(
|
||||
msg_widget->width = new_width;
|
||||
}
|
||||
|
||||
if (!string_is_empty(task->error))
|
||||
if (task->error && *task->error)
|
||||
msg_widget->flags |= DISPWIDG_FLAG_TASK_ERROR;
|
||||
if ((task->flags & RETRO_TASK_FLG_CANCELLED) != 0)
|
||||
msg_widget->flags |= DISPWIDG_FLAG_TASK_CANCELLED;
|
||||
@@ -638,7 +638,7 @@ void gfx_widgets_draw_text(
|
||||
enum text_alignment text_align,
|
||||
bool draw_outside)
|
||||
{
|
||||
if (!font_data || string_is_empty(text))
|
||||
if (!font_data || !text || !*text)
|
||||
return;
|
||||
|
||||
gfx_display_draw_text(
|
||||
@@ -785,7 +785,7 @@ static void gfx_widgets_layout(
|
||||
size_t i;
|
||||
|
||||
/* Initialise fonts */
|
||||
if (string_is_empty(font_path))
|
||||
if (!font_path || !*font_path)
|
||||
{
|
||||
char font_file[PATH_MAX_LENGTH];
|
||||
/* Create regular font */
|
||||
|
||||
@@ -330,7 +330,7 @@ static void switch_res_crt(
|
||||
|
||||
/* Check for core and content changes in case we need
|
||||
to make any adjustments */
|
||||
if (string_is_empty(_core_name))
|
||||
if (!_core_name || !*_core_name)
|
||||
current_core_name[0] = '\0';
|
||||
else
|
||||
strlcpy(current_core_name, _core_name, sizeof(current_core_name));
|
||||
|
||||
+4
-4
@@ -1154,7 +1154,7 @@ void* video_display_server_init(enum rarch_display_type type)
|
||||
if (current_display_server->init)
|
||||
video_st->current_display_server_data = current_display_server->init();
|
||||
|
||||
if (!string_is_empty(current_display_server->ident))
|
||||
if (current_display_server->ident && *current_display_server->ident)
|
||||
{
|
||||
RARCH_LOG("[Video] Found display server: \"%s\".\n",
|
||||
current_display_server->ident);
|
||||
@@ -3502,7 +3502,7 @@ bool video_driver_init_internal(bool *video_is_threaded, bool verbosity_enabled)
|
||||
|
||||
/* Init video filter only when game is running */
|
||||
if (( runloop_st->current_core.flags & RETRO_CORE_FLAG_GAME_LOADED)
|
||||
&& !string_is_empty(path_softfilter_plugin))
|
||||
&& (path_softfilter_plugin && *path_softfilter_plugin))
|
||||
video_driver_init_filter(video_driver_pix_fmt, settings);
|
||||
#endif
|
||||
|
||||
@@ -4109,7 +4109,7 @@ void video_driver_frame(const void *data, unsigned width,
|
||||
__len = strlcpy(video_st->window_title, video_st->title_buf,
|
||||
sizeof(video_st->window_title));
|
||||
|
||||
if (!string_is_empty(status_text))
|
||||
if (*status_text)
|
||||
{
|
||||
video_st->window_title[ __len ] = ' ';
|
||||
video_st->window_title[++__len ] = '|';
|
||||
@@ -4172,7 +4172,7 @@ void video_driver_frame(const void *data, unsigned width,
|
||||
{
|
||||
/* If status text is already set, add status
|
||||
* message at the end */
|
||||
if (!string_is_empty(status_text))
|
||||
if (*status_text)
|
||||
{
|
||||
status_text[ _len] = ' ';
|
||||
status_text[++_len] = '|';
|
||||
|
||||
@@ -173,7 +173,7 @@ void gfx_widget_set_generic_message(
|
||||
gfx_widget_font_data_t *font_msg_queue = &p_dispwidget->gfx_widget_fonts.msg_queue;
|
||||
|
||||
/* Ensure we have a valid message string */
|
||||
if (string_is_empty(msg))
|
||||
if (!msg || !*msg)
|
||||
return;
|
||||
|
||||
/* Cache message parameters */
|
||||
@@ -274,7 +274,7 @@ static void gfx_widget_generic_message_layout(
|
||||
/* Set background width */
|
||||
state->bg_width = state->text_padding * 2;
|
||||
|
||||
if (!string_is_empty(state->message))
|
||||
if (*state->message)
|
||||
{
|
||||
text_width = font_driver_get_message_width(
|
||||
font_msg_queue->font, state->message,
|
||||
|
||||
@@ -166,7 +166,7 @@ void gfx_widget_set_libretro_message(
|
||||
gfx_widget_font_data_t *font_msg_queue = &p_dispwidget->gfx_widget_fonts.msg_queue;
|
||||
|
||||
/* Ensure we have a valid message string */
|
||||
if (string_is_empty(msg))
|
||||
if (!msg || !*msg)
|
||||
return;
|
||||
|
||||
/* Cache message parameters */
|
||||
@@ -239,7 +239,7 @@ static void gfx_widget_libretro_message_layout(
|
||||
/* Update values that are dependent upon message length */
|
||||
state->bg_width = state->text_padding * 2;
|
||||
|
||||
if (!string_is_empty(state->message))
|
||||
if (*state->message)
|
||||
state->bg_width += font_driver_get_message_width(
|
||||
font_msg_queue->font, state->message,
|
||||
state->message_len, 1.0f);
|
||||
|
||||
@@ -355,8 +355,8 @@ bool gfx_widget_start_load_content_animation(void)
|
||||
playlist_get_index_by_path(playlist, content_path,
|
||||
&entry);
|
||||
|
||||
if (entry &&
|
||||
!string_is_empty(entry->core_path))
|
||||
if ( entry
|
||||
&& entry->core_path && *entry->core_path)
|
||||
{
|
||||
const char *entry_core_file = path_basename_nocompression(
|
||||
entry->core_path);
|
||||
@@ -376,7 +376,7 @@ bool gfx_widget_start_load_content_animation(void)
|
||||
playlist_entry_found = true;
|
||||
|
||||
/* Get entry label */
|
||||
if (!string_is_empty(entry->label))
|
||||
if (entry->label && *entry->label)
|
||||
{
|
||||
state->content_name_len = strlcpy(state->content_name,
|
||||
entry->label, sizeof(state->content_name));
|
||||
@@ -384,7 +384,7 @@ bool gfx_widget_start_load_content_animation(void)
|
||||
}
|
||||
|
||||
/* Get entry db_name, */
|
||||
if (!string_is_empty(entry->db_name))
|
||||
if (entry->db_name && *entry->db_name)
|
||||
{
|
||||
state->system_name_len = fill_pathname(
|
||||
state->system_name, entry->db_name, "",
|
||||
@@ -403,7 +403,7 @@ bool gfx_widget_start_load_content_animation(void)
|
||||
{
|
||||
const char *playlist_path = playlist_get_conf_path(playlist);
|
||||
|
||||
if (!string_is_empty(playlist_path))
|
||||
if (playlist_path && *playlist_path)
|
||||
{
|
||||
size_t system_name_len;
|
||||
char new_system_name[512];
|
||||
@@ -421,7 +421,7 @@ bool gfx_widget_start_load_content_animation(void)
|
||||
state->system_name[0] = '\0';
|
||||
|
||||
/* Check whether a valid system name was found */
|
||||
if (!string_is_empty(state->system_name))
|
||||
if (*state->system_name)
|
||||
{
|
||||
state->system_name_len = system_name_len;
|
||||
has_system = true;
|
||||
@@ -443,7 +443,7 @@ bool gfx_widget_start_load_content_animation(void)
|
||||
if (!has_system || strchr(state->system_name, '|'))
|
||||
{
|
||||
/* Use core display name, if available */
|
||||
if (!string_is_empty(core_info->display_name))
|
||||
if (core_info->display_name && *core_info->display_name)
|
||||
state->system_name_len = strlcpy(state->system_name,
|
||||
core_info->display_name, sizeof(state->system_name));
|
||||
/* Otherwise, just use 'RetroArch' as a fallback */
|
||||
@@ -458,7 +458,7 @@ bool gfx_widget_start_load_content_animation(void)
|
||||
|
||||
/* Skip all icon filesystem checks if no icon directory
|
||||
* is set */
|
||||
if (string_is_empty(state->icon_directory))
|
||||
if (!*state->icon_directory)
|
||||
goto icon_done;
|
||||
|
||||
/* Get icon filename
|
||||
|
||||
@@ -136,7 +136,7 @@ void gfx_widget_set_progress_message(
|
||||
uintptr_t timer_tag = (uintptr_t)&state->timer;
|
||||
|
||||
/* Ensure we have a valid message string */
|
||||
if (string_is_empty(message))
|
||||
if (!message || !*message)
|
||||
return;
|
||||
|
||||
/* If widget is currently active, ignore new
|
||||
|
||||
@@ -173,7 +173,7 @@ joypad_connection_t *pad_connection_init(unsigned pads)
|
||||
joypad_connection_entry_t *find_connection_entry(uint16_t vid, uint16_t pid, const char *name)
|
||||
{
|
||||
unsigned i;
|
||||
const bool has_name = !string_is_empty(name);
|
||||
const bool has_name = name && *name;
|
||||
size_t name_len = strlen(name);
|
||||
|
||||
for (i = 0; pad_map[i].name != NULL; i++)
|
||||
|
||||
@@ -45,8 +45,6 @@
|
||||
#include "../../config.h"
|
||||
#endif
|
||||
|
||||
#include <string/stdstring.h>
|
||||
|
||||
#ifndef _XBOX
|
||||
#include "../../gfx/common/win32_common.h"
|
||||
#endif
|
||||
@@ -144,7 +142,7 @@ static void *dinput_init(const char *joypad_driver)
|
||||
if (!(di = (struct dinput_input*)calloc(1, sizeof(*di))))
|
||||
return NULL;
|
||||
|
||||
if (!string_is_empty(joypad_driver))
|
||||
if (joypad_driver && *joypad_driver)
|
||||
di->joypad_drv_name = strdup(joypad_driver);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -3221,7 +3221,7 @@ void input_overlay_auto_rotate_(
|
||||
screen_orientation = OVERLAY_ORIENTATION_LANDSCAPE;
|
||||
|
||||
/* Get orientation of active overlay */
|
||||
if (ol->active->name && *ol_active->name)
|
||||
if (*ol->active->name)
|
||||
{
|
||||
if (strstr(ol->active->name, "landscape"))
|
||||
active_overlay_orientation = OVERLAY_ORIENTATION_LANDSCAPE;
|
||||
@@ -3247,7 +3247,7 @@ void input_overlay_auto_rotate_(
|
||||
if (!desc)
|
||||
continue;
|
||||
|
||||
if (desc->next_index_name && *desc->next_index_name)
|
||||
if (*desc->next_index_name)
|
||||
{
|
||||
bool next_overlay_found = false;
|
||||
if (active_overlay_orientation == OVERLAY_ORIENTATION_LANDSCAPE)
|
||||
@@ -5460,7 +5460,7 @@ void input_config_set_mouse_display_name(unsigned port, const char *name)
|
||||
string_trim_whitespace(name_ascii);
|
||||
}
|
||||
|
||||
if (name_ascii && *name_ascii)
|
||||
if (*name_ascii)
|
||||
strlcpy(input_st->input_mouse_info[port].display_name, name_ascii,
|
||||
sizeof(input_st->input_mouse_info[port].display_name));
|
||||
}
|
||||
@@ -5514,9 +5514,7 @@ void config_read_keybinds_conf(void *data)
|
||||
prefix[0] = '\0';
|
||||
input_config_get_prefix(prefix, sizeof(prefix), i, meta);
|
||||
|
||||
if (!prefix || !*prefix)
|
||||
continue;
|
||||
if (!btn)
|
||||
if (!*prefix || !btn)
|
||||
continue;
|
||||
|
||||
fill_pathname_join_delim(str, prefix, btn, '_', sizeof(str));
|
||||
|
||||
+2
-2
@@ -41,7 +41,7 @@ int msg_hash_get_help_us_enum(enum msg_hash_enums msg, char *s, size_t len)
|
||||
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_HELP_ENABLE_HOTKEY), len);
|
||||
break;
|
||||
default:
|
||||
if (string_is_empty(s))
|
||||
if (!s || !*s)
|
||||
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_INFORMATION_AVAILABLE), len);
|
||||
break;
|
||||
}
|
||||
@@ -507,7 +507,7 @@ int msg_hash_get_help_us_enum(enum msg_hash_enums msg, char *s, size_t len)
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (string_is_empty(s))
|
||||
if (!s || !*s)
|
||||
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_INFORMATION_AVAILABLE), len);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -475,10 +475,10 @@ char* string_tokenize(char **str, const char *delim)
|
||||
size_t delim_len = 0;
|
||||
|
||||
/* Sanity checks */
|
||||
if (!str || string_is_empty(delim))
|
||||
if (!str || !delim || !*delim)
|
||||
return NULL;
|
||||
|
||||
/* Note: we don't check string_is_empty() here,
|
||||
/* Note: we don't check if string is empty here,
|
||||
* empty strings are valid */
|
||||
if (!(str_ptr = *str))
|
||||
return NULL;
|
||||
@@ -556,7 +556,7 @@ unsigned string_to_unsigned(const char *str)
|
||||
{
|
||||
const char *ptr = NULL;
|
||||
|
||||
if (string_is_empty(str))
|
||||
if (!str || !*str)
|
||||
return 0;
|
||||
|
||||
for (ptr = str; *ptr != '\0'; ptr++)
|
||||
@@ -582,7 +582,7 @@ unsigned string_hex_to_unsigned(const char *str)
|
||||
const char *hex_str = str;
|
||||
const char *ptr = NULL;
|
||||
|
||||
if (string_is_empty(str))
|
||||
if (!str || !*str)
|
||||
return 0;
|
||||
|
||||
/* Remove leading '0x', if present */
|
||||
@@ -590,7 +590,7 @@ unsigned string_hex_to_unsigned(const char *str)
|
||||
&& (str[1] == 'x' || str[1] == 'X'))
|
||||
{
|
||||
hex_str = str + 2;
|
||||
if (string_is_empty(hex_str))
|
||||
if (!hex_str || !*hex_str)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -175,7 +175,7 @@ void libretrodb_close(libretrodb_t *db)
|
||||
{
|
||||
if (db->fd)
|
||||
intfstream_close(db->fd);
|
||||
if (!string_is_empty(db->path))
|
||||
if (db->path && *db->path)
|
||||
free(db->path);
|
||||
db->path = NULL;
|
||||
db->fd = NULL;
|
||||
@@ -191,7 +191,7 @@ int libretrodb_open(const char *path, libretrodb_t *db, bool write)
|
||||
if (!fd)
|
||||
return -1;
|
||||
|
||||
if (!string_is_empty(db->path))
|
||||
if (db->path && *db->path)
|
||||
free(db->path);
|
||||
|
||||
db->path = strdup(path);
|
||||
@@ -403,7 +403,7 @@ int libretrodb_cursor_open(libretrodb_t *db,
|
||||
libretrodb_query_t *q)
|
||||
{
|
||||
intfstream_t *fd = NULL;
|
||||
if (!db || string_is_empty(db->path))
|
||||
if (!db || !db->path || !*db->path)
|
||||
return -1;
|
||||
|
||||
if (!(fd = intfstream_open_file(db->path,
|
||||
|
||||
+13
-13
@@ -316,7 +316,7 @@ void* task_push_http_transfer(const char *url, bool mute,
|
||||
const char *type,
|
||||
retro_task_callback_t cb, void *user_data)
|
||||
{
|
||||
if (!string_is_empty(url))
|
||||
if (url && *url)
|
||||
return task_push_http_transfer_generic(
|
||||
net_http_connection_new(url, type ? type : "GET", NULL),
|
||||
url, mute, false, cb, user_data);
|
||||
@@ -328,7 +328,7 @@ void *task_push_webdav_stat(const char *url, bool mute, const char *headers,
|
||||
{
|
||||
struct http_connection_t *conn;
|
||||
|
||||
if (string_is_empty(url))
|
||||
if (!url || !*url)
|
||||
return NULL;
|
||||
|
||||
if (!(conn = net_http_connection_new(url, "OPTIONS", NULL)))
|
||||
@@ -346,7 +346,7 @@ void* task_push_webdav_mkdir(const char *url, bool mute,
|
||||
{
|
||||
struct http_connection_t *conn;
|
||||
|
||||
if (string_is_empty(url))
|
||||
if (!url || !*url)
|
||||
return NULL;
|
||||
|
||||
if (!(conn = net_http_connection_new(url, "MKCOL", NULL)))
|
||||
@@ -366,7 +366,7 @@ void* task_push_webdav_put(const char *url,
|
||||
char expect[1024]; /* TODO/FIXME - check size */
|
||||
size_t _len;
|
||||
|
||||
if (string_is_empty(url))
|
||||
if (!url || !*url)
|
||||
return NULL;
|
||||
|
||||
if (!(conn = net_http_connection_new(url, "PUT", NULL)))
|
||||
@@ -391,7 +391,7 @@ void* task_push_webdav_delete(const char *url, bool mute,
|
||||
{
|
||||
struct http_connection_t *conn;
|
||||
|
||||
if (string_is_empty(url))
|
||||
if (!url || !*url)
|
||||
return NULL;
|
||||
|
||||
if (!(conn = net_http_connection_new(url, "DELETE", NULL)))
|
||||
@@ -411,7 +411,7 @@ void *task_push_webdav_move(const char *url,
|
||||
struct http_connection_t *conn;
|
||||
char dest_header[PATH_MAX_LENGTH + 512];
|
||||
|
||||
if (string_is_empty(url))
|
||||
if (!url || !*url)
|
||||
return NULL;
|
||||
|
||||
if (!(conn = net_http_connection_new(url, "MOVE", NULL)))
|
||||
@@ -438,7 +438,7 @@ void* task_push_http_transfer_file(const char* url, bool mute,
|
||||
char tmp[NAME_MAX_LENGTH] = "";
|
||||
retro_task_t *t = NULL;
|
||||
|
||||
if (string_is_empty(url))
|
||||
if (!url || !*url)
|
||||
return NULL;
|
||||
|
||||
if (!(t = (retro_task_t*)task_push_http_transfer_generic(
|
||||
@@ -473,7 +473,7 @@ void* task_push_http_transfer_with_user_agent(const char *url, bool mute,
|
||||
{
|
||||
struct http_connection_t *conn;
|
||||
|
||||
if (string_is_empty(url))
|
||||
if (!url || !*url)
|
||||
return NULL;
|
||||
|
||||
if (!(conn = net_http_connection_new(url, type ? type : "GET", NULL)))
|
||||
@@ -491,7 +491,7 @@ void* task_push_http_transfer_with_headers(const char *url, bool mute,
|
||||
{
|
||||
struct http_connection_t *conn;
|
||||
|
||||
if (string_is_empty(url))
|
||||
if (!url || !*url)
|
||||
return NULL;
|
||||
|
||||
if (!(conn = net_http_connection_new(url, type ? type : "GET", NULL)))
|
||||
@@ -507,7 +507,7 @@ void* task_push_http_post_transfer(const char *url,
|
||||
const char *post_data, bool mute,
|
||||
const char *type, retro_task_callback_t cb, void *user_data)
|
||||
{
|
||||
if (!string_is_empty(url))
|
||||
if (url && *url)
|
||||
return task_push_http_transfer_generic(
|
||||
net_http_connection_new(url, type ? type : "POST", post_data),
|
||||
url, mute, false, cb, user_data);
|
||||
@@ -521,7 +521,7 @@ void* task_push_http_post_transfer_with_user_agent(const char *url,
|
||||
{
|
||||
struct http_connection_t* conn;
|
||||
|
||||
if (string_is_empty(url))
|
||||
if (!url || !*url)
|
||||
return NULL;
|
||||
|
||||
if (!(conn = net_http_connection_new(url, type ? type : "POST", post_data)))
|
||||
@@ -540,7 +540,7 @@ void* task_push_http_post_transfer_with_headers(const char *url,
|
||||
{
|
||||
struct http_connection_t* conn;
|
||||
|
||||
if (string_is_empty(url))
|
||||
if (!url || !*url)
|
||||
return NULL;
|
||||
|
||||
if (!(conn = net_http_connection_new(url, type ? type : "POST", post_data)))
|
||||
@@ -559,7 +559,7 @@ void *task_push_http_transfer_with_content(const char *url,
|
||||
{
|
||||
struct http_connection_t *conn;
|
||||
|
||||
if (string_is_empty(url))
|
||||
if (!url || !*url)
|
||||
return NULL;
|
||||
|
||||
if (!(conn = net_http_connection_new(url, method, NULL)))
|
||||
|
||||
@@ -620,7 +620,7 @@ static bool task_overlay_resolve_targets(struct overlay *ol,
|
||||
const char *next = desc->next_index_name;
|
||||
ssize_t next_idx = (idx + 1) % len;
|
||||
|
||||
if (!string_is_empty(next))
|
||||
if (next && *next)
|
||||
{
|
||||
next_idx = task_overlay_find_index(ol, next, len);
|
||||
|
||||
@@ -857,7 +857,7 @@ static void task_overlay_deferred_load(retro_task_t *task)
|
||||
strlcpy(overlay->config.paths.path,
|
||||
tmp_str, sizeof(overlay->config.paths.path));
|
||||
|
||||
if (!string_is_empty(overlay->config.paths.path))
|
||||
if (*overlay->config.paths.path)
|
||||
{
|
||||
char overlay_resolved_path[PATH_MAX_LENGTH];
|
||||
|
||||
@@ -1146,7 +1146,7 @@ bool task_push_overlay_load_default(
|
||||
overlay_loader_t *loader = NULL;
|
||||
struct string_list *image_list = NULL;
|
||||
|
||||
if (string_is_empty(overlay_path))
|
||||
if (!overlay_path || !*overlay_path)
|
||||
return false;
|
||||
|
||||
/* Expand ~ so archive reads get an absolute path */
|
||||
|
||||
@@ -875,7 +875,7 @@ bool run_translation_service(settings_t *settings, bool paused)
|
||||
playlist_get_index_by_path(
|
||||
current_playlist, path_get(RARCH_PATH_CONTENT), &entry);
|
||||
|
||||
if (entry && !string_is_empty(entry->label))
|
||||
if (entry && entry->label && *entry->label)
|
||||
lbl = entry->label;
|
||||
}
|
||||
|
||||
@@ -1319,7 +1319,7 @@ static bool http_translate(
|
||||
separator = '&';
|
||||
|
||||
/* source lang */
|
||||
if (!string_is_empty(source_lang))
|
||||
if (source_lang && *source_lang)
|
||||
{
|
||||
new_ai_service_url[ _len] = separator;
|
||||
new_ai_service_url[++_len] = '\0';
|
||||
@@ -1333,7 +1333,7 @@ static bool http_translate(
|
||||
}
|
||||
|
||||
/* target lang */
|
||||
if (!string_is_empty(target_lang))
|
||||
if (target_lang && *target_lang)
|
||||
{
|
||||
new_ai_service_url[ _len] = separator;
|
||||
new_ai_service_url[++_len] = '\0';
|
||||
|
||||
@@ -1074,12 +1074,12 @@ static NSDictionary *topshelfDictForEntry(const struct playlist_entry *entry, gf
|
||||
NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithDictionary:@{
|
||||
@"id": [NSString stringWithUTF8String:entry->path],
|
||||
@"title": [NSString stringWithUTF8String:
|
||||
(string_is_empty(entry->label) ? path_basename(entry->path) : entry->label)],
|
||||
((!entry->label || !*entry->label) ? path_basename(entry->path) : entry->label)],
|
||||
}];
|
||||
if (!string_is_empty(path_data->content_db_name))
|
||||
if (path_data->content_db_name && *path_data->content_db_name)
|
||||
{
|
||||
const char *img_name = path_data->content_img;
|
||||
if (!string_is_empty(img_name))
|
||||
if (img_name && *img_name)
|
||||
dict[@"img"] = [NSString stringWithFormat:@"https://thumbnails.libretro.com/%s/Named_Boxarts/%s",
|
||||
path_data->content_db_name, img_name];
|
||||
}
|
||||
|
||||
@@ -1176,7 +1176,7 @@ void CoreOptionsDialog::buildLayout()
|
||||
connect(resetButton, SIGNAL(clicked()),
|
||||
this, SLOT(onCoreOptionResetClicked()));
|
||||
|
||||
if (!string_is_empty(option->info))
|
||||
if (option->info && *option->info)
|
||||
{
|
||||
char *new_info;
|
||||
size_t option_info_len = strlen(option->info);
|
||||
@@ -2284,7 +2284,7 @@ void ShaderParamsDialog::buildLayout()
|
||||
*/
|
||||
if (video_shader)
|
||||
{
|
||||
if (!string_is_empty(video_shader->path))
|
||||
if (*video_shader->path)
|
||||
{
|
||||
shader_path = video_shader->path;
|
||||
setWindowTitle(QString(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_CURRENT_SHADER)) + ": " + QFileInfo(shader_path).fileName());
|
||||
@@ -2292,7 +2292,7 @@ void ShaderParamsDialog::buildLayout()
|
||||
}
|
||||
else if (menu_shader)
|
||||
{
|
||||
if (!string_is_empty(menu_shader->path))
|
||||
if (*menu_shader->path)
|
||||
{
|
||||
shader_path = menu_shader->path;
|
||||
setWindowTitle(QString(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_CURRENT_SHADER)) + ": " + QFileInfo(shader_path).fileName());
|
||||
|
||||
@@ -56,7 +56,7 @@ static void cb_extract_thumbnail_pack(retro_task_t *task,
|
||||
free(dec);
|
||||
}
|
||||
|
||||
mainwindow->onThumbnailPackExtractFinished(string_is_empty(err));
|
||||
mainwindow->onThumbnailPackExtractFinished(!err || !*err);
|
||||
}
|
||||
|
||||
void MainWindow::onThumbnailPackDownloadNetworkError(
|
||||
|
||||
@@ -981,7 +981,7 @@ void MainWindow::onPlaylistWidgetContextMenuRequested(const QPoint&)
|
||||
key = coreListIterator.key();
|
||||
core = coreList.value(key);
|
||||
|
||||
if (string_is_empty(core->core_name))
|
||||
if (!core->core_name || !*core->core_name)
|
||||
name = core->display_name;
|
||||
else
|
||||
name = core->core_name;
|
||||
@@ -1479,7 +1479,7 @@ QString MainWindow::getPlaylistDefaultCore(QString plName)
|
||||
settings->bools.playlist_portable_paths
|
||||
? settings->paths.directory_menu_content : NULL);
|
||||
|
||||
if (!settings || string_is_empty(plNameCString))
|
||||
if (!settings || !plNameCString || !*plNameCString)
|
||||
return corePath;
|
||||
|
||||
/* Get playlist path */
|
||||
@@ -1511,7 +1511,7 @@ QString MainWindow::getPlaylistDefaultCore(QString plName)
|
||||
const char *defaultCorePath = playlist_get_default_core_path(playlist);
|
||||
|
||||
/* Get default core path */
|
||||
if ( !string_is_empty(defaultCorePath)
|
||||
if ( (defaultCorePath && *defaultCorePath)
|
||||
&& !string_is_equal(defaultCorePath, "DETECT"))
|
||||
corePath = QString::fromUtf8(defaultCorePath);
|
||||
|
||||
@@ -1553,7 +1553,7 @@ void PlaylistModel::getPlaylistItems(QString path)
|
||||
|
||||
pathArray.append(path.toUtf8());
|
||||
pathData = pathArray.constData();
|
||||
if (!string_is_empty(pathData))
|
||||
if (pathData && *pathData)
|
||||
playlistName = path_basename(pathData);
|
||||
|
||||
playlist_config_set_path(&playlist_config, pathData);
|
||||
@@ -1567,13 +1567,13 @@ void PlaylistModel::getPlaylistItems(QString path)
|
||||
|
||||
playlist_get_index(playlist, i, &entry);
|
||||
|
||||
if (string_is_empty(entry->path))
|
||||
if (!entry->path || !*entry->path)
|
||||
continue;
|
||||
|
||||
hash["path"] = entry->path;
|
||||
hash["index"] = QString::number(i);
|
||||
|
||||
if (string_is_empty(entry->label))
|
||||
if (!entry->label || !*entry->label)
|
||||
{
|
||||
hash["label"] = entry->path;
|
||||
hash["label_noext"] = entry->path;
|
||||
@@ -1584,22 +1584,22 @@ void PlaylistModel::getPlaylistItems(QString path)
|
||||
hash["label_noext"] = entry->label;
|
||||
}
|
||||
|
||||
if (!string_is_empty(entry->core_path))
|
||||
if (entry->core_path && *entry->core_path)
|
||||
hash["core_path"] = entry->core_path;
|
||||
|
||||
if (!string_is_empty(entry->core_name))
|
||||
if (entry->core_name && *entry->core_name)
|
||||
hash["core_name"] = entry->core_name;
|
||||
|
||||
if (!string_is_empty(entry->crc32))
|
||||
if (entry->crc32 && *entry->crc32)
|
||||
hash["crc32"] = entry->crc32;
|
||||
|
||||
if (!string_is_empty(entry->db_name))
|
||||
if (entry->db_name && *entry->db_name)
|
||||
{
|
||||
hash["db_name"] = entry->db_name;
|
||||
hash["db_name"].remove(".lpl");
|
||||
}
|
||||
|
||||
if (!string_is_empty(playlistName))
|
||||
if (playlistName && *playlistName)
|
||||
{
|
||||
hash["pl_name"] = playlistName;
|
||||
hash["pl_name"].remove(".lpl");
|
||||
|
||||
@@ -151,7 +151,7 @@ static bool ui_browser_window_cocoa_open(ui_browser_window_state_t *state)
|
||||
{
|
||||
NSOpenPanel *panel = [NSOpenPanel openPanel];
|
||||
|
||||
if (!string_is_empty(state->filters))
|
||||
if (state->filters && *state->filters)
|
||||
{
|
||||
#ifdef HAVE_COCOA_METAL
|
||||
[panel setAllowedFileTypes:@[BOXSTRING(state->filters), BOXSTRING(state->filters_title)]];
|
||||
@@ -205,7 +205,7 @@ static enum ui_msg_window_response ui_msg_window_cocoa_dialog(ui_msg_window_stat
|
||||
NSAlert* alert = [[NSAlert new] autorelease];
|
||||
#endif
|
||||
|
||||
if (!string_is_empty(state->title))
|
||||
if (state->title && *state->title)
|
||||
[alert setMessageText:BOXSTRING(state->title)];
|
||||
[alert setInformativeText:BOXSTRING(state->text)];
|
||||
|
||||
@@ -907,7 +907,7 @@ static void open_core_handler(ui_browser_window_state_t *state, bool result)
|
||||
settings_t *settings = config_get_ptr();
|
||||
bool set_supports_no_game_enable =
|
||||
settings->bools.set_supports_no_game_enable;
|
||||
if (!state || string_is_empty(state->result))
|
||||
if (!state || !state->result || !*state->result)
|
||||
return;
|
||||
if (!result)
|
||||
return;
|
||||
@@ -935,7 +935,7 @@ static void open_document_handler(
|
||||
struct retro_system_info *sysinfo = &runloop_state_get_ptr()->system.info;
|
||||
const char *core_name = sysinfo ? sysinfo->library_name : NULL;
|
||||
|
||||
if (!state || string_is_empty(state->result))
|
||||
if (!state || !state->result || !*state->result)
|
||||
return;
|
||||
if (!result)
|
||||
return;
|
||||
@@ -946,7 +946,7 @@ static void open_document_handler(
|
||||
{
|
||||
path_set(RARCH_PATH_CONTENT, state->result);
|
||||
|
||||
if (!string_is_empty(core_name))
|
||||
if (core_name && *core_name)
|
||||
{
|
||||
content_ctx_info_t content_info = {0};
|
||||
task_push_load_content_with_current_core_from_companion_ui(
|
||||
|
||||
@@ -2570,7 +2570,7 @@ QVector<QHash<QString, QString> > MainWindow::getCoreInfo()
|
||||
sizeof(tmp_path));
|
||||
|
||||
/* If content path is empty, fall back to global system dir path */
|
||||
if (string_is_empty(tmp_path))
|
||||
if (!*tmp_path)
|
||||
firmware_info.directory.system = settings->paths.directory_system;
|
||||
else
|
||||
{
|
||||
@@ -3019,7 +3019,7 @@ void MainWindow::loadContent(const QHash<QString, QString> &contentHash)
|
||||
/* Search for specified core - ensures path
|
||||
* is 'sanitised' */
|
||||
if ( core_info_find(core_path, &coreInfo)
|
||||
&& !string_is_empty(coreInfo->path))
|
||||
&& (coreInfo->path && *coreInfo->path))
|
||||
core_path = coreInfo->path;
|
||||
|
||||
/* If a core is currently running, the following
|
||||
@@ -3028,11 +3028,11 @@ void MainWindow::loadContent(const QHash<QString, QString> &contentHash)
|
||||
* in turn free the pointer referenced by coreInfo->path.
|
||||
* This will invalidate core_path, so we have to cache
|
||||
* its current value here. */
|
||||
if (!string_is_empty(core_path))
|
||||
if (core_path && *core_path)
|
||||
strlcpy(core_path_cached, core_path, sizeof(core_path_cached));
|
||||
|
||||
/* Add lpl extension to db_name, if required */
|
||||
if (!string_is_empty(content_db_name))
|
||||
if (content_db_name && *content_db_name)
|
||||
fill_pathname(content_db_name_full, content_db_name,
|
||||
".lpl", sizeof(content_db_name_full));
|
||||
|
||||
@@ -3827,7 +3827,8 @@ void MainWindow::setCurrentCoreLabel()
|
||||
&& !libraryName.isEmpty())
|
||||
{
|
||||
m_currentCore = sysinfo->library_name;
|
||||
m_currentCoreVersion = (string_is_empty(sysinfo->library_version)
|
||||
m_currentCoreVersion =
|
||||
((!sysinfo->library_version || !*sysinfo->library_version)
|
||||
? "" : sysinfo->library_version);
|
||||
update = true;
|
||||
}
|
||||
@@ -5542,7 +5543,7 @@ void LoadCoreWindow::initCoreList(const QStringList &extensionFilters)
|
||||
QTableWidgetItem *version_item = new QTableWidgetItem(core->display_version);
|
||||
const char *name = core->display_name;
|
||||
|
||||
if (string_is_empty(name))
|
||||
if (!name || !*name)
|
||||
name = path_basename(core->path);
|
||||
|
||||
name_item = new QTableWidgetItem(name);
|
||||
|
||||
+1
-1
@@ -498,7 +498,7 @@ void App::OnSuspending(IInspectable const& sender, SuspendingEventArgs const& ar
|
||||
if (!path_is_empty(RARCH_PATH_CONFIG))
|
||||
{
|
||||
const char* config_path = path_get(RARCH_PATH_CONFIG);
|
||||
bool path_exists = !string_is_empty(config_path);
|
||||
bool path_exists = config_path && *config_path;
|
||||
|
||||
if (path_exists)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user