Remove file_ prefixes, for consistency with the rest of libretro. They're not useful, anything they'd mean is provided by the vfs_iface-> anyways. Also rename delete to remove to match libc and avoid C++ keywords.

This commit is contained in:
Alcaro 2017-12-15 17:26:28 +01:00
parent f25ba04d91
commit cbdb91a668
5 changed files with 53 additions and 53 deletions

View File

@ -1667,7 +1667,7 @@ bool rarch_environment_cb(unsigned cmd, void *data)
retro_vfs_file_read_impl,
retro_vfs_file_write_impl,
retro_vfs_file_flush_impl,
retro_vfs_file_delete_impl
retro_vfs_file_remove_impl
};
struct retro_vfs_interface_info *vfs_iface_info = (struct retro_vfs_interface_info *) data;

View File

@ -987,63 +987,63 @@ struct retro_vfs_file_handle;
/* Get path from opaque handle. Returns the exact same path passed to file_open when getting the handle
* Introduced in VFS API v1 */
typedef const char *(RETRO_CALLCONV *retro_vfs_file_get_path_t)(struct retro_vfs_file_handle *stream);
typedef const char *(RETRO_CALLCONV *retro_vfs_get_path_t)(struct retro_vfs_file_handle *stream);
/* Open a file for reading or writing. If path points to a directory, this will
* fail. Returns the opaque file handle, or NULL for error.
* Introduced in VFS API v1 */
typedef struct retro_vfs_file_handle *(RETRO_CALLCONV *retro_vfs_file_open_t)(const char *path, unsigned mode, unsigned hints);
typedef struct retro_vfs_file_handle *(RETRO_CALLCONV *retro_vfs_open_t)(const char *path, unsigned mode, unsigned hints);
/* Close the file and release its resources. Must be called if open_file returns non-NULL. Returns 0 on succes, -1 on failure.
* Whether the call succeeds ot not, the handle passed as parameter becomes invalid and should no longer be used.
* Introduced in VFS API v1 */
typedef int (RETRO_CALLCONV *retro_vfs_file_close_t)(struct retro_vfs_file_handle *stream);
typedef int (RETRO_CALLCONV *retro_vfs_close_t)(struct retro_vfs_file_handle *stream);
/* Return the size of the file in bytes, or -1 for error.
* Introduced in VFS API v1 */
typedef int64_t (RETRO_CALLCONV *retro_vfs_file_size_t)(struct retro_vfs_file_handle *stream);
typedef int64_t (RETRO_CALLCONV *retro_vfs_size_t)(struct retro_vfs_file_handle *stream);
/* Get the current read / write position for the file. Returns - 1 for error.
* Introduced in VFS API v1 */
typedef int64_t (RETRO_CALLCONV *retro_vfs_file_tell_t)(struct retro_vfs_file_handle *stream);
typedef int64_t (RETRO_CALLCONV *retro_vfs_tell_t)(struct retro_vfs_file_handle *stream);
/* Set the current read/write position for the file. Returns the new position, -1 for error.
* Introduced in VFS API v1 */
typedef int64_t (RETRO_CALLCONV *retro_vfs_file_seek_t)(struct retro_vfs_file_handle *stream, int64_t offset, int whence);
typedef int64_t (RETRO_CALLCONV *retro_vfs_seek_t)(struct retro_vfs_file_handle *stream, int64_t offset, int whence);
/* Read data from a file. Returns the number of bytes read, or -1 for error.
* Introduced in VFS API v1 */
typedef int64_t (RETRO_CALLCONV *retro_vfs_file_read_t)(struct retro_vfs_file_handle *stream, void *s, uint64_t len);
typedef int64_t (RETRO_CALLCONV *retro_vfs_read_t)(struct retro_vfs_file_handle *stream, void *s, uint64_t len);
/* Write data to a file. Returns the number of bytes written, or -1 for error.
* Introduced in VFS API v1 */
typedef int64_t (RETRO_CALLCONV *retro_vfs_file_write_t)(struct retro_vfs_file_handle *stream, const void *s, uint64_t len);
typedef int64_t (RETRO_CALLCONV *retro_vfs_write_t)(struct retro_vfs_file_handle *stream, const void *s, uint64_t len);
/* Flush pending writes to file, if using buffered IO. Returns 0 on sucess, or -1 on failure.
* Introduced in VFS API v1 */
typedef int (RETRO_CALLCONV *retro_vfs_file_flush_t)(struct retro_vfs_file_handle *stream);
typedef int (RETRO_CALLCONV *retro_vfs_flush_t)(struct retro_vfs_file_handle *stream);
/* Delete the specified file. Returns 0 on success, -1 on failure
* Introduced in VFS API v1 */
typedef int (RETRO_CALLCONV *retro_vfs_file_delete_t)(const char *path);
typedef int (RETRO_CALLCONV *retro_vfs_remove_t)(const char *path);
/* Rename the specified file. Returns 0 on success, -1 on failure
* Introduced in VFS API v1 */
typedef int (RETRO_CALLCONV *retro_vfs_file_rename_t)(const char *old_path, const char *new_path);
typedef int (RETRO_CALLCONV *retro_vfs_rename_t)(const char *old_path, const char *new_path);
struct retro_vfs_interface
{
retro_vfs_file_get_path_t file_get_path;
retro_vfs_file_open_t file_open;
retro_vfs_file_close_t file_close;
retro_vfs_file_size_t file_size;
retro_vfs_file_tell_t file_tell;
retro_vfs_file_seek_t file_seek;
retro_vfs_file_read_t file_read;
retro_vfs_file_write_t file_write;
retro_vfs_file_flush_t file_flush;
retro_vfs_file_delete_t file_delete;
retro_vfs_file_rename_t file_rename;
retro_vfs_get_path_t get_path;
retro_vfs_open_t open;
retro_vfs_close_t close;
retro_vfs_size_t size;
retro_vfs_tell_t tell;
retro_vfs_seek_t seek;
retro_vfs_read_t read;
retro_vfs_write_t write;
retro_vfs_flush_t flush;
retro_vfs_remove_t remove;
retro_vfs_rename_t rename;
};
struct retro_vfs_interface_info

