diff --git a/libretro-common/include/streams/interface_stream.h b/libretro-common/include/streams/interface_stream.h index ba8a4d9f94..291fb43f75 100644 --- a/libretro-common/include/streams/interface_stream.h +++ b/libretro-common/include/streams/interface_stream.h @@ -1,7 +1,7 @@ /* Copyright (C) 2010-2015 The RetroArch team * * --------------------------------------------------------------------------------------- - * The following license statement only applies to this file (memory_stream.h). + * The following license statement only applies to this file (interface_stream.h). * --------------------------------------------------------------------------------------- * * Permission is hereby granted, free of charge, @@ -62,4 +62,9 @@ ssize_t intfstream_read(intfstream_internal_t *intf, ssize_t intfstream_write(intfstream_internal_t *intf, const void *s, size_t len); +char *intfstream_gets(intfstream_internal_t *intf, + char *buffer, size_t len); + +int intfstream_getc(intfstream_internal_t *intf); + #endif diff --git a/libretro-common/streams/interface_stream.c b/libretro-common/streams/interface_stream.c index 359c66d972..ac397273df 100644 --- a/libretro-common/streams/interface_stream.c +++ b/libretro-common/streams/interface_stream.c @@ -1,3 +1,25 @@ +/* Copyright (C) 2010-2016 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (interface_stream.c). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + #include #include @@ -129,3 +151,37 @@ ssize_t intfstream_write(intfstream_internal_t *intf, const void *s, size_t len) return 0; } + +char *intfstream_gets(intfstream_internal_t *intf, char *buffer, size_t len) +{ + if (!intf) + return NULL; + + switch (intf->type) + { + case INTFSTREAM_FILE: + /* unimplemented */ + break; + case INTFSTREAM_MEMORY: + return memstream_gets(intf->memory.fp, buffer, len); + } + + return NULL; +} + +int intfstream_getc(intfstream_internal_t *intf) +{ + if (!intf) + return 0; + + switch (intf->type) + { + case INTFSTREAM_FILE: + /* unimplemented */ + break; + case INTFSTREAM_MEMORY: + return memstream_getc(intf->memory.fp); + } + + return 0; +}