mirror of
https://github.com/libretro/RetroArch
synced 2025-04-02 16:20:39 +00:00
VFS specification very clearly says zero or minus one, not 'return whatever rename() says'.
This commit is contained in:
parent
f5e5490724
commit
a8359a8664
@ -448,7 +448,7 @@ int retro_vfs_file_flush_impl(libretro_vfs_implementation_file *stream)
|
|||||||
{
|
{
|
||||||
if (!stream)
|
if (!stream)
|
||||||
return -1;
|
return -1;
|
||||||
return fflush(stream->fp);
|
return fflush(stream->fp)==0 ? 0 : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int retro_vfs_file_remove_impl(const char *path)
|
int retro_vfs_file_remove_impl(const char *path)
|
||||||
@ -457,7 +457,7 @@ int retro_vfs_file_remove_impl(const char *path)
|
|||||||
wchar_t *path_wide = NULL;
|
wchar_t *path_wide = NULL;
|
||||||
|
|
||||||
if (!path || !*path)
|
if (!path || !*path)
|
||||||
return false;
|
return -1;
|
||||||
|
|
||||||
(void)path_local;
|
(void)path_local;
|
||||||
(void)path_wide;
|
(void)path_wide;
|
||||||
@ -472,7 +472,7 @@ int retro_vfs_file_remove_impl(const char *path)
|
|||||||
free(path_local);
|
free(path_local);
|
||||||
|
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
return true;
|
return 0;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
path_wide = utf8_to_utf16_string_alloc(path);
|
path_wide = utf8_to_utf16_string_alloc(path);
|
||||||
@ -483,14 +483,14 @@ int retro_vfs_file_remove_impl(const char *path)
|
|||||||
free(path_wide);
|
free(path_wide);
|
||||||
|
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
return true;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
if (remove(path) == 0)
|
if (remove(path) == 0)
|
||||||
return true;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
return false;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int retro_vfs_file_rename_impl(const char *old_path, const char *new_path)
|
int retro_vfs_file_rename_impl(const char *old_path, const char *new_path)
|
||||||
@ -520,7 +520,7 @@ int retro_vfs_file_rename_impl(const char *old_path, const char *new_path)
|
|||||||
int ret = rename(old_path_local, new_path_local);
|
int ret = rename(old_path_local, new_path_local);
|
||||||
free(old_path_local);
|
free(old_path_local);
|
||||||
free(new_path_local);
|
free(new_path_local);
|
||||||
return ret;
|
return ret==0 ? 0 : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
free(old_path_local);
|
free(old_path_local);
|
||||||
@ -539,7 +539,7 @@ int retro_vfs_file_rename_impl(const char *old_path, const char *new_path)
|
|||||||
int ret = _wrename(old_path_wide, new_path_wide);
|
int ret = _wrename(old_path_wide, new_path_wide);
|
||||||
free(old_path_wide);
|
free(old_path_wide);
|
||||||
free(new_path_wide);
|
free(new_path_wide);
|
||||||
return ret;
|
return ret==0 ? 0 : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
free(old_path_wide);
|
free(old_path_wide);
|
||||||
@ -550,7 +550,7 @@ int retro_vfs_file_rename_impl(const char *old_path, const char *new_path)
|
|||||||
#endif
|
#endif
|
||||||
return -1;
|
return -1;
|
||||||
#else
|
#else
|
||||||
return rename(old_path, new_path);
|
return rename(old_path, new_path)==0 ? 0 : -1;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user