Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libretro-common/formats/png/rpng_encode.c
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ uint8_t* rpng_save_image_bgr24_string(const uint8_t *data,
if (!buf)
GOTO_END_ERROR();

intf_s = intfstream_open_writable_memory(buf,
intf_s = intfstream_open_memory(buf,
RETRO_VFS_FILE_ACCESS_WRITE,
RETRO_VFS_FILE_ACCESS_HINT_NONE,
_len);
Expand Down
2 changes: 2 additions & 0 deletions libretro-common/include/streams/interface_stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ intfstream_t *intfstream_open_file(const char *path,
intfstream_t *intfstream_open_memory(void *data,
unsigned mode, unsigned hints, uint64_t size);

/* Deprecated. Has the same effect as `intfstream_open_memory` with
a mode including `RETRO_VFS_FILE_ACCESS_WRITE`. */
intfstream_t *intfstream_open_writable_memory(void *data,
unsigned mode, unsigned hints, uint64_t size);

Expand Down
20 changes: 2 additions & 18 deletions libretro-common/streams/interface_stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ intfstream_t *intfstream_open_memory(void *data,
info.type = INTFSTREAM_MEMORY;
info.memory.buf.data = (uint8_t*)data;
info.memory.buf.size = size;
info.memory.writable = false;
info.memory.writable = (mode & RETRO_VFS_FILE_ACCESS_WRITE) != 0;

if (!(fd = (intfstream_t*)intfstream_init(&info)))
return NULL;
Expand All @@ -729,23 +729,7 @@ intfstream_t *intfstream_open_memory(void *data,
intfstream_t *intfstream_open_writable_memory(void *data,
unsigned mode, unsigned hints, uint64_t size)
{
intfstream_info_t info;
intfstream_t *fd = NULL;

info.type = INTFSTREAM_MEMORY;
info.memory.buf.data = (uint8_t*)data;
info.memory.buf.size = size;
info.memory.writable = true;

if (!(fd = (intfstream_t*)intfstream_init(&info)))
return NULL;

if (intfstream_open(fd, NULL, mode, hints))
return fd;

intfstream_close(fd);
free(fd);
return NULL;
return intfstream_open_memory(data, mode | RETRO_VFS_FILE_ACCESS_WRITE, hints, size);
}

intfstream_t *intfstream_open_chd_track(const char *path,
Expand Down
Loading