From 0da67ad4f9b40e6dec4d5dd615694a4705f5a6e7 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 7 Apr 2016 02:30:09 +0200 Subject: [PATCH] Add intfstream_close --- .../include/streams/interface_stream.h | 2 ++ libretro-common/streams/interface_stream.c | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/libretro-common/include/streams/interface_stream.h b/libretro-common/include/streams/interface_stream.h index 9e480beba7..dc9a55981e 100644 --- a/libretro-common/include/streams/interface_stream.h +++ b/libretro-common/include/streams/interface_stream.h @@ -72,4 +72,6 @@ int intfstream_seek(intfstream_internal_t *intf, void intfstream_rewind(intfstream_internal_t *intf); +int intfstream_close(intfstream_internal_t *intf); + #endif diff --git a/libretro-common/streams/interface_stream.c b/libretro-common/streams/interface_stream.c index 32f03a1f92..5bdc397de7 100644 --- a/libretro-common/streams/interface_stream.c +++ b/libretro-common/streams/interface_stream.c @@ -90,6 +90,23 @@ bool intfstream_open(intfstream_internal_t *intf, const char *path, return true; } +int intfstream_close(intfstream_internal_t *intf) +{ + if (!intf) + return -1; + + switch (intf->type) + { + case INTFSTREAM_FILE: + return filestream_close(intf->file.fp); + case INTFSTREAM_MEMORY: + memstream_close(intf->memory.fp); + return 0; + } + + return -1; +} + void *intfstream_init(intfstream_info_t *info) { intfstream_internal_t *intf = NULL;