From ea037799a4c9a7f521cfdd2701d2c5e4f2a2d223 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 7 Apr 2016 02:24:31 +0200 Subject: [PATCH] Add memstream_rewind --- libretro-common/include/streams/memory_stream.h | 2 ++ libretro-common/streams/memory_stream.c | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/libretro-common/include/streams/memory_stream.h b/libretro-common/include/streams/memory_stream.h index 3609d6f0fe..b4041e4b81 100644 --- a/libretro-common/include/streams/memory_stream.h +++ b/libretro-common/include/streams/memory_stream.h @@ -42,6 +42,8 @@ char *memstream_gets(memstream_t *stream, char *buffer, size_t len); size_t memstream_pos(memstream_t *stream); +void memstream_rewind(memstream_t *stream); + int memstream_seek(memstream_t *stream, int offset, int whence); void memstream_set_buffer(uint8_t *buffer, size_t size); diff --git a/libretro-common/streams/memory_stream.c b/libretro-common/streams/memory_stream.c index 396f388d0f..ffeb4a3191 100644 --- a/libretro-common/streams/memory_stream.c +++ b/libretro-common/streams/memory_stream.c @@ -142,6 +142,11 @@ int memstream_seek(memstream_t *stream, int offset, int whence) return -1; } +void memstream_rewind(memstream_t *stream) +{ + memstream_seek(stream, 0L, SEEK_SET); +} + size_t memstream_pos(memstream_t *stream) { return stream->ptr;