View File

@ -56,7 +56,7 @@ int64_t retro_vfs_file_write_impl(libretro_vfs_implementation_file *stream, cons
int retro_vfs_file_flush_impl(libretro_vfs_implementation_file *stream);
int retro_vfs_file_delete_impl(const char *path);
int retro_vfs_file_remove_impl(const char *path);
int retro_vfs_file_rename_impl(const char *old_path, const char *new_path);

View File

@ -35,17 +35,17 @@
static const int64_t vfs_error_return_value = -1;
static retro_vfs_file_get_path_t filestream_get_path_cb = NULL;
static retro_vfs_file_open_t filestream_open_cb = NULL;
static retro_vfs_file_close_t filestream_close_cb = NULL;
static retro_vfs_file_size_t filestream_size_cb = NULL;
static retro_vfs_file_tell_t filestream_tell_cb = NULL;
static retro_vfs_file_seek_t filestream_seek_cb = NULL;
static retro_vfs_file_read_t filestream_read_cb = NULL;
static retro_vfs_file_write_t filestream_write_cb = NULL;
static retro_vfs_file_flush_t filestream_flush_cb = NULL;
static retro_vfs_file_delete_t filestream_delete_cb = NULL;
static retro_vfs_file_rename_t filestream_rename_cb = NULL;
static retro_vfs_get_path_t filestream_get_path_cb = NULL;
static retro_vfs_open_t filestream_open_cb = NULL;
static retro_vfs_close_t filestream_close_cb = NULL;
static retro_vfs_size_t filestream_size_cb = NULL;
static retro_vfs_tell_t filestream_tell_cb = NULL;
static retro_vfs_seek_t filestream_seek_cb = NULL;
static retro_vfs_read_t filestream_read_cb = NULL;
static retro_vfs_write_t filestream_write_cb = NULL;
static retro_vfs_flush_t filestream_flush_cb = NULL;
static retro_vfs_remove_t filestream_remove_cb = NULL;
static retro_vfs_rename_t filestream_rename_cb = NULL;
struct RFILE
{
@ -68,26 +68,26 @@ void filestream_vfs_init(const struct retro_vfs_interface_info* vfs_info)
filestream_read_cb = NULL;
filestream_write_cb = NULL;
filestream_flush_cb = NULL;
filestream_delete_cb = NULL;
filestream_remove_cb = NULL;
filestream_rename_cb = NULL;
vfs_iface = vfs_info->iface;
if (vfs_info->required_interface_version <
FILESTREAM_REQUIRED_VFS_VERSION || !vfs_iface)
if (vfs_info->required_interface_version < FILESTREAM_REQUIRED_VFS_VERSION
|| !vfs_iface)
return;
filestream_get_path_cb = vfs_iface->file_get_path;
filestream_open_cb = vfs_iface->file_open;
filestream_close_cb = vfs_iface->file_close;
filestream_size_cb = vfs_iface->file_size;
filestream_tell_cb = vfs_iface->file_tell;
filestream_seek_cb = vfs_iface->file_seek;
filestream_read_cb = vfs_iface->file_read;
filestream_write_cb = vfs_iface->file_write;
filestream_flush_cb = vfs_iface->file_flush;
filestream_delete_cb = vfs_iface->file_delete;
filestream_rename_cb = vfs_iface->file_rename;
filestream_get_path_cb = vfs_iface->get_path;
filestream_open_cb = vfs_iface->open;
filestream_close_cb = vfs_iface->close;
filestream_size_cb = vfs_iface->size;
filestream_tell_cb = vfs_iface->tell;
filestream_seek_cb = vfs_iface->seek;
filestream_read_cb = vfs_iface->read;
filestream_write_cb = vfs_iface->write;
filestream_flush_cb = vfs_iface->flush;
filestream_remove_cb = vfs_iface->remove;
filestream_rename_cb = vfs_iface->rename;
}
/* Callback wrappers */
@ -269,10 +269,10 @@ int filestream_flush(RFILE *stream)
int filestream_delete(const char *path)
{
if (filestream_delete_cb != NULL)
return filestream_delete_cb(path);
if (filestream_remove_cb != NULL)
return filestream_remove_cb(path);
return retro_vfs_file_delete_impl(path);
return retro_vfs_file_remove_impl(path);
}
int filestream_rename(const char *old_path, const char *new_path)

View File

@ -434,7 +434,7 @@ int retro_vfs_file_flush_impl(libretro_vfs_implementation_file *stream)
return fflush(stream->fp);
}
int retro_vfs_file_delete_impl(const char *path)
int retro_vfs_file_remove_impl(const char *path)
{
char *path_local = NULL;
wchar_t *path_wide = NULL;