retro_vfs_opendir_impl - one less unnecessary strlen for Win32

This commit is contained in:
LibretroAdmin 2022-08-29 10:04:18 +02:00
parent 72eb52a5bc
commit fcbc71fef8

View File

@ -1015,7 +1015,6 @@ libretro_vfs_implementation_dir *retro_vfs_opendir_impl(
const char *name, bool include_hidden) const char *name, bool include_hidden)
{ {
#if defined(_WIN32) #if defined(_WIN32)
unsigned path_len;
char path_buf[1024]; char path_buf[1024];
size_t copied = 0; size_t copied = 0;
#if defined(LEGACY_WIN32) #if defined(LEGACY_WIN32)
@ -1038,16 +1037,13 @@ libretro_vfs_implementation_dir *retro_vfs_opendir_impl(
rdir->orig_path = strdup(name); rdir->orig_path = strdup(name);
#if defined(_WIN32) #if defined(_WIN32)
path_buf[0] = '\0';
path_len = strlen(name);
copied = strlcpy(path_buf, name, sizeof(path_buf)); copied = strlcpy(path_buf, name, sizeof(path_buf));
/* Non-NT platforms don't like extra slashes in the path */ /* Non-NT platforms don't like extra slashes in the path */
if (name[path_len - 1] != '\\') if (path_buf[copied - 1] != '\\')
path_buf[copied++] = '\\'; path_buf [copied++] = '\\';
path_buf[copied] = '*'; path_buf[copied ] = '*';
path_buf[copied+1] = '\0'; path_buf[copied+1] = '\0';
#if defined(LEGACY_WIN32) #if defined(LEGACY_WIN32)