Simplify filestream_read_file
This commit is contained in:
parent
ad70bb9866
commit
5960cd80d2
|
@ -517,7 +517,7 @@ error:
|
||||||
int filestream_read_file(const char *path, void **buf, ssize_t *len)
|
int filestream_read_file(const char *path, void **buf, ssize_t *len)
|
||||||
{
|
{
|
||||||
ssize_t ret = 0;
|
ssize_t ret = 0;
|
||||||
ssize_t content_buf_size = 0;
|
int64_t content_buf_size = 0;
|
||||||
void *content_buf = NULL;
|
void *content_buf = NULL;
|
||||||
RFILE *file = filestream_open(path,
|
RFILE *file = filestream_open(path,
|
||||||
RETRO_VFS_FILE_ACCESS_READ,
|
RETRO_VFS_FILE_ACCESS_READ,
|
||||||
|
@ -529,15 +529,11 @@ int filestream_read_file(const char *path, void **buf, ssize_t *len)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filestream_seek(file, 0, SEEK_END) != 0)
|
content_buf_size = filestream_get_size(file);
|
||||||
goto error;
|
|
||||||
|
|
||||||
content_buf_size = filestream_tell(file);
|
|
||||||
if (content_buf_size < 0)
|
if (content_buf_size < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
filestream_rewind(file);
|
|
||||||
|
|
||||||
content_buf = malloc(content_buf_size + 1);
|
content_buf = malloc(content_buf_size + 1);
|
||||||
|
|
||||||
if (!content_buf)
|
if (!content_buf)
|
||||||
|
|
Loading…
Reference in New Issue