mirror of
https://github.com/libretro/RetroArch
synced 2025-03-31 19:21:06 +00:00
(libretro-common) Small cleanups - don't NULL-terminate string
if we pass it off to fill_pathname_join (or another function that uses strlcpy under the hood)
This commit is contained in:
parent
1245cbc63b
commit
8d12918243
@ -150,21 +150,19 @@ function_t dylib_proc(dylib_t lib, const char *proc)
|
|||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
HMODULE mod = (HMODULE)lib;
|
HMODULE mod = (HMODULE)lib;
|
||||||
#ifndef __WINRT__
|
|
||||||
if (!mod)
|
|
||||||
mod = GetModuleHandle(NULL);
|
|
||||||
#else
|
|
||||||
/* GetModuleHandle is not available on UWP */
|
|
||||||
if (!mod)
|
if (!mod)
|
||||||
{
|
{
|
||||||
|
#ifdef __WINRT__
|
||||||
|
/* GetModuleHandle is not available on UWP */
|
||||||
/* It's not possible to lookup symbols in current executable
|
/* It's not possible to lookup symbols in current executable
|
||||||
* on UWP. */
|
* on UWP. */
|
||||||
DebugBreak();
|
DebugBreak();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
#else
|
||||||
|
mod = GetModuleHandle(NULL);
|
||||||
#endif
|
#endif
|
||||||
sym = (function_t)GetProcAddress(mod, proc);
|
}
|
||||||
if (!sym)
|
if (!(sym = (function_t)GetProcAddress(mod, proc)))
|
||||||
{
|
{
|
||||||
set_dl_error();
|
set_dl_error();
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -139,7 +139,6 @@ static int dir_list_read(const char *dir,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
file_path[0] = '\0';
|
|
||||||
fill_pathname_join(file_path, dir, name, sizeof(file_path));
|
fill_pathname_join(file_path, dir, name, sizeof(file_path));
|
||||||
|
|
||||||
if (retro_dirent_is_dir(entry, NULL))
|
if (retro_dirent_is_dir(entry, NULL))
|
||||||
@ -273,8 +272,8 @@ bool dir_list_initialize(struct string_list *list,
|
|||||||
bool include_hidden, bool include_compressed,
|
bool include_hidden, bool include_compressed,
|
||||||
bool recursive)
|
bool recursive)
|
||||||
{
|
{
|
||||||
if (!list || !string_list_initialize(list))
|
if (list && string_list_initialize(list))
|
||||||
return false;
|
return dir_list_append(list, dir, ext, include_dirs,
|
||||||
return dir_list_append(list, dir, ext, include_dirs,
|
|
||||||
include_hidden, include_compressed, recursive);
|
include_hidden, include_compressed, recursive);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -77,9 +77,8 @@ void label_sanitize(char *label, bool (*left)(char*), bool (*right)(char*))
|
|||||||
{
|
{
|
||||||
/* check for the start of the range */
|
/* check for the start of the range */
|
||||||
if ((*left)(&label[lindex]))
|
if ((*left)(&label[lindex]))
|
||||||
copy = false;
|
copy = false;
|
||||||
|
else
|
||||||
if (copy)
|
|
||||||
new_label[rindex++] = label[lindex];
|
new_label[rindex++] = label[lindex];
|
||||||
}
|
}
|
||||||
else if ((*right)(&label[lindex]))
|
else if ((*right)(&label[lindex]))
|
||||||
|
@ -798,7 +798,7 @@ int retro_vfs_stat_impl(const char *path, int32_t *size)
|
|||||||
tmp = strdup(path);
|
tmp = strdup(path);
|
||||||
len = strlen(tmp);
|
len = strlen(tmp);
|
||||||
if (tmp[len-1] == '/')
|
if (tmp[len-1] == '/')
|
||||||
tmp[len-1] = '\0';
|
tmp[len-1] = '\0';
|
||||||
|
|
||||||
dir_ret = sceIoGetstat(tmp, &buf);
|
dir_ret = sceIoGetstat(tmp, &buf);
|
||||||
free(tmp);
|
free(tmp);
|
||||||
@ -1160,7 +1160,6 @@ bool retro_vfs_dirent_is_dir_impl(libretro_vfs_implementation_dir *rdir)
|
|||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
/* dirent struct doesn't have d_type, do it the slow way ... */
|
/* dirent struct doesn't have d_type, do it the slow way ... */
|
||||||
path[0] = '\0';
|
|
||||||
fill_pathname_join(path, rdir->orig_path, retro_vfs_dirent_get_name_impl(rdir), sizeof(path));
|
fill_pathname_join(path, rdir->orig_path, retro_vfs_dirent_get_name_impl(rdir), sizeof(path));
|
||||||
if (stat(path, &buf) < 0)
|
if (stat(path, &buf) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user