Add intfstream_close

This commit is contained in:
twinaphex 2016-04-07 02:30:09 +02:00
parent 99a9769014
commit 0da67ad4f9
2 changed files with 19 additions and 0 deletions

View File

@ -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

View File

@ -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;